@mirai/ui 1.0.146 → 1.0.151
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 +1 -0
- package/build/components/Action/Action.js +5 -3
- package/build/components/Action/Action.js.map +1 -1
- package/build/components/Action/Action.module.css +5 -0
- package/build/components/Action/__tests__/__snapshots__/Action.test.js.snap +10 -0
- package/build/components/Button/Button.module.css +9 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -328,6 +328,7 @@ React components assembled with primitives.
|
|
|
328
328
|
|
|
329
329
|
A hyperlink component that receives the following props:
|
|
330
330
|
|
|
331
|
+
- `bold:boolean` modifying font-weight
|
|
331
332
|
- `children:node|string`
|
|
332
333
|
- `disabled:boolean` applying 'disabled' attribute
|
|
333
334
|
- `href:string` applying 'href' attribute & force `a` tag
|
|
@@ -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 = ["children", "disabled", "href", "inline", "large", "small", "tag", "target", "underline", "wide", "onPress"];
|
|
13
|
+
var _excluded = ["bold", "children", "disabled", "href", "inline", "large", "small", "tag", "target", "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; }
|
|
@@ -20,7 +20,8 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
20
20
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
21
21
|
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; }
|
|
22
22
|
var Action = function Action(_ref) {
|
|
23
|
-
var
|
|
23
|
+
var bold = _ref.bold,
|
|
24
|
+
children = _ref.children,
|
|
24
25
|
disabled = _ref.disabled,
|
|
25
26
|
href = _ref.href,
|
|
26
27
|
inline = _ref.inline,
|
|
@@ -37,7 +38,7 @@ var Action = function Action(_ref) {
|
|
|
37
38
|
disabled: disabled,
|
|
38
39
|
href: href,
|
|
39
40
|
tag: href ? 'a' : tag,
|
|
40
|
-
className: (0, _helpers.styles)(_ActionModule.default.action, 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),
|
|
41
|
+
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),
|
|
41
42
|
onPress: function onPress(event) {
|
|
42
43
|
_onPress && _onPress(event);
|
|
43
44
|
if (href && target) window.open(href, target);else if (href) window.location = href;
|
|
@@ -47,6 +48,7 @@ var Action = function Action(_ref) {
|
|
|
47
48
|
exports.Action = Action;
|
|
48
49
|
Action.displayName = 'Component:Action';
|
|
49
50
|
Action.propTypes = {
|
|
51
|
+
bold: _propTypes.default.bool,
|
|
50
52
|
children: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
51
53
|
disabled: _propTypes.default.bool,
|
|
52
54
|
href: _propTypes.default.string,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Action.js","names":["Action","children","disabled","href","inline","large","small","tag","target","underline","wide","onPress","others","React","createElement","Pressable","className","styles","style","action","event","window","open","location","displayName","propTypes","PropTypes","oneOfType","string","node","
|
|
1
|
+
{"version":3,"file":"Action.js","names":["Action","bold","children","disabled","href","inline","large","small","tag","target","underline","wide","onPress","others","React","createElement","Pressable","className","styles","style","action","event","window","open","location","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 tag: href ? 'a' : tag,\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 onPress: (event) => {\n onPress && onPress(event);\n if (href && target) window.open(href, target);\n else if (href) window.location = href;\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;IACJI,GAAG,EAAEJ,IAAI,GAAG,GAAG,GAAGI,GAAG;IACrBS,SAAS,EAAE,IAAAC,eAAM,EACfC,qBAAK,CAACC,MAAM,EACZnB,IAAI,IAAIkB,qBAAK,CAAClB,IAAI,EAClBE,QAAQ,IAAIgB,qBAAK,CAAChB,QAAQ,EAC1BE,MAAM,IAAIc,qBAAK,CAACd,MAAM,EACtBC,KAAK,IAAIa,qBAAK,CAACb,KAAK,EACpBC,KAAK,IAAIY,qBAAK,CAACZ,KAAK,EACpBG,SAAS,IAAIS,qBAAK,CAACT,SAAS,EAC5BC,IAAI,IAAIQ,qBAAK,CAACR,IAAI,EAClBE,MAAM,CAACI,SAAS,CACjB;IACDL,OAAO,EAAE,iBAACS,KAAK,EAAK;MAClBT,QAAO,IAAIA,QAAO,CAACS,KAAK,CAAC;MACzB,IAAIjB,IAAI,IAAIK,MAAM,EAAEa,MAAM,CAACC,IAAI,CAACnB,IAAI,EAAEK,MAAM,CAAC,CAAC,KACzC,IAAIL,IAAI,EAAEkB,MAAM,CAACE,QAAQ,GAAGpB,IAAI;IACvC;EAAC,IAEHF,QAAQ,CACT;AAAA;AAAC;AAEJF,MAAM,CAACyB,WAAW,GAAG,kBAAkB;AAEvCzB,MAAM,CAAC0B,SAAS,GAAG;EACjBzB,IAAI,EAAE0B,kBAAS,CAACC,IAAI;EACpB1B,QAAQ,EAAEyB,kBAAS,CAACE,SAAS,CAAC,CAACF,kBAAS,CAACG,MAAM,EAAEH,kBAAS,CAACI,IAAI,CAAC,CAAC;EACjE5B,QAAQ,EAAEwB,kBAAS,CAACC,IAAI;EACxBxB,IAAI,EAAEuB,kBAAS,CAACG,MAAM;EACtBzB,MAAM,EAAEsB,kBAAS,CAACC,IAAI;EACtBtB,KAAK,EAAEqB,kBAAS,CAACC,IAAI;EACrBrB,KAAK,EAAEoB,kBAAS,CAACC,IAAI;EACrBpB,GAAG,EAAEmB,kBAAS,CAACG,MAAM;EACrBrB,MAAM,EAAEkB,kBAAS,CAACG,MAAM;EACxBpB,SAAS,EAAEiB,kBAAS,CAACC,IAAI;EACzBjB,IAAI,EAAEgB,kBAAS,CAACC,IAAI;EACpBI,OAAO,EAAEL,kBAAS,CAACM,IAAI;EACvBC,OAAO,EAAEP,kBAAS,CAACM,IAAI;EACvBrB,OAAO,EAAEe,kBAAS,CAACM;AACrB,CAAC"}
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
color: var(--mirai-ui-content);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
.action.bold {
|
|
18
|
+
font-family: var(--mirai-ui-font-bold);
|
|
19
|
+
font-weight: var(--mirai-ui-font-bold-weight);
|
|
20
|
+
}
|
|
21
|
+
|
|
17
22
|
.action.disabled,
|
|
18
23
|
.action.disabled * {
|
|
19
24
|
color: var(--mirai-ui-action-color-disabled);
|
|
@@ -10,6 +10,16 @@ exports[`component:<Action> inherit:className 1`] = `
|
|
|
10
10
|
</DocumentFragment>
|
|
11
11
|
`;
|
|
12
12
|
|
|
13
|
+
exports[`component:<Action> prop:bold 1`] = `
|
|
14
|
+
<DocumentFragment>
|
|
15
|
+
<button
|
|
16
|
+
class="pressable action bold"
|
|
17
|
+
>
|
|
18
|
+
children
|
|
19
|
+
</button>
|
|
20
|
+
</DocumentFragment>
|
|
21
|
+
`;
|
|
22
|
+
|
|
13
23
|
exports[`component:<Action> prop:disabled 1`] = `
|
|
14
24
|
<DocumentFragment>
|
|
15
25
|
<button
|
|
@@ -94,6 +94,15 @@ button.button.busy .spinner {
|
|
|
94
94
|
transform: translateY(0%);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
.button:not(:disabled).secondary:hover:not(:active) {
|
|
98
|
+
box-shadow: inset 0 0 0 var(--mirai-ui-border-width) var(--mirai-ui-button-color-hover);
|
|
99
|
+
color: var(--mirai-ui-button-color-focus);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.button:not(:disabled):not(.secondary):hover {
|
|
103
|
+
background-color: var(--mirai-ui-button-color-hover);
|
|
104
|
+
}
|
|
105
|
+
|
|
97
106
|
.busyContainer {
|
|
98
107
|
align-items: center;
|
|
99
108
|
justify-content: center;
|
|
@@ -180,13 +189,3 @@ button.button.busy .spinner {
|
|
|
180
189
|
left: calc(var(--mirai-ui-space-S) * 0.75);
|
|
181
190
|
}
|
|
182
191
|
|
|
183
|
-
@media only screen and (min-width: 600px) {
|
|
184
|
-
.button:not(:disabled).secondary:hover:not(:active) {
|
|
185
|
-
box-shadow: inset 0 0 0 var(--mirai-ui-border-width) var(--mirai-ui-button-color-hover);
|
|
186
|
-
color: var(--mirai-ui-button-color-focus);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.button:not(:disabled):not(.secondary):hover {
|
|
190
|
-
background-color: var(--mirai-ui-button-color-hover);
|
|
191
|
-
}
|
|
192
|
-
}
|