@mirai/ui 1.1.14 → 1.1.16

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
@@ -486,16 +486,17 @@ const MyComponent = (props) => {
486
486
  --mirai-ui-button-disabled-background: var(--mirai-ui-content-border);
487
487
  --mirai-ui-button-disabled-color: var(--mirai-ui-content-light);
488
488
  --mirai-ui-button-focus-color: var(--mirai-ui-focus-color);
489
- --mirai-ui-button-focus-color-shadow: var(--mirai-ui-focus-color-shadow);
490
- --mirai-ui-button-font-weight: var(--mirai-ui-font-weight);
489
+ --mirai-ui-button-font-weight: var(--mirai-ui-font-medium-weight);
491
490
  --mirai-ui-button-padding-x: var(--mirai-ui-space-L);
492
- --mirai-ui-button-padding-y: var(--mirai-ui-space-S);
491
+ --mirai-ui-button-height: calc(var(--mirai-ui-space-XL) - var(--mirai-ui-space-XXS));
492
+ --mirai-ui-button-large-height: var(--mirai-ui-space-XL);
493
+ --mirai-ui-button-small-height: calc(var(--mirai-ui-space-XL) - var(--mirai-ui-space-M));
493
494
  --mirai-ui-button-radius: var(--mirai-ui-border-radius);
494
495
  --mirai-ui-button-secondary-background: var(--mirai-ui-base);
496
+ --mirai-ui-button-secondary-background-active: var(--mirai-ui-accent-background);
495
497
  --mirai-ui-button-secondary-color: var(--mirai-ui-button-background);
496
498
  --mirai-ui-button-secondary-focus-color: var(--mirai-ui-button-focus-color);
497
499
  --mirai-ui-button-secondary-focus-color-shadow: var(--mirai-ui-focus-color-shadow);
498
- --mirai-ui-button-squared: calc(var(--mirai-ui-space-M) * 2);
499
500
  --mirai-ui-button-transparent-background-active: var(--mirai-ui-accent-background);
500
501
  --mirai-ui-button-transparent-color: var(--mirai-ui-content);
501
502
  ```
@@ -10,7 +10,7 @@ var _react = _interopRequireDefault(require("react"));
10
10
  var _helpers = require("../../helpers");
11
11
  var _primitives = require("../../primitives");
12
12
  var _ActionModule = _interopRequireDefault(require("./Action.module.css"));
13
- var _excluded = ["bold", "children", "disabled", "href", "inline", "large", "small", "tag", "target", "underline", "wide", "onPress"];
13
+ var _excluded = ["bold", "children", "disabled", "href", "paragraph", "small", "tag", "target", "tiny", "underline", "wide", "onPress"];
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16
16
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -24,12 +24,12 @@ var Action = function Action(_ref) {
24
24
  children = _ref.children,
25
25
  disabled = _ref.disabled,
26
26
  href = _ref.href,
27
- inline = _ref.inline,
28
- large = _ref.large,
27
+ paragraph = _ref.paragraph,
29
28
  small = _ref.small,
30
29
  _ref$tag = _ref.tag,
31
30
  tag = _ref$tag === void 0 ? 'button' : _ref$tag,
32
31
  target = _ref.target,
32
+ tiny = _ref.tiny,
33
33
  underline = _ref.underline,
34
34
  wide = _ref.wide,
35
35
  _onPress = _ref.onPress,
@@ -43,7 +43,7 @@ var Action = function Action(_ref) {
43
43
  _onPress && _onPress(event);
44
44
  if (href && target) window.open(href, target);else if (href) window.location = href;
45
45
  },
46
- className: (0, _helpers.styles)(_ActionModule.default.action, bold && _ActionModule.default.bold, disabled && _ActionModule.default.disabled, inline && _ActionModule.default.inline, large && _ActionModule.default.large, small && _ActionModule.default.small, underline && _ActionModule.default.underline, wide && _ActionModule.default.wide, others.className)
46
+ className: (0, _helpers.styles)(_ActionModule.default.action, bold && _ActionModule.default.bold, disabled && _ActionModule.default.disabled, paragraph ? _ActionModule.default.paragraph : small ? _ActionModule.default.small : tiny ? _ActionModule.default.tiny : undefined, underline && _ActionModule.default.underline, wide && _ActionModule.default.wide, others.className)
47
47
  }), children);
48
48
  };
49
49
  exports.Action = Action;
@@ -53,11 +53,11 @@ Action.propTypes = {
53
53
  children: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
54
54
  disabled: _propTypes.default.bool,
55
55
  href: _propTypes.default.string,
56
- inline: _propTypes.default.bool,
57
- large: _propTypes.default.bool,
56
+ paragraph: _propTypes.default.bool,
58
57
  small: _propTypes.default.bool,
59
58
  tag: _propTypes.default.string,
60
59
  target: _propTypes.default.string,
60
+ tiny: _propTypes.default.bool,
61
61
  underline: _propTypes.default.bool,
62
62
  wide: _propTypes.default.bool,
63
63
  onEnter: _propTypes.default.func,
@@ -1 +1 @@
1
- {"version":3,"file":"Action.js","names":["Action","bold","children","disabled","href","inline","large","small","tag","target","underline","wide","onPress","others","React","createElement","Pressable","role","event","window","open","location","className","styles","style","action","displayName","propTypes","PropTypes","bool","oneOfType","string","node","onEnter","func","onLeave"],"sources":["../../../src/components/Action/Action.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Pressable } from '../../primitives';\nimport style from './Action.module.css';\n\nconst Action = ({\n bold,\n children,\n disabled,\n href,\n inline,\n large,\n small,\n tag = 'button',\n target,\n underline,\n wide,\n onPress,\n ...others\n}) =>\n React.createElement(\n Pressable,\n {\n ...others,\n disabled,\n href,\n role: others.role || 'action',\n tag: href ? 'a' : tag,\n onPress: (event) => {\n onPress && onPress(event);\n if (href && target) window.open(href, target);\n else if (href) window.location = href;\n },\n className: styles(\n style.action,\n bold && style.bold,\n disabled && style.disabled,\n inline && style.inline,\n large && style.large,\n small && style.small,\n underline && style.underline,\n wide && style.wide,\n others.className,\n ),\n },\n children,\n );\n\nAction.displayName = 'Component:Action';\n\nAction.propTypes = {\n bold: PropTypes.bool,\n children: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),\n disabled: PropTypes.bool,\n href: PropTypes.string,\n inline: PropTypes.bool,\n large: PropTypes.bool,\n small: PropTypes.bool,\n tag: PropTypes.string,\n target: PropTypes.string,\n underline: PropTypes.bool,\n wide: PropTypes.bool,\n onEnter: PropTypes.func,\n onLeave: PropTypes.func,\n onPress: PropTypes.func,\n};\n\nexport { Action };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAExC,IAAMA,MAAM,GAAG,SAATA,MAAM;EAAA,IACVC,IAAI,QAAJA,IAAI;IACJC,QAAQ,QAARA,QAAQ;IACRC,QAAQ,QAARA,QAAQ;IACRC,IAAI,QAAJA,IAAI;IACJC,MAAM,QAANA,MAAM;IACNC,KAAK,QAALA,KAAK;IACLC,KAAK,QAALA,KAAK;IAAA,gBACLC,GAAG;IAAHA,GAAG,yBAAG,QAAQ;IACdC,MAAM,QAANA,MAAM;IACNC,SAAS,QAATA,SAAS;IACTC,IAAI,QAAJA,IAAI;IACJC,QAAO,QAAPA,OAAO;IACJC,MAAM;EAAA,oBAETC,cAAK,CAACC,aAAa,CACjBC,qBAAS,kCAEJH,MAAM;IACTV,QAAQ,EAARA,QAAQ;IACRC,IAAI,EAAJA,IAAI;IACJa,IAAI,EAAEJ,MAAM,CAACI,IAAI,IAAI,QAAQ;IAC7BT,GAAG,EAAEJ,IAAI,GAAG,GAAG,GAAGI,GAAG;IACrBI,OAAO,EAAE,iBAACM,KAAK,EAAK;MAClBN,QAAO,IAAIA,QAAO,CAACM,KAAK,CAAC;MACzB,IAAId,IAAI,IAAIK,MAAM,EAAEU,MAAM,CAACC,IAAI,CAAChB,IAAI,EAAEK,MAAM,CAAC,CAAC,KACzC,IAAIL,IAAI,EAAEe,MAAM,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children","disabled","href","paragraph","small","tag","target","tiny","underline","wide","onPress","others","React","createElement","Pressable","role","event","window","open","location","className","styles","style","action","undefined","displayName","propTypes","PropTypes","bool","oneOfType","string","node","onEnter","func","onLeave"],"sources":["../../../src/components/Action/Action.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Pressable } from '../../primitives';\nimport style from './Action.module.css';\n\nconst Action = ({\n bold,\n children,\n disabled,\n href,\n paragraph,\n small,\n tag = 'button',\n target,\n tiny,\n underline,\n wide,\n onPress,\n ...others\n}) =>\n React.createElement(\n Pressable,\n {\n ...others,\n disabled,\n href,\n role: others.role || 'action',\n tag: href ? 'a' : tag,\n onPress: (event) => {\n onPress && onPress(event);\n if (href && target) window.open(href, target);\n else if (href) window.location = href;\n },\n className: styles(\n style.action,\n bold && style.bold,\n disabled && style.disabled,\n paragraph ? style.paragraph : small ? style.small : tiny ? style.tiny : undefined,\n underline && style.underline,\n wide && style.wide,\n others.className,\n ),\n },\n children,\n );\n\nAction.displayName = 'Component:Action';\n\nAction.propTypes = {\n bold: PropTypes.bool,\n children: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),\n disabled: PropTypes.bool,\n href: PropTypes.string,\n paragraph: PropTypes.bool,\n small: PropTypes.bool,\n tag: PropTypes.string,\n target: PropTypes.string,\n tiny: PropTypes.bool,\n underline: PropTypes.bool,\n wide: PropTypes.bool,\n onEnter: PropTypes.func,\n onLeave: PropTypes.func,\n onPress: PropTypes.func,\n};\n\nexport { Action };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAExC,IAAMA,MAAM,GAAG,SAATA,MAAM;EAAA,IACVC,IAAI,QAAJA,IAAI;IACJC,QAAQ,QAARA,QAAQ;IACRC,QAAQ,QAARA,QAAQ;IACRC,IAAI,QAAJA,IAAI;IACJC,SAAS,QAATA,SAAS;IACTC,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,EAAE2B,kBAAS,CAACE,SAAS,CAAC,CAACF,kBAAS,CAACG,MAAM,EAAEH,kBAAS,CAACI,IAAI,CAAC,CAAC;EACjE9B,QAAQ,EAAE0B,kBAAS,CAACC,IAAI;EACxB1B,IAAI,EAAEyB,kBAAS,CAACG,MAAM;EACtB3B,SAAS,EAAEwB,kBAAS,CAACC,IAAI;EACzBxB,KAAK,EAAEuB,kBAAS,CAACC,IAAI;EACrBvB,GAAG,EAAEsB,kBAAS,CAACG,MAAM;EACrBxB,MAAM,EAAEqB,kBAAS,CAACG,MAAM;EACxBvB,IAAI,EAAEoB,kBAAS,CAACC,IAAI;EACpBpB,SAAS,EAAEmB,kBAAS,CAACC,IAAI;EACzBnB,IAAI,EAAEkB,kBAAS,CAACC,IAAI;EACpBI,OAAO,EAAEL,kBAAS,CAACM,IAAI;EACvBC,OAAO,EAAEP,kBAAS,CAACM,IAAI;EACvBvB,OAAO,EAAEiB,kBAAS,CAACM;AACrB,CAAC"}
@@ -25,24 +25,16 @@
25
25
  color: var(--mirai-ui-focus-color);
26
26
  }
27
27
 
28
- .action:not(.inline):not(.large):not(.small) {
29
- padding: var(--mirai-ui-button-padding-y) 0;
30
- }
31
-
32
- .large {
28
+ .paragraph {
33
29
  font-size: var(--mirai-ui-font-size-paragraph);
34
30
  }
35
31
 
36
- .large:not(.inline) {
37
- padding: var(--mirai-ui-button-padding-y) 0;
38
- }
39
-
40
32
  .small {
41
33
  font-size: var(--mirai-ui-font-size-small);
42
34
  }
43
35
 
44
- .small:not(.inline) {
45
- padding: var(--mirai-ui-button-padding-y) 0;
36
+ .tiny {
37
+ font-size: var(--mirai-ui-font-size-tiny);
46
38
  }
47
39
 
48
40
  .underline,
@@ -24,11 +24,11 @@ Story.args = {
24
24
  disabled: false,
25
25
  href: '',
26
26
  icon: '',
27
- inline: false,
28
- large: false,
27
+ paragraph: false,
29
28
  small: false,
30
29
  tag: 'button',
31
30
  target: '',
31
+ tiny: false,
32
32
  underline: false,
33
33
  wide: false,
34
34
  // inherited properties
@@ -1 +1 @@
1
- {"version":3,"file":"Action.stories.js","names":["title","Story","props","storyName","args","children","ICON","INFO","disabled","href","icon","inline","large","small","tag","target","underline","wide","testId","style","argTypes","onEnter","action","onLeave","onPress"],"sources":["../../../src/components/Action/Action.stories.jsx"],"sourcesContent":["import React from 'react';\n\nimport { Action } from './Action';\nimport { Icon, ICON } from '../../primitives/Icon';\n\nexport default { title: 'Components' };\n\nexport const Story = (props) => <Action {...props} />;\n\nStory.storyName = 'Action';\n\nStory.args = {\n children: (\n <>\n <Icon value={ICON.INFO} />\n children\n </>\n ),\n disabled: false,\n href: '',\n icon: '',\n inline: false,\n large: false,\n small: false,\n tag: 'button',\n target: '',\n underline: false,\n wide: false,\n // inherited properties\n testId: 'test-story',\n style: {},\n};\n\nStory.argTypes = {\n onEnter: { action: 'onEnter' },\n onLeave: { action: 'onLeave' },\n onPress: { action: 'onPress' },\n};\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AAAmD;AAAA,eAEpC;EAAEA,KAAK,EAAE;AAAa,CAAC;AAAA;AAE/B,IAAMC,KAAK,GAAG,SAARA,KAAK,CAAIC,KAAK;EAAA,oBAAK,6BAAC,cAAM,EAAKA,KAAK,CAAI;AAAA;AAAC;AAEtDD,KAAK,CAACE,SAAS,GAAG,QAAQ;AAE1BF,KAAK,CAACG,IAAI,GAAG;EACXC,QAAQ,eACN,yEACE,6BAAC,UAAI;IAAC,KAAK,EAAEC,UAAI,CAACC;EAAK,EAAG,aAG7B;EACDC,QAAQ,EAAE,KAAK;EACfC,IAAI,EAAE,EAAE;EACRC,IAAI,EAAE,EAAE;EACRC,MAAM,EAAE,KAAK;EACbC,KAAK,EAAE,KAAK;EACZC,KAAK,EAAE,KAAK;EACZC,GAAG,EAAE,QAAQ;EACbC,MAAM,EAAE,EAAE;EACVC,SAAS,EAAE,KAAK;EAChBC,IAAI,EAAE,KAAK;EACX;EACAC,MAAM,EAAE,YAAY;EACpBC,KAAK,EAAE,CAAC;AACV,CAAC;AAEDlB,KAAK,CAACmB,QAAQ,GAAG;EACfC,OAAO,EAAE;IAAEC,MAAM,EAAE;EAAU,CAAC;EAC9BC,OAAO,EAAE;IAAED,MAAM,EAAE;EAAU,CAAC;EAC9BE,OAAO,EAAE;IAAEF,MAAM,EAAE;EAAU;AAC/B,CAAC"}
1
+ {"version":3,"file":"Action.stories.js","names":["title","Story","props","storyName","args","children","ICON","INFO","disabled","href","icon","paragraph","small","tag","target","tiny","underline","wide","testId","style","argTypes","onEnter","action","onLeave","onPress"],"sources":["../../../src/components/Action/Action.stories.jsx"],"sourcesContent":["import React from 'react';\n\nimport { Action } from './Action';\nimport { Icon, ICON } from '../../primitives/Icon';\n\nexport default { title: 'Components' };\n\nexport const Story = (props) => <Action {...props} />;\n\nStory.storyName = 'Action';\n\nStory.args = {\n children: (\n <>\n <Icon value={ICON.INFO} />\n children\n </>\n ),\n disabled: false,\n href: '',\n icon: '',\n paragraph: false,\n small: false,\n tag: 'button',\n target: '',\n tiny: false,\n underline: false,\n wide: false,\n // inherited properties\n testId: 'test-story',\n style: {},\n};\n\nStory.argTypes = {\n onEnter: { action: 'onEnter' },\n onLeave: { action: 'onLeave' },\n onPress: { action: 'onPress' },\n};\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AAAmD;AAAA,eAEpC;EAAEA,KAAK,EAAE;AAAa,CAAC;AAAA;AAE/B,IAAMC,KAAK,GAAG,SAARA,KAAK,CAAIC,KAAK;EAAA,oBAAK,6BAAC,cAAM,EAAKA,KAAK,CAAI;AAAA;AAAC;AAEtDD,KAAK,CAACE,SAAS,GAAG,QAAQ;AAE1BF,KAAK,CAACG,IAAI,GAAG;EACXC,QAAQ,eACN,yEACE,6BAAC,UAAI;IAAC,KAAK,EAAEC,UAAI,CAACC;EAAK,EAAG,aAG7B;EACDC,QAAQ,EAAE,KAAK;EACfC,IAAI,EAAE,EAAE;EACRC,IAAI,EAAE,EAAE;EACRC,SAAS,EAAE,KAAK;EAChBC,KAAK,EAAE,KAAK;EACZC,GAAG,EAAE,QAAQ;EACbC,MAAM,EAAE,EAAE;EACVC,IAAI,EAAE,KAAK;EACXC,SAAS,EAAE,KAAK;EAChBC,IAAI,EAAE,KAAK;EACX;EACAC,MAAM,EAAE,YAAY;EACpBC,KAAK,EAAE,CAAC;AACV,CAAC;AAEDlB,KAAK,CAACmB,QAAQ,GAAG;EACfC,OAAO,EAAE;IAAEC,MAAM,EAAE;EAAU,CAAC;EAC9BC,OAAO,EAAE;IAAED,MAAM,EAAE;EAAU,CAAC;EAC9BE,OAAO,EAAE;IAAEF,MAAM,EAAE;EAAU;AAC/B,CAAC"}
@@ -53,66 +53,46 @@ exports[`component:<Action> prop:href 1`] = `
53
53
  </DocumentFragment>
54
54
  `;
55
55
 
56
- exports[`component:<Action> prop:inline & prop:large 1`] = `
56
+ exports[`component:<Action> prop:paragraph 1`] = `
57
57
  <DocumentFragment>
58
58
  <button
59
- class="pressable action inline large"
59
+ class="pressable action paragraph"
60
60
  >
61
61
  children
62
62
  </button>
63
63
  </DocumentFragment>
64
64
  `;
65
65
 
66
- exports[`component:<Action> prop:inline & prop:small 1`] = `
67
- <DocumentFragment>
68
- <button
69
- class="pressable action inline small"
70
- >
71
- children
72
- </button>
73
- </DocumentFragment>
74
- `;
75
-
76
- exports[`component:<Action> prop:inline default 1`] = `
66
+ exports[`component:<Action> prop:small 1`] = `
77
67
  <DocumentFragment>
78
68
  <button
79
- class="pressable action inline"
69
+ class="pressable action small"
80
70
  >
81
71
  children
82
72
  </button>
83
73
  </DocumentFragment>
84
74
  `;
85
75
 
86
- exports[`component:<Action> prop:large 1`] = `
76
+ exports[`component:<Action> prop:tag 1`] = `
87
77
  <DocumentFragment>
88
- <button
89
- class="pressable action large"
78
+ <a
79
+ class="pressable action"
90
80
  >
91
81
  children
92
- </button>
82
+ </a>
93
83
  </DocumentFragment>
94
84
  `;
95
85
 
96
- exports[`component:<Action> prop:small 1`] = `
86
+ exports[`component:<Action> prop:tiny 1`] = `
97
87
  <DocumentFragment>
98
88
  <button
99
- class="pressable action small"
89
+ class="pressable action tiny"
100
90
  >
101
91
  children
102
92
  </button>
103
93
  </DocumentFragment>
104
94
  `;
105
95
 
106
- exports[`component:<Action> prop:tag 1`] = `
107
- <DocumentFragment>
108
- <a
109
- class="pressable action"
110
- >
111
- children
112
- </a>
113
- </DocumentFragment>
114
- `;
115
-
116
96
  exports[`component:<Action> prop:underline 1`] = `
117
97
  <DocumentFragment>
118
98
  <button
@@ -8,9 +8,11 @@ button.button {
8
8
  font-size: var(--mirai-ui-font-size-action);
9
9
  font-weight: var(--mirai-ui-button-font-weight);
10
10
  justify-content: center;
11
+ max-height: var(--mirai-ui-button-height);
12
+ min-height: var(--mirai-ui-button-height);
11
13
  outline: none;
12
14
  overflow: hidden;
13
- padding: var(--mirai-ui-button-padding-y) var(--mirai-ui-button-padding-x);
15
+ padding: 0 var(--mirai-ui-button-padding-x);
14
16
  position: relative;
15
17
  transition: background-color var(--mirai-ui-motion-collapse) var(--mirai-ui-motion-easing),
16
18
  box-shadow var(--mirai-ui-motion-collapse) var(--mirai-ui-motion-easing),
@@ -18,6 +20,11 @@ button.button {
18
20
  width: fit-content;
19
21
  }
20
22
 
23
+ button.button,
24
+ button.button .children {
25
+ gap: var(--mirai-ui-space-XXS);
26
+ }
27
+
21
28
  /* -- variants */
22
29
  button.button:disabled:not(.busy) {
23
30
  background-color: var(--mirai-ui-button-disabled-background);
@@ -32,8 +39,8 @@ button.secondary {
32
39
 
33
40
  button.button:not(:disabled).secondary:active,
34
41
  button.button:not(:disabled).secondary:hover {
35
- box-shadow: inset 0 0 0 var(--mirai-ui-border-width) var(--mirai-ui-button-secondary-focus-color),
36
- 0 0 0 var(--mirai-ui-focus-width) var(--mirai-ui-button-secondary-focus-color-shadow);
42
+ background-color: var(--mirai-ui-button-secondary-background-active);
43
+ box-shadow: inset 0 0 0 var(--mirai-ui-border-width) var(--mirai-ui-button-secondary-focus-color);
37
44
  color: var(--mirai-ui-button-secondary-focus-color);
38
45
  }
39
46
 
@@ -50,31 +57,41 @@ button.transparent:not(:disabled):hover {
50
57
 
51
58
  button.button:not(:disabled):not(.secondary):not(.transparent):active,
52
59
  button.button:not(:disabled):not(.secondary):not(.transparent):hover {
53
- box-shadow: 0 0 0 var(--mirai-ui-focus-width) var(--mirai-ui-button-focus-color-shadow);
54
60
  background-color: var(--mirai-ui-button-focus-color);
55
61
  }
56
62
 
57
63
  /* -- sizing */
58
- button.large:not(.squared) {
64
+ button.large {
59
65
  font-size: var(--mirai-ui-font-size-paragraph);
60
- padding: var(--mirai-ui-button-padding-y)
61
- calc(var(--mirai-ui-button-padding-x) + calc(var(--mirai-ui-button-padding-y) / 2));
66
+ max-height: var(--mirai-ui-button-large-height);
67
+ min-height: var(--mirai-ui-button-large-height);
62
68
  }
63
69
 
64
70
  button.rounded {
65
71
  border-radius: var(--mirai-ui-space-XXL);
66
72
  }
67
73
 
68
- button.small:not(.squared) {
74
+ button.small {
69
75
  font-size: var(--mirai-ui-font-size-small);
70
- padding: var(--mirai-ui-button-padding-y) calc(var(--mirai-ui-button-padding-x) / 2);
76
+ max-height: var(--mirai-ui-button-small-height);
77
+ min-height: var(--mirai-ui-button-small-height);
78
+ padding: 0 calc(var(--mirai-ui-button-padding-x) / 2);
71
79
  }
72
80
 
73
81
  button.squared {
74
- height: var(--mirai-ui-button-squared);
75
82
  padding: 0;
76
- min-width: var(--mirai-ui-button-squared);
77
- width: var(--mirai-ui-button-squared);
83
+ min-width: var(--mirai-ui-button-height);
84
+ max-width: var(--mirai-ui-button-height);
85
+ }
86
+
87
+ button.large.squared {
88
+ min-width: var(--mirai-ui-button-large-height);
89
+ max-width: var(--mirai-ui-button-large-height);
90
+ }
91
+
92
+ button.small.squared {
93
+ min-width: var(--mirai-ui-button-small-height);
94
+ max-width: var(--mirai-ui-button-small-height);
78
95
  }
79
96
 
80
97
  button.wide {
@@ -8,9 +8,13 @@ exports.default = exports.Story = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _ = require("../../");
10
10
  var _Button = require("./Button");
11
- var _excluded = ["busy", "icon"];
11
+ var _excluded = ["busy"];
12
12
  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); }
13
13
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
15
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
17
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
14
18
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
19
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16
20
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -31,27 +35,31 @@ var _default = {
31
35
  exports.default = _default;
32
36
  var Story = function Story(_ref) {
33
37
  var busyProp = _ref.busy,
34
- icon = _ref.icon,
35
38
  props = _objectWithoutProperties(_ref, _excluded);
36
39
  var _useState = (0, _react.useState)(busyProp),
37
40
  _useState2 = _slicedToArray(_useState, 2),
38
41
  busy = _useState2[0],
39
42
  setBusy = _useState2[1];
43
+ var renderChildren = function renderChildren(_ref2) {
44
+ var children = _ref2.children,
45
+ icon = _ref2.icon;
46
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, icon && /*#__PURE__*/_react.default.createElement(_.Icon, {
47
+ value: _.ICON[icon]
48
+ }), children);
49
+ };
40
50
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.Button, _objectSpread(_objectSpread({}, props), {}, {
41
51
  busy: busy
42
- })), /*#__PURE__*/_react.default.createElement(_Button.Button, _extends({}, _objectSpread(_objectSpread({}, props), {}, {
52
+ }), renderChildren(props)), /*#__PURE__*/_react.default.createElement(_Button.Button, _extends({}, _objectSpread(_objectSpread({}, props), {}, {
43
53
  busy: busy
44
54
  }), {
45
55
  secondary: true
46
- })), /*#__PURE__*/_react.default.createElement(_Button.Button, _extends({}, _objectSpread(_objectSpread({}, props), {}, {
56
+ }), renderChildren(props)), /*#__PURE__*/_react.default.createElement(_Button.Button, _extends({}, _objectSpread(_objectSpread({}, props), {}, {
47
57
  busy: busy
48
58
  }), {
49
59
  transparent: true
50
- })), /*#__PURE__*/_react.default.createElement(_Button.Button, _objectSpread(_objectSpread({}, props), {}, {
60
+ }), renderChildren(props)), /*#__PURE__*/_react.default.createElement(_Button.Button, _objectSpread(_objectSpread({}, props), {}, {
51
61
  busy: busy
52
- }), /*#__PURE__*/_react.default.createElement(_.Icon, {
53
- value: _.ICON[icon]
54
- })), /*#__PURE__*/_react.default.createElement(_.View, {
62
+ }), renderChildren(props)), /*#__PURE__*/_react.default.createElement(_.View, {
55
63
  onClick: function onClick() {
56
64
  return setBusy(!busy);
57
65
  }
@@ -81,7 +89,7 @@ Story.args = {
81
89
  };
82
90
  Story.argTypes = {
83
91
  icon: {
84
- options: Object.keys(_.ICON),
92
+ options: [undefined].concat(_toConsumableArray(Object.keys(_.ICON))),
85
93
  control: {
86
94
  type: 'select'
87
95
  },
@@ -1 +1 @@
1
- {"version":3,"file":"Button.stories.js","names":["title","Story","busyProp","busy","icon","props","useState","setBusy","ICON","storyName","args","children","disabled","undefined","large","rounded","secondary","small","squared","tag","tooltip","transparent","wide","testId","style","marginBottom","argTypes","options","Object","keys","control","type","defaultValue","onEnter","action","onLeave","onPress"],"sources":["../../../src/components/Button/Button.stories.jsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport React, { useState } from 'react';\n\nimport { Icon, ICON, View } from '../../';\nimport { Button } from './Button';\n\nexport default { title: 'Components' };\n\nexport const Story = ({ busy: busyProp, icon, ...props }) => {\n const [busy, setBusy] = useState(busyProp);\n\n return (\n <>\n <Button {...{ ...props, busy }} />\n <Button {...{ ...props, busy }} secondary />\n <Button {...{ ...props, busy }} transparent />\n <Button {...{ ...props, busy }}>\n <Icon value={ICON[icon]} />\n </Button>\n\n <View onClick={() => setBusy(!busy)}>Switch busy</View>\n </>\n );\n};\n\nStory.storyName = 'Button';\n\nStory.args = {\n busy: false,\n children: 'children',\n disabled: false,\n icon: undefined,\n large: false,\n rounded: false,\n secondary: false,\n small: false,\n squared: false,\n tag: 'button',\n tooltip: 'tooltip',\n transparent: false,\n wide: false,\n // inherited properties\n testId: 'test-story',\n style: { marginBottom: 'var(--mirai-ui-space-M)' },\n};\n\nStory.argTypes = {\n icon: {\n options: Object.keys(ICON),\n control: { type: 'select' },\n defaultValue: Object.keys(ICON)[0],\n },\n onEnter: { action: 'onEnter' },\n onLeave: { action: 'onLeave' },\n onPress: { action: 'onPress' },\n};\n"],"mappings":";;;;;;;AACA;AAEA;AACA;AAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAEnB;EAAEA,KAAK,EAAE;AAAa,CAAC;AAAA;AAE/B,IAAMC,KAAK,GAAG,SAARA,KAAK,OAA2C;EAAA,IAA/BC,QAAQ,QAAdC,IAAI;IAAYC,IAAI,QAAJA,IAAI;IAAKC,KAAK;EACpD,gBAAwB,IAAAC,eAAQ,EAACJ,QAAQ,CAAC;IAAA;IAAnCC,IAAI;IAAEI,OAAO;EAEpB,oBACE,yEACE,6BAAC,cAAM,kCAAUF,KAAK;IAAEF,IAAI,EAAJA;EAAI,GAAM,eAClC,6BAAC,cAAM,+CAAUE,KAAK;IAAEF,IAAI,EAAJA;EAAI;IAAI,SAAS;EAAA,GAAG,eAC5C,6BAAC,cAAM,+CAAUE,KAAK;IAAEF,IAAI,EAAJA;EAAI;IAAI,WAAW;EAAA,GAAG,eAC9C,6BAAC,cAAM,kCAAUE,KAAK;IAAEF,IAAI,EAAJA;EAAI,iBAC1B,6BAAC,MAAI;IAAC,KAAK,EAAEK,MAAI,CAACJ,IAAI;EAAE,EAAG,CACpB,eAET,6BAAC,MAAI;IAAC,OAAO,EAAE;MAAA,OAAMG,OAAO,CAAC,CAACJ,IAAI,CAAC;IAAA;EAAC,iBAAmB,CACtD;AAEP,CAAC;AAAC;AAEFF,KAAK,CAACQ,SAAS,GAAG,QAAQ;AAE1BR,KAAK,CAACS,IAAI,GAAG;EACXP,IAAI,EAAE,KAAK;EACXQ,QAAQ,EAAE,UAAU;EACpBC,QAAQ,EAAE,KAAK;EACfR,IAAI,EAAES,SAAS;EACfC,KAAK,EAAE,KAAK;EACZC,OAAO,EAAE,KAAK;EACdC,SAAS,EAAE,KAAK;EAChBC,KAAK,EAAE,KAAK;EACZC,OAAO,EAAE,KAAK;EACdC,GAAG,EAAE,QAAQ;EACbC,OAAO,EAAE,SAAS;EAClBC,WAAW,EAAE,KAAK;EAClBC,IAAI,EAAE,KAAK;EACX;EACAC,MAAM,EAAE,YAAY;EACpBC,KAAK,EAAE;IAAEC,YAAY,EAAE;EAA0B;AACnD,CAAC;AAEDxB,KAAK,CAACyB,QAAQ,GAAG;EACftB,IAAI,EAAE;IACJuB,OAAO,EAAEC,MAAM,CAACC,IAAI,CAACrB,MAAI,CAAC;IAC1BsB,OAAO,EAAE;MAAEC,IAAI,EAAE;IAAS,CAAC;IAC3BC,YAAY,EAAEJ,MAAM,CAACC,IAAI,CAACrB,MAAI,CAAC,CAAC,CAAC;EACnC,CAAC;EACDyB,OAAO,EAAE;IAAEC,MAAM,EAAE;EAAU,CAAC;EAC9BC,OAAO,EAAE;IAAED,MAAM,EAAE;EAAU,CAAC;EAC9BE,OAAO,EAAE;IAAEF,MAAM,EAAE;EAAU;AAC/B,CAAC"}
1
+ {"version":3,"file":"Button.stories.js","names":["title","Story","busyProp","busy","props","useState","setBusy","renderChildren","children","icon","ICON","storyName","args","disabled","undefined","large","rounded","secondary","small","squared","tag","tooltip","transparent","wide","testId","style","marginBottom","argTypes","options","Object","keys","control","type","defaultValue","onEnter","action","onLeave","onPress"],"sources":["../../../src/components/Button/Button.stories.jsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport React, { useState } from 'react';\n\nimport { Icon, ICON, View } from '../../';\nimport { Button } from './Button';\n\nexport default { title: 'Components' };\n\nexport const Story = ({ busy: busyProp, ...props }) => {\n const [busy, setBusy] = useState(busyProp);\n\n const renderChildren = ({ children, icon }) => (\n <>\n {icon && <Icon value={ICON[icon]} />}\n {children}\n </>\n );\n\n return (\n <>\n <Button {...{ ...props, busy }}>{renderChildren(props)}</Button>\n <Button {...{ ...props, busy }} secondary>\n {renderChildren(props)}\n </Button>\n <Button {...{ ...props, busy }} transparent>\n {renderChildren(props)}\n </Button>\n <Button {...{ ...props, busy }}>{renderChildren(props)}</Button>\n\n <View onClick={() => setBusy(!busy)}>Switch busy</View>\n </>\n );\n};\n\nStory.storyName = 'Button';\n\nStory.args = {\n busy: false,\n children: 'children',\n disabled: false,\n icon: undefined,\n large: false,\n rounded: false,\n secondary: false,\n small: false,\n squared: false,\n tag: 'button',\n tooltip: 'tooltip',\n transparent: false,\n wide: false,\n // inherited properties\n testId: 'test-story',\n style: { marginBottom: 'var(--mirai-ui-space-M)' },\n};\n\nStory.argTypes = {\n icon: {\n options: [undefined, ...Object.keys(ICON)],\n control: { type: 'select' },\n defaultValue: Object.keys(ICON)[0],\n },\n onEnter: { action: 'onEnter' },\n onLeave: { action: 'onLeave' },\n onPress: { action: 'onPress' },\n};\n"],"mappings":";;;;;;;AACA;AAEA;AACA;AAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAEnB;EAAEA,KAAK,EAAE;AAAa,CAAC;AAAA;AAE/B,IAAMC,KAAK,GAAG,SAARA,KAAK,OAAqC;EAAA,IAAzBC,QAAQ,QAAdC,IAAI;IAAeC,KAAK;EAC9C,gBAAwB,IAAAC,eAAQ,EAACH,QAAQ,CAAC;IAAA;IAAnCC,IAAI;IAAEG,OAAO;EAEpB,IAAMC,cAAc,GAAG,SAAjBA,cAAc;IAAA,IAAMC,QAAQ,SAARA,QAA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B,IAAI,EAAE;IACJmB,OAAO,GAAGd,SAAS,4BAAKe,MAAM,CAACC,IAAI,CAACpB,MAAI,CAAC,EAAC;IAC1CqB,OAAO,EAAE;MAAEC,IAAI,EAAE;IAAS,CAAC;IAC3BC,YAAY,EAAEJ,MAAM,CAACC,IAAI,CAACpB,MAAI,CAAC,CAAC,CAAC;EACnC,CAAC;EACDwB,OAAO,EAAE;IAAEC,MAAM,EAAE;EAAU,CAAC;EAC9BC,OAAO,EAAE;IAAED,MAAM,EAAE;EAAU,CAAC;EAC9BE,OAAO,EAAE;IAAEF,MAAM,EAAE;EAAU;AAC/B,CAAC"}
@@ -55,6 +55,7 @@ var InputNumber = function InputNumber(_ref) {
55
55
  disabled: disabled || value <= min,
56
56
  rounded: rounded,
57
57
  secondary: true,
58
+ small: true,
58
59
  squared: true,
59
60
  onPress: function onPress() {
60
61
  return onChange(value - step, name);
@@ -67,6 +68,7 @@ var InputNumber = function InputNumber(_ref) {
67
68
  disabled: disabled || value >= max,
68
69
  rounded: rounded,
69
70
  secondary: true,
71
+ small: true,
70
72
  squared: true,
71
73
  onPress: function onPress() {
72
74
  return onChange(value + step, name);
@@ -1 +1 @@
1
- {"version":3,"file":"InputNumber.js","names":["InputNumber","disabled","hint","label","max","min","name","required","rounded","showRequired","step","value","onChange","others","role","styles","style","inputNumber","className","texts","ICON","REMOVE","ADD","displayName","propTypes","PropTypes","bool","oneOfType","string","array","number","isRequired","func"],"sources":["../../../src/components/InputNumber/InputNumber.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Icon, ICON, Text, View } from '../../primitives';\nimport { Button } from '../Button';\nimport { Hint, Label } from '../InputText/partials';\nimport style from './InputNumber.module.css';\n\nconst InputNumber = ({\n disabled,\n hint,\n label,\n max,\n min = 0,\n name,\n required,\n rounded = true,\n showRequired = false,\n step = 1,\n value = 0,\n onChange = () => {},\n ...others\n}) => (\n <View {...others} role={others.role || 'input-number'} row className={styles(style.inputNumber, others.className)}>\n <View className={style.texts}>\n {label && <Label {...{ disabled, label, required: showRequired && required }} className={style.label} />}\n {hint && <Hint {...{ disabled, hint }} className={style.hint} />}\n </View>\n <Button\n disabled={disabled || value <= min}\n rounded={rounded}\n secondary\n squared\n onPress={() => onChange(value - step, name)}\n >\n <Icon value={ICON.REMOVE} />\n </Button>\n <Text className={styles(style.value, disabled && style.disabled)}>{typeof value === 'number' ? value : min}</Text>\n <Button\n disabled={disabled || value >= max}\n rounded={rounded}\n secondary\n squared\n onPress={() => onChange(value + step, name)}\n >\n <Icon value={ICON.ADD} />\n </Button>\n </View>\n);\n\nInputNumber.displayName = 'Component:InputNumber';\n\nInputNumber.propTypes = {\n disabled: PropTypes.bool,\n hint: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),\n label: PropTypes.string,\n max: PropTypes.number,\n min: PropTypes.number,\n name: PropTypes.string.isRequired,\n required: PropTypes.bool,\n rounded: PropTypes.bool,\n showRequired: PropTypes.bool,\n step: PropTypes.number,\n value: PropTypes.number,\n onChange: PropTypes.func,\n};\n\nexport { InputNumber };\n"],"mappings":";;;;;;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AAA6C;AAAA;AAAA;AAAA;AAAA;AAE7C,IAAMA,WAAW,GAAG,SAAdA,WAAW;EAAA,IACfC,QAAQ,QAARA,QAAQ;IACRC,IAAI,QAAJA,IAAI;IACJC,KAAK,QAALA,KAAK;IACLC,GAAG,QAAHA,GAAG;IAAA,gBACHC,GAAG;IAAHA,GAAG,yBAAG,CAAC;IACPC,IAAI,QAAJA,IAAI;IACJC,QAAQ,QAARA,QAAQ;IAAA,oBACRC,OAAO;IAAPA,OAAO,6BAAG,IAAI;IAAA,yBACdC,YAAY;IAAZA,YAAY,kCAAG,KAAK;IAAA,iBACpBC,IAAI;IAAJA,IAAI,0BAAG,CAAC;IAAA,kBACRC,KAAK;IAALA,KAAK,2BAAG,CAAC;IAAA,qBACTC,QAAQ;IAARA,QAAQ,8BA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AQ,CAACD,KAAK,GAAGD,IAAI,EAAEJ,IAAI,CAAC;IAAA;EAAC,gBAE5C,6BAAC,gBAAI;IAAC,KAAK,EAAEc,gBAAI,CAACE;EAAI,EAAG,CAClB,CACJ;AAAA,CACR;AAAC;AAEFtB,WAAW,CAACuB,WAAW,GAAG,uBAAuB;AAEjDvB,WAAW,CAACwB,SAAS,GAAG;EACtBvB,QAAQ,EAAEwB,kBAAS,CAACC,IAAI;EACxBxB,IAAI,EAAEuB,kBAAS,CAACE,SAAS,CAAC,CAACF,kBAAS,CAACG,MAAM,EAAEH,kBAAS,CAACI,KAAK,CAAC,CAAC;EAC9D1B,KAAK,EAAEsB,kBAAS,CAACG,MAAM;EACvBxB,GAAG,EAAEqB,kBAAS,CAACK,MAAM;EACrBzB,GAAG,EAAEoB,kBAAS,CAACK,MAAM;EACrBxB,IAAI,EAAEmB,kBAAS,CAACG,MAAM,CAACG,UAAU;EACjCxB,QAAQ,EAAEkB,kBAAS,CAACC,IAAI;EACxBlB,OAAO,EAAEiB,kBAAS,CAACC,IAAI;EACvBjB,YAAY,EAAEgB,kBAAS,CAACC,IAAI;EAC5BhB,IAAI,EAAEe,kBAAS,CAACK,MAAM;EACtBnB,KAAK,EAAEc,kBAAS,CAACK,MAAM;EACvBlB,QAAQ,EAAEa,kBAAS,CAACO;AACtB,CAAC"}
1
+ {"version":3,"file":"InputNumber.js","names":["InputNumber","disabled","hint","label","max","min","name","required","rounded","showRequired","step","value","onChange","others","role","styles","style","inputNumber","className","texts","ICON","REMOVE","ADD","displayName","propTypes","PropTypes","bool","oneOfType","string","array","number","isRequired","func"],"sources":["../../../src/components/InputNumber/InputNumber.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Icon, ICON, Text, View } from '../../primitives';\nimport { Button } from '../Button';\nimport { Hint, Label } from '../InputText/partials';\nimport style from './InputNumber.module.css';\n\nconst InputNumber = ({\n disabled,\n hint,\n label,\n max,\n min = 0,\n name,\n required,\n rounded = true,\n showRequired = false,\n step = 1,\n value = 0,\n onChange = () => {},\n ...others\n}) => (\n <View {...others} role={others.role || 'input-number'} row className={styles(style.inputNumber, others.className)}>\n <View className={style.texts}>\n {label && <Label {...{ disabled, label, required: showRequired && required }} className={style.label} />}\n {hint && <Hint {...{ disabled, hint }} className={style.hint} />}\n </View>\n <Button\n disabled={disabled || value <= min}\n rounded={rounded}\n secondary\n small\n squared\n onPress={() => onChange(value - step, name)}\n >\n <Icon value={ICON.REMOVE} />\n </Button>\n <Text className={styles(style.value, disabled && style.disabled)}>{typeof value === 'number' ? value : min}</Text>\n <Button\n disabled={disabled || value >= max}\n rounded={rounded}\n secondary\n small\n squared\n onPress={() => onChange(value + step, name)}\n >\n <Icon value={ICON.ADD} />\n </Button>\n </View>\n);\n\nInputNumber.displayName = 'Component:InputNumber';\n\nInputNumber.propTypes = {\n disabled: PropTypes.bool,\n hint: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),\n label: PropTypes.string,\n max: PropTypes.number,\n min: PropTypes.number,\n name: PropTypes.string.isRequired,\n required: PropTypes.bool,\n rounded: PropTypes.bool,\n showRequired: PropTypes.bool,\n step: PropTypes.number,\n value: PropTypes.number,\n onChange: PropTypes.func,\n};\n\nexport { InputNumber };\n"],"mappings":";;;;;;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AAA6C;AAAA;AAAA;AAAA;AAAA;AAE7C,IAAMA,WAAW,GAAG,SAAdA,WAAW;EAAA,IACfC,QAAQ,QAARA,QAAQ;IACRC,IAAI,QAAJA,IAAI;IACJC,KAAK,QAALA,KAAK;IACLC,GAAG,QAAHA,GAAG;IAAA,gBACHC,GAAG;IAAHA,GAAG,yBAAG,CAAC;IACPC,IAAI,QAAJA,IAAI;IACJC,QAAQ,QAARA,QAAQ;IAAA,oBACRC,OAAO;IAAPA,OAAO,6BAAG,IAAI;IAAA,yBACdC,YAAY;IAAZA,YAAY,kCAAG,KAAK;IAAA,iBACpBC,I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EAAEJ,QAAQ,IAAIU,KAAK,IAAIP,GAAI;IACnC,OAAO,EAAEI,OAAQ;IACjB,SAAS;IACT,KAAK;IACL,OAAO;IACP,OAAO,EAAE;MAAA,OAAMI,QAAQ,CAACD,KAAK,GAAGD,IAAI,EAAEJ,IAAI,CAAC;IAAA;EAAC,gBAE5C,6BAAC,gBAAI;IAAC,KAAK,EAAEc,gBAAI,CAACE;EAAI,EAAG,CAClB,CACJ;AAAA,CACR;AAAC;AAEFtB,WAAW,CAACuB,WAAW,GAAG,uBAAuB;AAEjDvB,WAAW,CAACwB,SAAS,GAAG;EACtBvB,QAAQ,EAAEwB,kBAAS,CAACC,IAAI;EACxBxB,IAAI,EAAEuB,kBAAS,CAACE,SAAS,CAAC,CAACF,kBAAS,CAACG,MAAM,EAAEH,kBAAS,CAACI,KAAK,CAAC,CAAC;EAC9D1B,KAAK,EAAEsB,kBAAS,CAACG,MAAM;EACvBxB,GAAG,EAAEqB,kBAAS,CAACK,MAAM;EACrBzB,GAAG,EAAEoB,kBAAS,CAACK,MAAM;EACrBxB,IAAI,EAAEmB,kBAAS,CAACG,MAAM,CAACG,UAAU;EACjCxB,QAAQ,EAAEkB,kBAAS,CAACC,IAAI;EACxBlB,OAAO,EAAEiB,kBAAS,CAACC,IAAI;EACvBjB,YAAY,EAAEgB,kBAAS,CAACC,IAAI;EAC5BhB,IAAI,EAAEe,kBAAS,CAACK,MAAM;EACtBnB,KAAK,EAAEc,kBAAS,CAACK,MAAM;EACvBlB,QAAQ,EAAEa,kBAAS,CAACO;AACtB,CAAC"}
@@ -9,7 +9,7 @@ exports[`component:<InputNumber> inherit:className 1`] = `
9
9
  class="view texts"
10
10
  />
11
11
  <button
12
- class="pressable disabled button rounded squared disabled"
12
+ class="pressable disabled button small rounded squared disabled"
13
13
  disabled=""
14
14
  >
15
15
  <span
@@ -40,7 +40,7 @@ exports[`component:<InputNumber> inherit:className 1`] = `
40
40
  0
41
41
  </span>
42
42
  <button
43
- class="pressable button rounded squared secondary"
43
+ class="pressable button small rounded squared secondary"
44
44
  >
45
45
  <span
46
46
  class="icon headline-3"
@@ -77,7 +77,7 @@ exports[`component:<InputNumber> prop:disabled 1`] = `
77
77
  class="view texts"
78
78
  />
79
79
  <button
80
- class="pressable disabled button rounded squared disabled"
80
+ class="pressable disabled button small rounded squared disabled"
81
81
  disabled=""
82
82
  >
83
83
  <span
@@ -108,7 +108,7 @@ exports[`component:<InputNumber> prop:disabled 1`] = `
108
108
  0
109
109
  </span>
110
110
  <button
111
- class="pressable disabled button rounded squared disabled"
111
+ class="pressable disabled button small rounded squared disabled"
112
112
  disabled=""
113
113
  >
114
114
  <span
@@ -152,7 +152,7 @@ exports[`component:<InputNumber> prop:hint 1`] = `
152
152
  </span>
153
153
  </div>
154
154
  <button
155
- class="pressable disabled button rounded squared disabled"
155
+ class="pressable disabled button small rounded squared disabled"
156
156
  disabled=""
157
157
  >
158
158
  <span
@@ -183,7 +183,7 @@ exports[`component:<InputNumber> prop:hint 1`] = `
183
183
  0
184
184
  </span>
185
185
  <button
186
- class="pressable button rounded squared secondary"
186
+ class="pressable button small rounded squared secondary"
187
187
  >
188
188
  <span
189
189
  class="icon headline-3"
@@ -226,7 +226,7 @@ exports[`component:<InputNumber> prop:label 1`] = `
226
226
  </span>
227
227
  </div>
228
228
  <button
229
- class="pressable disabled button rounded squared disabled"
229
+ class="pressable disabled button small rounded squared disabled"
230
230
  disabled=""
231
231
  >
232
232
  <span
@@ -257,7 +257,7 @@ exports[`component:<InputNumber> prop:label 1`] = `
257
257
  0
258
258
  </span>
259
259
  <button
260
- class="pressable button rounded squared secondary"
260
+ class="pressable button small rounded squared secondary"
261
261
  >
262
262
  <span
263
263
  class="icon headline-3"
@@ -294,7 +294,7 @@ exports[`component:<InputNumber> prop:max 1`] = `
294
294
  class="view texts"
295
295
  />
296
296
  <button
297
- class="pressable button rounded squared secondary"
297
+ class="pressable button small rounded squared secondary"
298
298
  >
299
299
  <span
300
300
  class="icon headline-3"
@@ -324,7 +324,7 @@ exports[`component:<InputNumber> prop:max 1`] = `
324
324
  10
325
325
  </span>
326
326
  <button
327
- class="pressable disabled button rounded squared disabled"
327
+ class="pressable disabled button small rounded squared disabled"
328
328
  disabled=""
329
329
  >
330
330
  <span
@@ -362,7 +362,7 @@ exports[`component:<InputNumber> prop:min 1`] = `
362
362
  class="view texts"
363
363
  />
364
364
  <button
365
- class="pressable disabled button rounded squared disabled"
365
+ class="pressable disabled button small rounded squared disabled"
366
366
  disabled=""
367
367
  >
368
368
  <span
@@ -393,7 +393,7 @@ exports[`component:<InputNumber> prop:min 1`] = `
393
393
  10
394
394
  </span>
395
395
  <button
396
- class="pressable button rounded squared secondary"
396
+ class="pressable button small rounded squared secondary"
397
397
  >
398
398
  <span
399
399
  class="icon headline-3"
@@ -430,7 +430,7 @@ exports[`component:<InputNumber> prop:required & prop:showRequired (true) 1`] =
430
430
  class="view texts"
431
431
  />
432
432
  <button
433
- class="pressable button rounded squared secondary"
433
+ class="pressable button small rounded squared secondary"
434
434
  >
435
435
  <span
436
436
  class="icon headline-3"
@@ -460,7 +460,7 @@ exports[`component:<InputNumber> prop:required & prop:showRequired (true) 1`] =
460
460
  10
461
461
  </span>
462
462
  <button
463
- class="pressable button rounded squared secondary"
463
+ class="pressable button small rounded squared secondary"
464
464
  >
465
465
  <span
466
466
  class="icon headline-3"
@@ -497,7 +497,7 @@ exports[`component:<InputNumber> prop:required 1`] = `
497
497
  class="view texts"
498
498
  />
499
499
  <button
500
- class="pressable button rounded squared secondary"
500
+ class="pressable button small rounded squared secondary"
501
501
  >
502
502
  <span
503
503
  class="icon headline-3"
@@ -527,7 +527,7 @@ exports[`component:<InputNumber> prop:required 1`] = `
527
527
  10
528
528
  </span>
529
529
  <button
530
- class="pressable button rounded squared secondary"
530
+ class="pressable button small rounded squared secondary"
531
531
  >
532
532
  <span
533
533
  class="icon headline-3"
@@ -564,7 +564,7 @@ exports[`component:<InputNumber> prop:rounded 1`] = `
564
564
  class="view texts"
565
565
  />
566
566
  <button
567
- class="pressable button rounded squared secondary"
567
+ class="pressable button small rounded squared secondary"
568
568
  >
569
569
  <span
570
570
  class="icon headline-3"
@@ -594,7 +594,7 @@ exports[`component:<InputNumber> prop:rounded 1`] = `
594
594
  10
595
595
  </span>
596
596
  <button
597
- class="pressable button rounded squared secondary"
597
+ class="pressable button small rounded squared secondary"
598
598
  >
599
599
  <span
600
600
  class="icon headline-3"
@@ -631,7 +631,7 @@ exports[`component:<InputNumber> prop:value 1`] = `
631
631
  class="view texts"
632
632
  />
633
633
  <button
634
- class="pressable button rounded squared secondary"
634
+ class="pressable button small rounded squared secondary"
635
635
  >
636
636
  <span
637
637
  class="icon headline-3"
@@ -661,7 +661,7 @@ exports[`component:<InputNumber> prop:value 1`] = `
661
661
  10
662
662
  </span>
663
663
  <button
664
- class="pressable button rounded squared secondary"
664
+ class="pressable button small rounded squared secondary"
665
665
  >
666
666
  <span
667
667
  class="icon headline-3"
@@ -698,7 +698,7 @@ exports[`component:<InputNumber> renders 1`] = `
698
698
  class="view texts"
699
699
  />
700
700
  <button
701
- class="pressable disabled button rounded squared disabled"
701
+ class="pressable disabled button small rounded squared disabled"
702
702
  disabled=""
703
703
  >
704
704
  <span
@@ -729,7 +729,7 @@ exports[`component:<InputNumber> renders 1`] = `
729
729
  0
730
730
  </span>
731
731
  <button
732
- class="pressable button rounded squared secondary"
732
+ class="pressable button small rounded squared secondary"
733
733
  >
734
734
  <span
735
735
  class="icon headline-3"
@@ -767,7 +767,7 @@ exports[`component:<InputNumber> testId 1`] = `
767
767
  class="view texts"
768
768
  />
769
769
  <button
770
- class="pressable disabled button rounded squared disabled"
770
+ class="pressable disabled button small rounded squared disabled"
771
771
  disabled=""
772
772
  >
773
773
  <span
@@ -798,7 +798,7 @@ exports[`component:<InputNumber> testId 1`] = `
798
798
  0
799
799
  </span>
800
800
  <button
801
- class="pressable button rounded squared secondary"
801
+ class="pressable button small rounded squared secondary"
802
802
  >
803
803
  <span
804
804
  class="icon headline-3"
@@ -65,13 +65,13 @@ var Modal = function Modal(_ref) {
65
65
  dataset = _useState2[0],
66
66
  setDataset = _useState2[1];
67
67
  (0, _react.useEffect)(function () {
68
+ if (!visible || !onClose) return;
68
69
  _dataSources.Event.publish(_Modal.EVENT_VISIBLE, {
69
70
  visible: visible,
70
71
  displayName: displayName
71
72
  });
72
- if (!visible || !onClose) return;
73
73
  var handleKeydown = function handleKeydown(event) {
74
- return event.key === 'Escape' && onClose();
74
+ return event.key === 'Escape' && handleClose();
75
75
  };
76
76
  document.addEventListener('keydown', handleKeydown);
77
77
  return function () {
@@ -94,7 +94,20 @@ var Modal = function Modal(_ref) {
94
94
  var handleOverflow = function handleOverflow(event) {
95
95
  var _ref$current;
96
96
  var target = event.target;
97
- onOverflow && !((_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.contains(target)) && onOverflow(event);
97
+ if (onOverflow && !((_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.contains(target))) {
98
+ _dataSources.Event.publish(_Modal.EVENT_VISIBLE, {
99
+ visible: false,
100
+ displayName: displayName
101
+ });
102
+ onOverflow(event);
103
+ }
104
+ };
105
+ var handleClose = function handleClose(event) {
106
+ _dataSources.Event.publish(_Modal.EVENT_VISIBLE, {
107
+ visible: false,
108
+ displayName: displayName
109
+ });
110
+ onClose(event);
98
111
  };
99
112
  var defaultDirection = _theme.Theme.getDirection() === _theme.DIRECTION_TYPE.LEFT;
100
113
  var renderer = _helpers.IS_JEST || !portal ? function (jsx) {
@@ -134,7 +147,7 @@ var Modal = function Modal(_ref) {
134
147
  small: true,
135
148
  squared: true,
136
149
  transparent: true,
137
- onPress: onClose,
150
+ onPress: handleClose,
138
151
  testId: testId ? "".concat(testId, "-button-close") : undefined,
139
152
  className: _ModalModule.default.button
140
153
  }, /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","names":["Modal","blur","children","displayName","fit","mobileBehavior","overflow","portal","preventDefault","title","visible","onBack","onClose","onOverflow","others","useDevice","isDesktop","isMobile","height","ref","useRef","useState","dataset","setDataset","useEffect","Event","publish","EVENT_VISIBLE","handleKeydown","event","key","document","addEventListener","removeEventListener","body","miraiModal","undefined","handleOverflow","target","current","contains","defaultDirection","Theme","getDirection","DIRECTION_TYPE","LEFT","renderer","IS_JEST","jsx","ReactDOM","createPortal","testId","role","styles","style","container","modal","calcWidth","className","header","reverse","hideBack","hideClose","ICON","icon","button","CLOSE","EXPAND_MORE","React","Children","map","child","index","cloneElement","props","propTypes","PropTypes","bool","node","string","func"],"sources":["../../../src/components/Modal/Modal.jsx"],"sourcesContent":["import { Event } from '@mirai/data-sources';\nimport PropTypes from 'prop-types';\nimport React, { useEffect, useRef, useState } from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { Button } from '../../components';\nimport { IS_JEST, styles } from '../../helpers';\nimport { useDevice } from '../../hooks';\nimport { Icon, ICON, Pressable, Text, View } from '../../primitives';\nimport { DIRECTION_TYPE, Theme } from '../../theme';\nimport { EVENT_VISIBLE } from './Modal.constants';\nimport style from './Modal.module.css';\n\nconst Modal = ({\n blur = false,\n children,\n displayName,\n fit = false,\n mobileBehavior = false,\n overflow = true,\n portal = false,\n preventDefault = true,\n title,\n visible,\n onBack,\n onClose,\n onOverflow,\n ...others\n}) => {\n const { isDesktop, isMobile, height } = useDevice();\n const ref = useRef();\n\n const [dataset, setDataset] = useState();\n\n useEffect(() => {\n Event.publish(EVENT_VISIBLE, { visible, displayName });\n if (!visible || !onClose) return;\n\n const handleKeydown = (event) => event.key === 'Escape' && onClose();\n\n document.addEventListener('keydown', handleKeydown);\n return () => document.removeEventListener('keydown', handleKeydown);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [visible]);\n\n useEffect(() => {\n if (visible && !dataset) {\n setDataset(true);\n document.body.dataset.miraiModal = true;\n }\n\n return () => {\n if (visible && dataset) {\n setDataset(undefined);\n delete document.body.dataset.miraiModal;\n }\n };\n }, [dataset, visible]);\n\n const handleOverflow = (event) => {\n const { target } = event;\n onOverflow && !ref.current?.contains(target) && onOverflow(event);\n };\n\n const defaultDirection = Theme.getDirection() === DIRECTION_TYPE.LEFT;\n const renderer = IS_JEST || !portal ? (jsx) => jsx : ReactDOM.createPortal;\n const { testId } = others;\n\n return renderer(\n <Pressable\n preventDefault={preventDefault}\n role={others.role ? `${others.role}-overflow` : 'modal-overflow'}\n onPress={visible && overflow ? handleOverflow : undefined}\n className={styles(\n style.container,\n isDesktop && mobileBehavior && style.mobileBehavior,\n overflow && style.overflow,\n overflow && blur && style.blur,\n visible && style.visible,\n onOverflow && style.onOverflow,\n )}\n style={{ height }}\n testId={testId ? `${testId}-overflow` : undefined}\n >\n <View\n {...others}\n fit\n ref={ref}\n role={others.role || 'modal'}\n className={styles(style.modal, !fit && style.calcWidth, visible && style.visible, others.className)}\n >\n {(title || onBack || onClose) && (\n <View\n row\n className={styles(\n style.header,\n !defaultDirection && style.reverse,\n !onBack && style.hideBack,\n !onClose && style.hideClose,\n )}\n >\n {onBack && (\n <Button small squared transparent onPress={onBack} testId={testId ? `${testId}-button-back` : undefined}>\n <Icon value={ICON.LEFT} className={style.icon} />\n </Button>\n )}\n {title && (\n <Text headline={!isMobile} className={style.title}>\n {title}\n </Text>\n )}\n {onClose && (\n <Button\n small\n squared\n transparent\n onPress={onClose}\n testId={testId ? `${testId}-button-close` : undefined}\n className={style.button}\n >\n <Icon value={isDesktop || title !== undefined ? ICON.CLOSE : ICON.EXPAND_MORE} className={style.icon} />\n </Button>\n )}\n </View>\n )}\n\n {React.Children.map(children, (child, index) =>\n !child || child === null\n ? null\n : React.cloneElement(child, { key: child.key || index, ...child.props, role: 'modal-content' }),\n )}\n </View>\n </Pressable>,\n document.body,\n );\n};\n\nModal.displayName = 'Component:Modal';\n\nModal.propTypes = {\n blur: PropTypes.bool,\n children: PropTypes.node,\n displayName: PropTypes.string,\n fit: PropTypes.bool,\n mobileBehavior: PropTypes.bool,\n overflow: PropTypes.bool,\n portal: PropTypes.bool,\n preventDefault: PropTypes.bool,\n title: PropTypes.string,\n visible: PropTypes.bool,\n onBack: PropTypes.func,\n onClose: PropTypes.func,\n onOverflow: PropTypes.func,\n};\n\nexport { Modal };\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEvC,IAAMA,KAAK,GAAG,SAARA,KAAK,OAeL;EAAA,qBAdJC,IAAI;IAAJA,IAAI,0BAAG,KAAK;IACZC,QAAQ,QAARA,QAAQ;IACRC,WAAW,QAAXA,WAAW;IAAA,gBACXC,GAAG;IAAHA,GAAG,yBAAG,KAAK;IAAA,2BACXC,cAAc;IAAdA,cAAc,oCAAG,KAAK;IAAA,qBACtBC,QAAQ;IAARA,QAAQ,8BAAG,IAAI;IAAA,mBACfC,MAAM;IAANA,MAAM,4BAAG,KAAK;IAAA,2BACdC,cAAc;IAAdA,cAAc,oCAAG,IAAI;IACrBC,KAAK,QAALA,KAAK;IACLC,OAAO,QAAPA,OAAO;IACPC,MAAM,QAANA,MAAM;IACNC,OAAO,QAAPA,OAAO;IACPC,UAAU,QAAVA,UAAU;IACPC,MAAM;EAET,iBAAwC,IAAAC,gBAAS,GAAE;IAA3CC,SAAS,cAATA,SAAS;IAAEC,QAAQ,cAARA,QAAQ;IAAEC,MAAM,cAANA,MAAM;EACnC,IAAMC,GAAG,GAAG,IAAAC,aAAM,GAAE;EAEpB,gBAA8B,IAAAC,eAAQ,GAAE;IAAA;IAAjCC,OAAO;IAAEC,UAAU;EAE1B,IAAAC,gBAAS,EAAC,YAAM;IACdC,kBAAK,CAACC,OAAO,CAACC,oBAAa,EAAE;MAAEjB,OAAO,EAAPA,OAAO;MAAEP,WAAW,EAAXA;IAAY,CAAC,CAAC;IACtD,IAAI,CAACO,OAAO,IAAI,CAACE,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,IAAI;EACpB3E,QAAQ,EAAE0E,kBAAS,CAACE,IAAI;EACxB3E,WAAW,EAAEyE,kBAAS,CAACG,MAAM;EAC7B3E,GAAG,EAAEwE,kBAAS,CAACC,IAAI;EACnBxE,cAAc,EAAEuE,kBAAS,CAACC,IAAI;EAC9BvE,QAAQ,EAAEsE,kBAAS,CAACC,IAAI;EACxBtE,MAAM,EAAEqE,kBAAS,CAACC,IAAI;EACtBrE,cAAc,EAAEoE,kBAAS,CAACC,IAAI;EAC9BpE,KAAK,EAAEmE,kBAAS,CAACG,MAAM;EACvBrE,OAAO,EAAEkE,kBAAS,CAACC,IAAI;EACvBlE,MAAM,EAAEiE,kBAAS,CAACI,IAAI;EACtBpE,OAAO,EAAEgE,kBAAS,CAACI,IAAI;EACvBnE,UAAU,EAAE+D,kBAAS,CAACI;AACxB,CAAC"}
1
+ {"version":3,"file":"Modal.js","names":["Modal","blur","children","displayName","fit","mobileBehavior","overflow","portal","preventDefault","title","visible","onBack","onClose","onOverflow","others","useDevice","isDesktop","isMobile","height","ref","useRef","useState","dataset","setDataset","useEffect","Event","publish","EVENT_VISIBLE","handleKeydown","event","key","handleClose","document","addEventListener","removeEventListener","body","miraiModal","undefined","handleOverflow","target","current","contains","defaultDirection","Theme","getDirection","DIRECTION_TYPE","LEFT","renderer","IS_JEST","jsx","ReactDOM","createPortal","testId","role","styles","style","container","modal","calcWidth","className","header","reverse","hideBack","hideClose","ICON","icon","button","CLOSE","EXPAND_MORE","React","Children","map","child","index","cloneElement","props","propTypes","PropTypes","bool","node","string","func"],"sources":["../../../src/components/Modal/Modal.jsx"],"sourcesContent":["import { Event } from '@mirai/data-sources';\nimport PropTypes from 'prop-types';\nimport React, { useEffect, useRef, useState } from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { Button } from '../../components';\nimport { IS_JEST, styles } from '../../helpers';\nimport { useDevice } from '../../hooks';\nimport { Icon, ICON, Pressable, Text, View } from '../../primitives';\nimport { DIRECTION_TYPE, Theme } from '../../theme';\nimport { EVENT_VISIBLE } from './Modal.constants';\nimport style from './Modal.module.css';\n\nconst Modal = ({\n blur = false,\n children,\n displayName,\n fit = false,\n mobileBehavior = false,\n overflow = true,\n portal = false,\n preventDefault = true,\n title,\n visible,\n onBack,\n onClose,\n onOverflow,\n ...others\n}) => {\n const { isDesktop, isMobile, height } = useDevice();\n const ref = useRef();\n\n const [dataset, setDataset] = useState();\n\n useEffect(() => {\n if (!visible || !onClose) return;\n Event.publish(EVENT_VISIBLE, { visible, displayName });\n\n const handleKeydown = (event) => event.key === 'Escape' && handleClose();\n\n document.addEventListener('keydown', handleKeydown);\n return () => document.removeEventListener('keydown', handleKeydown);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [visible]);\n\n useEffect(() => {\n if (visible && !dataset) {\n setDataset(true);\n document.body.dataset.miraiModal = true;\n }\n\n return () => {\n if (visible && dataset) {\n setDataset(undefined);\n delete document.body.dataset.miraiModal;\n }\n };\n }, [dataset, visible]);\n\n const handleOverflow = (event) => {\n const { target } = event;\n\n if (onOverflow && !ref.current?.contains(target)) {\n Event.publish(EVENT_VISIBLE, { visible: false, displayName });\n onOverflow(event);\n }\n };\n\n const handleClose = (event) => {\n Event.publish(EVENT_VISIBLE, { visible: false, displayName });\n onClose(event);\n };\n\n const defaultDirection = Theme.getDirection() === DIRECTION_TYPE.LEFT;\n const renderer = IS_JEST || !portal ? (jsx) => jsx : ReactDOM.createPortal;\n const { testId } = others;\n\n return renderer(\n <Pressable\n preventDefault={preventDefault}\n role={others.role ? `${others.role}-overflow` : 'modal-overflow'}\n onPress={visible && overflow ? handleOverflow : undefined}\n className={styles(\n style.container,\n isDesktop && mobileBehavior && style.mobileBehavior,\n overflow && style.overflow,\n overflow && blur && style.blur,\n visible && style.visible,\n onOverflow && style.onOverflow,\n )}\n style={{ height }}\n testId={testId ? `${testId}-overflow` : undefined}\n >\n <View\n {...others}\n fit\n ref={ref}\n role={others.role || 'modal'}\n className={styles(style.modal, !fit && style.calcWidth, visible && style.visible, others.className)}\n >\n {(title || onBack || onClose) && (\n <View\n row\n className={styles(\n style.header,\n !defaultDirection && style.reverse,\n !onBack && style.hideBack,\n !onClose && style.hideClose,\n )}\n >\n {onBack && (\n <Button small squared transparent onPress={onBack} testId={testId ? `${testId}-button-back` : undefined}>\n <Icon value={ICON.LEFT} className={style.icon} />\n </Button>\n )}\n {title && (\n <Text headline={!isMobile} className={style.title}>\n {title}\n </Text>\n )}\n {onClose && (\n <Button\n small\n squared\n transparent\n onPress={handleClose}\n testId={testId ? `${testId}-button-close` : undefined}\n className={style.button}\n >\n <Icon value={isDesktop || title !== undefined ? ICON.CLOSE : ICON.EXPAND_MORE} className={style.icon} />\n </Button>\n )}\n </View>\n )}\n\n {React.Children.map(children, (child, index) =>\n !child || child === null\n ? null\n : React.cloneElement(child, { key: child.key || index, ...child.props, role: 'modal-content' }),\n )}\n </View>\n </Pressable>,\n document.body,\n );\n};\n\nModal.displayName = 'Component:Modal';\n\nModal.propTypes = {\n blur: PropTypes.bool,\n children: PropTypes.node,\n displayName: PropTypes.string,\n fit: PropTypes.bool,\n mobileBehavior: PropTypes.bool,\n overflow: PropTypes.bool,\n portal: PropTypes.bool,\n preventDefault: PropTypes.bool,\n title: PropTypes.string,\n visible: PropTypes.bool,\n onBack: PropTypes.func,\n onClose: PropTypes.func,\n onOverflow: PropTypes.func,\n};\n\nexport { Modal };\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEvC,IAAMA,KAAK,GAAG,SAARA,KAAK,OAeL;EAAA,qBAdJC,IAAI;IAAJA,IAAI,0BAAG,KAAK;IACZC,QAAQ,QAARA,QAAQ;IACRC,WAAW,QAAXA,WAAW;IAAA,gBACXC,GAAG;IAAHA,GAAG,yBAAG,KAAK;IA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AACC,IAAI;EAC9BxE,QAAQ,EAAEuE,kBAAS,CAACC,IAAI;EACxBvE,MAAM,EAAEsE,kBAAS,CAACC,IAAI;EACtBtE,cAAc,EAAEqE,kBAAS,CAACC,IAAI;EAC9BrE,KAAK,EAAEoE,kBAAS,CAACG,MAAM;EACvBtE,OAAO,EAAEmE,kBAAS,CAACC,IAAI;EACvBnE,MAAM,EAAEkE,kBAAS,CAACI,IAAI;EACtBrE,OAAO,EAAEiE,kBAAS,CAACI,IAAI;EACvBpE,UAAU,EAAEgE,kBAAS,CAACI;AACxB,CAAC"}
@@ -11,12 +11,12 @@
11
11
  border-radius: 50%;
12
12
  box-shadow: var(--mirai-ui-modal-shadow);
13
13
  display: flex;
14
- height: var(--mirai-ui-button-squared);
14
+ height: var(--mirai-ui-button-small-height);
15
15
  justify-content: center;
16
16
  position: absolute;
17
- top: calc(50% - calc(var(--mirai-ui-button-squared) / 2));
17
+ top: calc(50% - calc(var(--mirai-ui-button-small-height) / 2));
18
18
  transition: transform var(--mirai-ui-motion-collapse) var(--mirai-ui-motion-easing);
19
- width: var(--mirai-ui-button-squared);
19
+ width: var(--mirai-ui-button-small-height);
20
20
  z-index: var(--mirai-ui-layer-M);
21
21
  }
22
22
 
@@ -11,7 +11,7 @@ var _helpers = require("../../helpers");
11
11
  var _Primitive = require("../Primitive");
12
12
  var _helpers2 = require("./helpers");
13
13
  var _InputModule = _interopRequireDefault(require("./Input.module.css"));
14
- var _excluded = ["autoResize", "disabled", "max", "min", "multiLine", "type", "onChange", "onEnter", "onError", "onLeave"];
14
+ var _excluded = ["autoResize", "disabled", "multiLine", "type", "onChange", "onEnter", "onError", "onLeave"];
15
15
  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); }
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -31,10 +31,6 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
31
31
  var Input = function Input(_ref) {
32
32
  var autoResize = _ref.autoResize,
33
33
  disabled = _ref.disabled,
34
- _ref$max = _ref.max,
35
- max = _ref$max === void 0 ? 0 : _ref$max,
36
- _ref$min = _ref.min,
37
- min = _ref$min === void 0 ? 0 : _ref$min,
38
34
  multiLine = _ref.multiLine,
39
35
  _ref$type = _ref.type,
40
36
  type = _ref$type === void 0 ? 'text' : _ref$type,
@@ -62,6 +58,8 @@ var Input = function Input(_ref) {
62
58
  var handleChange = function handleChange() {
63
59
  var next = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
64
60
  var event = arguments.length > 1 ? arguments[1] : undefined;
61
+ var max = others.max,
62
+ min = others.min;
65
63
  if (type === 'number' && isNaN(next)) return;
66
64
  var value = (0, _helpers2.parseValue)(next, type, others);
67
65
  onError && onError((0, _helpers.getInputErrors)(_objectSpread(_objectSpread({}, others), {}, {
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","names":["Input","autoResize","disabled","max","min","multiLine","type","onChange","onEnter","onError","onLeave","others","ref","useRef","useState","height","setHeight","useEffect","errors","getInputErrors","current","clientHeight","resize","value","handleChange","next","event","isNaN","parseValue","undefined","Math","style","scrollHeight","React","createElement","Primitive","role","tag","test","target","onFocus","onBlur","className","styles","input","displayName","propTypes","PropTypes","bool","number","name","string","isRequired","func"],"sources":["../../../src/primitives/Input/Input.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useEffect, useRef, useState } from 'react';\n\nimport { getInputErrors, styles } from '../../helpers';\nimport { Primitive } from '../Primitive';\nimport { parseValue } from './helpers';\nimport style from './Input.module.css';\n\nconst Input = ({\n autoResize,\n disabled,\n max = 0,\n min = 0,\n multiLine,\n type = 'text',\n onChange,\n onEnter,\n onError,\n onLeave,\n ...others\n}) => {\n const ref = useRef(null);\n\n const [height, setHeight] = useState();\n\n useEffect(() => {\n const errors = getInputErrors({ ...others, type });\n if (errors && onError) onError(errors);\n\n if (autoResize && multiLine) {\n setHeight(ref.current.clientHeight);\n resize(others.value);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleChange = (next = '', event) => {\n if (type === 'number' && isNaN(next)) return;\n const value = parseValue(next, type, others);\n\n onError && onError(getInputErrors({ ...others, type, value }));\n onChange &&\n onChange(\n value !== undefined\n ? type === 'number' && (max || min)\n ? Math.min(Math.max(value, min ? min : value), max ? max : value)\n : value\n : '',\n event,\n );\n if (autoResize && multiLine) resize(value);\n };\n\n const resize = (value) => {\n if (!ref?.current) return;\n ref.current.style.height = `${value ? ref.current.scrollHeight : height}px`;\n };\n\n return React.createElement(Primitive, {\n ...others,\n disabled,\n ref: autoResize ? ref : undefined,\n role: others.role || 'input',\n tag: multiLine ? 'textarea' : 'input',\n test: undefined,\n type: !multiLine ? type : undefined,\n value: others.value !== undefined ? others.value : '',\n ...(!disabled\n ? {\n onChange: (event) => handleChange(event.target.value, event),\n onFocus: onEnter,\n onBlur: onLeave,\n }\n : {}),\n className: styles(style.input, autoResize && multiLine && style.autoResize, others.className),\n });\n};\n\nInput.displayName = 'Primitive:Input';\n\nInput.propTypes = {\n autoResize: PropTypes.bool,\n disabled: PropTypes.bool,\n max: PropTypes.number,\n min: PropTypes.number,\n multiLine: PropTypes.bool,\n name: PropTypes.string.isRequired,\n type: PropTypes.string,\n onChange: PropTypes.func,\n onEnter: PropTypes.func,\n onError: PropTypes.func,\n onLeave: PropTypes.func,\n};\n\nexport { Input };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AACA;AAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEvC,IAAMA,KAAK,GAAG,SAARA,KAAK,OAYL;EAAA,IAXJC,UAAU,QAAVA,UAAU;IACVC,QAAQ,QAARA,QAAQ;IAAA,gBACRC,GAAG;IAAHA,GAAG,yBAAG,CAAC;IAAA,gBACPC,GAAG;IAAHA,GAAG,yBAAG,CAAC;IACPC,SAAS,QAATA,SAAS;IAAA,iBACTC,IAAI;IAAJA,IAAI,0BAAG,MAAM;IACbC,QAAQ,QAARA,QAAQ;IACRC,OAAO,QAAPA,OAAO;IACPC,OAAO,QAAPA,OAAO;IACPC,OAAO,QAAPA,OAAO;IACJC,MAAM;EAET,IAAMC,GAAG,GAAG,IAAAC,aAAM,EAAC,IAAI,CAAC;EAExB,gBAA4B,IAAAC,eAAQ,GAAE;IAAA;IAA/BC,MAAM;IAAEC,SAAS;EAExB,IAAAC,gBAAS,EAAC,YAAM;IACd,IAAMC,MAAM,GAAG,IAAAC,uBAAc,kCAAMR,MAAM;MAAEL,IAAI,EAAJA;IAAI,GAAG;IAClD,IAAIY,MAAM,IAAIT,OAAO,EAAEA,OAAO,CAACS,MAAM,CAAC;IAEtC,IAAIjB,UAAU,IAAII,SAAS,EAAE;MAC3BW,SAAS,CAACJ,GAAG,CAACQ,OAAO,CAACC,YAAY,CAAC;MACnCC,MAAM,CAACX,MAAM,CAACY,KAAK,CAAC;IACtB;IACA;EACF,CAAC,EAAE,EAAE,CAAC;EAEN,IAAMC,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Line","type","onChange","onEnter","onError","onLeave","others","ref","useRef","useState","height","setHeight","useEffect","errors","getInputErrors","current","clientHeight","resize","value","handleChange","next","event","max","min","isNaN","parseValue","undefined","Math","style","scrollHeight","React","createElement","Primitive","role","tag","test","target","onFocus","onBlur","className","styles","input","displayName","propTypes","PropTypes","bool","number","name","string","isRequired","func"],"sources":["../../../src/primitives/Input/Input.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useEffect, useRef, useState } from 'react';\n\nimport { getInputErrors, styles } from '../../helpers';\nimport { Primitive } from '../Primitive';\nimport { parseValue } from './helpers';\nimport style from './Input.module.css';\n\nconst Input = ({ autoResize, disabled, multiLine, type = 'text', onChange, onEnter, onError, onLeave, ...others }) => {\n const ref = useRef(null);\n\n const [height, setHeight] = useState();\n\n useEffect(() => {\n const errors = getInputErrors({ ...others, type });\n if (errors && onError) onError(errors);\n\n if (autoResize && multiLine) {\n setHeight(ref.current.clientHeight);\n resize(others.value);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleChange = (next = '', event) => {\n const { max, min } = others;\n if (type === 'number' && isNaN(next)) return;\n const value = parseValue(next, type, others);\n\n onError && onError(getInputErrors({ ...others, type, value }));\n onChange &&\n onChange(\n value !== undefined\n ? type === 'number' && (max || min)\n ? Math.min(Math.max(value, min ? min : value), max ? max : value)\n : value\n : '',\n event,\n );\n if (autoResize && multiLine) resize(value);\n };\n\n const resize = (value) => {\n if (!ref?.current) return;\n ref.current.style.height = `${value ? ref.current.scrollHeight : height}px`;\n };\n\n return React.createElement(Primitive, {\n ...others,\n disabled,\n ref: autoResize ? ref : undefined,\n role: others.role || 'input',\n tag: multiLine ? 'textarea' : 'input',\n test: undefined,\n type: !multiLine ? type : undefined,\n value: others.value !== undefined ? others.value : '',\n ...(!disabled\n ? {\n onChange: (event) => handleChange(event.target.value, event),\n onFocus: onEnter,\n onBlur: onLeave,\n }\n : {}),\n className: styles(style.input, autoResize && multiLine && style.autoResize, others.className),\n });\n};\n\nInput.displayName = 'Primitive:Input';\n\nInput.propTypes = {\n autoResize: PropTypes.bool,\n disabled: PropTypes.bool,\n max: PropTypes.number,\n min: PropTypes.number,\n multiLine: PropTypes.bool,\n name: PropTypes.string.isRequired,\n type: PropTypes.string,\n onChange: PropTypes.func,\n onEnter: PropTypes.func,\n onError: PropTypes.func,\n onLeave: PropTypes.func,\n};\n\nexport { Input };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AACA;AAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEvC,IAAMA,KAAK,GAAG,SAARA,KAAK,OAA2G;EAAA,IAArGC,UAAU,QAAVA,UAAU;IAAEC,QAAQ,QAARA,QAAQ;IAAEC,SAAS,QAATA,SAAS;IAAA,iBAAEC,IAAI;IAAJA,IAAI,0BAAG,MAAM;IAAEC,QAAQ,QAARA,QAAQ;IAAEC,OAAO,QAAPA,OAAO;IAAEC,OAAO,QAAPA,OAAO;IAAEC,OAAO,QAAPA,OAAO;IAAKC,MAAM;EAC7G,IAAMC,GAAG,GAAG,IAAAC,aAAM,EAAC,IAAI,CAAC;EAExB,gBAA4B,IAAAC,eAAQ,GAAE;IAAA;IAA/BC,MAAM;IAAEC,SAAS;EAExB,IAAAC,gBAAS,EAAC,YAAM;IACd,IAAMC,MAAM,GAAG,IAAAC,uBAAc,kCAAMR,MAAM;MAAEL,IAAI,EAAJA;IAAI,GAAG;IAClD,IAAIY,MAAM,IAAIT,OAAO,EAAEA,OAAO,CAACS,MAAM,CAAC;IAEtC,IAAIf,UAAU,IAAIE,SAAS,EAAE;MAC3BW,SAAS,CAACJ,GAAG,CAACQ,OAAO,CAACC,YAAY,CAAC;MACnCC,MAAM,CAACX,MAAM,CAACY,KAAK,CAAC;IACtB;IACA;EACF,CAAC,EAAE,EAAE,CAAC;EAEN,IAAMC,YAAY,GAAG,SAAfA,YAAY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M;AACrB,CAAC"}
@@ -38,6 +38,7 @@ exports[`primitive:<Input> prop:max 1`] = `
38
38
  <DocumentFragment>
39
39
  <input
40
40
  class="input"
41
+ max="100"
41
42
  name="name"
42
43
  type="number"
43
44
  value=""
@@ -49,6 +50,7 @@ exports[`primitive:<Input> prop:min 1`] = `
49
50
  <DocumentFragment>
50
51
  <input
51
52
  class="input"
53
+ min="1"
52
54
  name="name"
53
55
  type="number"
54
56
  value=""
@@ -3,6 +3,8 @@
3
3
  --mirai-ui-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,
4
4
  'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
5
5
  --mirai-ui-font-weight: 400;
6
+ --mirai-ui-font-medium: var(--mirai-ui-font);
7
+ --mirai-ui-font-medium-weight: 500;
6
8
  --mirai-ui-font-bold: var(--mirai-ui-font);
7
9
  --mirai-ui-font-bold-weight: 700;
8
10
 
@@ -87,11 +89,12 @@
87
89
  --mirai-ui-input-min-height: var(--mirai-ui-space-XL);
88
90
 
89
91
  /* border */
90
- --mirai-ui-border-radius: 4px;
92
+ --mirai-ui-border-radius: var(--mirai-ui-space-XXS);
91
93
  --mirai-ui-border-width: 1px;
92
94
 
93
95
  /* shadow */
94
96
  --mirai-ui-shadow: 0 0 var(--mirai-ui-space-S) rgba(0, 0, 0, 0.1);
97
+ --mirai-ui-shadow: 0 0 var(--mirai-ui-space-S) rgba(0, 0, 0, 0.15);
95
98
 
96
99
  /* focus */
97
100
  --mirai-ui-focus-color: var(--mirai-ui-accent-dark);
@@ -172,7 +175,7 @@
172
175
  /* Action */
173
176
  --mirai-ui-action-color: var(--mirai-ui-accent);
174
177
  --mirai-ui-action-color-disabled: var(--mirai-ui-content-light);
175
- --mirai-ui-action-font-weight: var(--mirai-ui-font-weight);
178
+ --mirai-ui-action-font-weight: var(--mirai-ui-font-medium-weight);
176
179
 
177
180
  /* Button */
178
181
  --mirai-ui-button-background: var(--mirai-ui-accent);
@@ -183,16 +186,17 @@
183
186
  --mirai-ui-button-disabled-background: var(--mirai-ui-content-border);
184
187
  --mirai-ui-button-disabled-color: var(--mirai-ui-content-light);
185
188
  --mirai-ui-button-focus-color: var(--mirai-ui-focus-color);
186
- --mirai-ui-button-focus-color-shadow: var(--mirai-ui-focus-color-shadow);
187
- --mirai-ui-button-font-weight: var(--mirai-ui-font-weight);
189
+ --mirai-ui-button-font-weight: var(--mirai-ui-font-medium-weight);
188
190
  --mirai-ui-button-padding-x: var(--mirai-ui-space-L);
189
- --mirai-ui-button-padding-y: var(--mirai-ui-space-S);
191
+ --mirai-ui-button-height: calc(var(--mirai-ui-space-XL) - var(--mirai-ui-space-XXS));
192
+ --mirai-ui-button-large-height: var(--mirai-ui-space-XL);
193
+ --mirai-ui-button-small-height: calc(var(--mirai-ui-space-XL) - var(--mirai-ui-space-M));
190
194
  --mirai-ui-button-radius: var(--mirai-ui-border-radius);
191
195
  --mirai-ui-button-secondary-background: var(--mirai-ui-base);
196
+ --mirai-ui-button-secondary-background-active: var(--mirai-ui-accent-background);
192
197
  --mirai-ui-button-secondary-color: var(--mirai-ui-button-background);
193
198
  --mirai-ui-button-secondary-focus-color: var(--mirai-ui-button-focus-color);
194
199
  --mirai-ui-button-secondary-focus-color-shadow: var(--mirai-ui-focus-color-shadow);
195
- --mirai-ui-button-squared: calc(var(--mirai-ui-space-M) * 2);
196
200
  --mirai-ui-button-transparent-background-active: var(--mirai-ui-accent-background);
197
201
  --mirai-ui-button-transparent-color: var(--mirai-ui-content);
198
202
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirai/ui",
3
- "version": "1.1.14",
3
+ "version": "1.1.16",
4
4
  "repository": "git@gitlab.com:miraicorp/dev/frontend/ui.git",
5
5
  "author": "JΛVI <hello@soyjavi.com>",
6
6
  "license": "MIT",