@mirai/ui 1.0.80 → 1.0.81-beta
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 +8 -1
- package/build/components/Action/__tests__/__snapshots__/Action.test.js.snap +1 -1
- package/build/components/Button/__tests__/__snapshots__/Button.test.js.snap +3 -3
- package/build/components/Calendar/Calendar.Month.js +1 -0
- package/build/components/Calendar/Calendar.Month.js.map +1 -1
- package/build/components/Calendar/Calendar.Week.js +21 -4
- package/build/components/Calendar/Calendar.Week.js.map +1 -1
- package/build/components/Calendar/Calendar.js +11 -3
- package/build/components/Calendar/Calendar.js.map +1 -1
- package/build/components/Calendar/Calendar.module.css +4 -2
- package/build/components/Calendar/Calendar.stories.js +77 -23
- package/build/components/Calendar/Calendar.stories.js.map +1 -1
- package/build/components/Calendar/__tests__/__snapshots__/Calendar.test.jsx.snap +2650 -2650
- package/build/components/InputNumber/__tests__/__snapshots__/InputNumber.test.js.snap +9 -9
- package/build/components/Tooltip/Tooltip.js +27 -7
- package/build/components/Tooltip/Tooltip.js.map +1 -1
- package/build/components/Tooltip/Tooltip.module.css +32 -0
- package/build/components/Tooltip/Tooltip.stories.js +62 -35
- package/build/components/Tooltip/Tooltip.stories.js.map +1 -1
- package/build/components/Tooltip/__tests__/__snapshots__/Tooltip.test.jsx.snap +79 -22
- package/build/primitives/Layer/Layer.js +9 -3
- package/build/primitives/Layer/Layer.js.map +1 -1
- package/build/primitives/Layer/helpers/getLayerPosition.js +43 -5
- package/build/primitives/Layer/helpers/getLayerPosition.js.map +1 -1
- package/build/primitives/Pressable/Pressable.js +1 -1
- package/build/primitives/Pressable/Pressable.js.map +1 -1
- package/build/primitives/Pressable/Pressable.module.css +1 -0
- package/build/primitives/Pressable/__tests__/__snapshots__/Pressable.test.js.snap +1 -1
- package/build/theme/theme.stories.js +60 -0
- package/build/theme/theme.stories.js.map +1 -1
- package/package.json +2 -2
|
@@ -4,6 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getLayerPosition = void 0;
|
|
7
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
13
|
var getLayerPosition = function getLayerPosition() {
|
|
8
14
|
var componentLayout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9
15
|
var contentLayout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -30,23 +36,55 @@ var getLayerPosition = function getLayerPosition() {
|
|
|
30
36
|
height = _device$height === void 0 ? 0 : _device$height,
|
|
31
37
|
_device$width = device.width,
|
|
32
38
|
width = _device$width === void 0 ? 0 : _device$width;
|
|
39
|
+
var orientation = {
|
|
40
|
+
left: true
|
|
41
|
+
};
|
|
33
42
|
var top = componentTop + componentHeight;
|
|
34
43
|
var gapTop = componentTop;
|
|
35
44
|
var gapBottom = height - top;
|
|
36
|
-
if (contentHeight > gapBottom && gapTop > gapBottom && !forceBottom || forceTop)
|
|
45
|
+
if (contentHeight > gapBottom && gapTop > gapBottom && !forceBottom || forceTop) {
|
|
46
|
+
top = componentTop - contentHeight;
|
|
47
|
+
orientation = _objectSpread(_objectSpread({}, orientation), {}, {
|
|
48
|
+
top: true
|
|
49
|
+
});
|
|
50
|
+
}
|
|
37
51
|
var left = componentLeft;
|
|
38
52
|
var gapLeft = componentLeft + componentWidth;
|
|
39
53
|
var gapRight = width - componentLeft;
|
|
40
|
-
if (contentWidth > gapRight && gapLeft > gapRight && !forceLeft || forceRight)
|
|
54
|
+
if (contentWidth > gapRight && gapLeft > gapRight && !forceLeft || forceRight) {
|
|
55
|
+
left = componentLeft - contentWidth + componentWidth;
|
|
56
|
+
orientation = _objectSpread(_objectSpread({}, orientation), {}, {
|
|
57
|
+
left: undefined,
|
|
58
|
+
right: true
|
|
59
|
+
});
|
|
60
|
+
}
|
|
41
61
|
if (centered) {
|
|
42
62
|
var gapCenter = (componentWidth + contentWidth) / 2;
|
|
43
63
|
var space = (contentWidth - componentWidth) / 2;
|
|
44
|
-
|
|
45
|
-
|
|
64
|
+
orientation = _objectSpread(_objectSpread({}, orientation), {}, {
|
|
65
|
+
left: true,
|
|
66
|
+
right: undefined
|
|
67
|
+
});
|
|
68
|
+
if (gapLeft > gapRight) {
|
|
69
|
+
left = componentLeft - contentWidth + componentWidth;
|
|
70
|
+
orientation = _objectSpread(_objectSpread({}, orientation), {}, {
|
|
71
|
+
left: undefined,
|
|
72
|
+
right: true
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (gapLeft > gapCenter && gapRight > gapCenter) {
|
|
76
|
+
left += space * (gapLeft > gapRight ? 1 : -1);
|
|
77
|
+
orientation = _objectSpread(_objectSpread({}, orientation), {}, {
|
|
78
|
+
left: undefined,
|
|
79
|
+
right: undefined,
|
|
80
|
+
center: true
|
|
81
|
+
});
|
|
82
|
+
}
|
|
46
83
|
}
|
|
47
84
|
return {
|
|
48
85
|
left: left,
|
|
49
|
-
top: top
|
|
86
|
+
top: top,
|
|
87
|
+
orientation: orientation
|
|
50
88
|
};
|
|
51
89
|
};
|
|
52
90
|
exports.getLayerPosition = getLayerPosition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLayerPosition.js","names":["getLayerPosition","componentLayout","contentLayout","device","centered","forceBottom","forceLeft","forceRight","forceTop","left","componentLeft","top","componentTop","width","componentWidth","height","componentHeight","contentWidth","contentHeight","gapTop","gapBottom","gapLeft","gapRight","gapCenter","space"],"sources":["../../../../src/primitives/Layer/helpers/getLayerPosition.js"],"sourcesContent":["export const getLayerPosition = (\n componentLayout = {},\n contentLayout = {},\n device = {},\n { centered, forceBottom, forceLeft, forceRight, forceTop } = {},\n) => {\n const {\n left: componentLeft = 0,\n top: componentTop = 0,\n width: componentWidth = 0,\n height: componentHeight = 0,\n } = componentLayout;\n const { width: contentWidth = 0, height: contentHeight = 0 } = contentLayout;\n const { height = 0, width = 0 } = device;\n\n let top = componentTop + componentHeight;\n const gapTop = componentTop;\n const gapBottom = height - top;\n if ((contentHeight > gapBottom && gapTop > gapBottom && !forceBottom) || forceTop) top = componentTop - contentHeight;\n\n let left = componentLeft;\n const gapLeft = componentLeft + componentWidth;\n const gapRight = width - componentLeft;\n\n if ((contentWidth > gapRight && gapLeft > gapRight && !forceLeft) || forceRight)\n left = componentLeft - contentWidth + componentWidth;\n\n if (centered) {\n const gapCenter = (componentWidth + contentWidth) / 2;\n const space = (contentWidth - componentWidth) / 2;\n if (gapLeft > gapRight) left = componentLeft - contentWidth + componentWidth;\n if (gapLeft > gapCenter && gapRight > gapCenter) left += space * (gapLeft > gapRight ? 1 : -1);\n }\n\n return { left, top };\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getLayerPosition.js","names":["getLayerPosition","componentLayout","contentLayout","device","centered","forceBottom","forceLeft","forceRight","forceTop","left","componentLeft","top","componentTop","width","componentWidth","height","componentHeight","contentWidth","contentHeight","orientation","gapTop","gapBottom","gapLeft","gapRight","undefined","right","gapCenter","space","center"],"sources":["../../../../src/primitives/Layer/helpers/getLayerPosition.js"],"sourcesContent":["export const getLayerPosition = (\n componentLayout = {},\n contentLayout = {},\n device = {},\n { centered, forceBottom, forceLeft, forceRight, forceTop } = {},\n) => {\n const {\n left: componentLeft = 0,\n top: componentTop = 0,\n width: componentWidth = 0,\n height: componentHeight = 0,\n } = componentLayout;\n const { width: contentWidth = 0, height: contentHeight = 0 } = contentLayout;\n const { height = 0, width = 0 } = device;\n let orientation = { left: true };\n\n let top = componentTop + componentHeight;\n const gapTop = componentTop;\n const gapBottom = height - top;\n if ((contentHeight > gapBottom && gapTop > gapBottom && !forceBottom) || forceTop) {\n top = componentTop - contentHeight;\n orientation = { ...orientation, top: true };\n }\n\n let left = componentLeft;\n const gapLeft = componentLeft + componentWidth;\n const gapRight = width - componentLeft;\n\n if ((contentWidth > gapRight && gapLeft > gapRight && !forceLeft) || forceRight) {\n left = componentLeft - contentWidth + componentWidth;\n orientation = { ...orientation, left: undefined, right: true };\n }\n\n if (centered) {\n const gapCenter = (componentWidth + contentWidth) / 2;\n const space = (contentWidth - componentWidth) / 2;\n orientation = { ...orientation, left: true, right: undefined };\n\n if (gapLeft > gapRight) {\n left = componentLeft - contentWidth + componentWidth;\n orientation = { ...orientation, left: undefined, right: true };\n }\n if (gapLeft > gapCenter && gapRight > gapCenter) {\n left += space * (gapLeft > gapRight ? 1 : -1);\n orientation = { ...orientation, left: undefined, right: undefined, center: true };\n }\n }\n\n return { left, top, orientation };\n};\n"],"mappings":"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"}
|
|
@@ -33,7 +33,7 @@ var Pressable = function Pressable(_ref) {
|
|
|
33
33
|
others = _objectWithoutProperties(_ref, _excluded);
|
|
34
34
|
return /*#__PURE__*/_react.default.createElement(tag, _objectSpread(_objectSpread({}, others), {}, {
|
|
35
35
|
disabled: disabled,
|
|
36
|
-
className: (0, _helpers.styles)(_PressableModule.default.pressable, others.className)
|
|
36
|
+
className: (0, _helpers.styles)(_PressableModule.default.pressable, disabled && _PressableModule.default.disabled, others.className)
|
|
37
37
|
}, !disabled ? {
|
|
38
38
|
onClick: function onClick(event) {
|
|
39
39
|
if (preventDefault) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pressable.js","names":["Pressable","children","disabled","preventDefault","tag","onEnter","onLeave","onPress","others","React","createElement","className","styles","style","pressable","onClick","event","stopPropagation","onKeyPress","keyCode","KEY_ENTER","onMouseEnter","onMouseLeave","displayName","propTypes","PropTypes","oneOfType","string","node","bool","func"],"sources":["../../../src/primitives/Pressable/Pressable.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { KEY_ENTER } from './Pressable.constants';\nimport style from './Pressable.module.css';\n\nconst Pressable = ({\n children,\n disabled,\n preventDefault = true,\n tag = 'div',\n onEnter,\n onLeave,\n onPress = () => {},\n ...others\n}) =>\n React.createElement(\n tag,\n {\n ...others,\n disabled,\n className: styles(style.pressable, others.className),\n ...(!disabled\n ? {\n onClick: (event) => {\n if (preventDefault) {\n event.preventDefault();\n event.stopPropagation();\n }\n onPress(event);\n },\n onKeyPress: (event) => {\n if (event.keyCode === KEY_ENTER) {\n if (preventDefault) {\n event.preventDefault();\n event.stopPropagation();\n }\n onPress(event);\n }\n },\n onMouseEnter: onEnter,\n onMouseLeave: onLeave,\n }\n : {}),\n },\n children,\n );\n\nPressable.displayName = 'Primitive:Pressable';\n\nPressable.propTypes = {\n children: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),\n disabled: PropTypes.bool,\n preventDefault: PropTypes.bool,\n tag: PropTypes.string,\n onEnter: PropTypes.func,\n onLeave: PropTypes.func,\n onPress: PropTypes.func,\n};\n\nexport { Pressable };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AAA2C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAE3C,IAAMA,SAAS,GAAG,SAAZA,SAAS;EAAA,IACbC,QAAQ,QAARA,QAAQ;IACRC,QAAQ,QAARA,QAAQ;IAAA,2BACRC,cAAc;IAAdA,cAAc,oCAAG,IAAI;IAAA,gBACrBC,GAAG;IAAHA,GAAG,yBAAG,KAAK;IACXC,OAAO,QAAPA,OAAO;IACPC,OAAO,QAAPA,OAAO;IAAA,oBACPC,OAAO;IAAPA,OAAO,6BAAG,YAAM,CAAC,CAAC;IACfC,MAAM;EAAA,oBAETC,cAAK,CAACC,aAAa,CACjBN,GAAG,kCAEEI,MAAM;IACTN,QAAQ,EAARA,QAAQ;IACRS,SAAS,EAAE,IAAAC,eAAM,EAACC,wBAAK,CAACC,SAAS,
|
|
1
|
+
{"version":3,"file":"Pressable.js","names":["Pressable","children","disabled","preventDefault","tag","onEnter","onLeave","onPress","others","React","createElement","className","styles","style","pressable","onClick","event","stopPropagation","onKeyPress","keyCode","KEY_ENTER","onMouseEnter","onMouseLeave","displayName","propTypes","PropTypes","oneOfType","string","node","bool","func"],"sources":["../../../src/primitives/Pressable/Pressable.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { KEY_ENTER } from './Pressable.constants';\nimport style from './Pressable.module.css';\n\nconst Pressable = ({\n children,\n disabled,\n preventDefault = true,\n tag = 'div',\n onEnter,\n onLeave,\n onPress = () => {},\n ...others\n}) =>\n React.createElement(\n tag,\n {\n ...others,\n disabled,\n className: styles(style.pressable, disabled && style.disabled, others.className),\n ...(!disabled\n ? {\n onClick: (event) => {\n if (preventDefault) {\n event.preventDefault();\n event.stopPropagation();\n }\n onPress(event);\n },\n onKeyPress: (event) => {\n if (event.keyCode === KEY_ENTER) {\n if (preventDefault) {\n event.preventDefault();\n event.stopPropagation();\n }\n onPress(event);\n }\n },\n onMouseEnter: onEnter,\n onMouseLeave: onLeave,\n }\n : {}),\n },\n children,\n );\n\nPressable.displayName = 'Primitive:Pressable';\n\nPressable.propTypes = {\n children: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),\n disabled: PropTypes.bool,\n preventDefault: PropTypes.bool,\n tag: PropTypes.string,\n onEnter: PropTypes.func,\n onLeave: PropTypes.func,\n onPress: PropTypes.func,\n};\n\nexport { Pressable };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AAA2C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAE3C,IAAMA,SAAS,GAAG,SAAZA,SAAS;EAAA,IACbC,QAAQ,QAARA,QAAQ;IACRC,QAAQ,QAARA,QAAQ;IAAA,2BACRC,cAAc;IAAdA,cAAc,oCAAG,IAAI;IAAA,gBACrBC,GAAG;IAAHA,GAAG,yBAAG,KAAK;IACXC,OAAO,QAAPA,OAAO;IACPC,OAAO,QAAPA,OAAO;IAAA,oBACPC,OAAO;IAAPA,OAAO,6BAAG,YAAM,CAAC,CAAC;IACfC,MAAM;EAAA,oBAETC,cAAK,CAACC,aAAa,CACjBN,GAAG,kCAEEI,MAAM;IACTN,QAAQ,EAARA,QAAQ;IACRS,SAAS,EAAE,IAAAC,eAAM,EAACC,wBAAK,CAACC,SAAS,EAAEZ,QAAQ,IAAIW,wBAAK,CAACX,QAAQ,EAAEM,MAAM,CAACG,SAAS;EAAC,GAC5E,CAACT,QAAQ,GACT;IACEa,OAAO,EAAE,iBAACC,KAAK,EAAK;MAClB,IAAIb,cAAc,EAAE;QAClBa,KAAK,CAACb,cAAc,EAAE;QACtBa,KAAK,CAACC,eAAe,EAAE;MACzB;MACAV,OAAO,CAACS,KAAK,CAAC;IAChB,CAAC;IACDE,UAAU,EAAE,oBAACF,KAAK,EAAK;MACrB,IAAIA,KAAK,CAACG,OAAO,KAAKC,oBAAS,EAAE;QAC/B,IAAIjB,cAAc,EAAE;UAClBa,KAAK,CAACb,cAAc,EAAE;UACtBa,KAAK,CAACC,eAAe,EAAE;QACzB;QACAV,OAAO,CAACS,KAAK,CAAC;MAChB;IACF,CAAC;IACDK,YAAY,EAAEhB,OAAO;IACrBiB,YAAY,EAAEhB;EAChB,CAAC,GACD,CAAC,CAAC,GAERL,QAAQ,CACT;AAAA;AAAC;AAEJD,SAAS,CAACuB,WAAW,GAAG,qBAAqB;AAE7CvB,SAAS,CAACwB,SAAS,GAAG;EACpBvB,QAAQ,EAAEwB,kBAAS,CAACC,SAAS,CAAC,CAACD,kBAAS,CAACE,MAAM,EAAEF,kBAAS,CAACG,IAAI,CAAC,CAAC;EACjE1B,QAAQ,EAAEuB,kBAAS,CAACI,IAAI;EACxB1B,cAAc,EAAEsB,kBAAS,CAACI,IAAI;EAC9BzB,GAAG,EAAEqB,kBAAS,CAACE,MAAM;EACrBtB,OAAO,EAAEoB,kBAAS,CAACK,IAAI;EACvBxB,OAAO,EAAEmB,kBAAS,CAACK,IAAI;EACvBvB,OAAO,EAAEkB,kBAAS,CAACK;AACrB,CAAC"}
|
|
@@ -1,2 +1,62 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = exports.Story = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _ = require("..");
|
|
10
|
+
var _theme = require("./theme");
|
|
11
|
+
var _defaultTheme = _interopRequireDefault(require("./default.theme.css"));
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
19
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
20
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
|
+
var _default = {
|
|
22
|
+
title: 'Classes'
|
|
23
|
+
};
|
|
24
|
+
exports.default = _default;
|
|
25
|
+
var Story = function Story() {
|
|
26
|
+
var _useState = (0, _react.useState)(_theme.Theme.get()),
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
theme = _useState2[0],
|
|
29
|
+
setTheme = _useState2[1];
|
|
30
|
+
var handlePress = function handlePress() {
|
|
31
|
+
_theme.Theme.setVariable('base', '#222');
|
|
32
|
+
_theme.Theme.setVariable('content', '#fff');
|
|
33
|
+
_theme.Theme.setVariable('font', 'courier');
|
|
34
|
+
_theme.Theme.setVariable('font-bold', 'courier');
|
|
35
|
+
_theme.Theme.setVariable('accent', '#f2a900');
|
|
36
|
+
setTheme(_theme.Theme.get());
|
|
37
|
+
};
|
|
38
|
+
var _Theme$get = _theme.Theme.get(),
|
|
39
|
+
accent = _Theme$get.accent,
|
|
40
|
+
spaceXL = _Theme$get.spaceXL;
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_.Text, null, "Theme"), console.log(_theme.Theme.get()), Object.entries(_theme.Theme.get()).map(function (_ref) {
|
|
42
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
43
|
+
key = _ref2[0],
|
|
44
|
+
value = _ref2[1];
|
|
45
|
+
return /*#__PURE__*/_react.default.createElement(_.View, {
|
|
46
|
+
row: true,
|
|
47
|
+
key: key
|
|
48
|
+
}, /*#__PURE__*/_react.default.createElement(_.Text, {
|
|
49
|
+
bold: true,
|
|
50
|
+
action: true
|
|
51
|
+
}, "".concat(key, ": ")), /*#__PURE__*/_react.default.createElement(_.Text, {
|
|
52
|
+
action: true
|
|
53
|
+
}, value.toString()));
|
|
54
|
+
}), /*#__PURE__*/_react.default.createElement(_.Button, {
|
|
55
|
+
onPress: handlePress
|
|
56
|
+
}, "demo"));
|
|
57
|
+
};
|
|
58
|
+
exports.Story = Story;
|
|
59
|
+
Story.storyName = 'Theme';
|
|
60
|
+
Story.args = {};
|
|
61
|
+
Story.argTypes = {};
|
|
2
62
|
//# sourceMappingURL=theme.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.stories.js","names":[],"sources":["../../src/theme/theme.stories.jsx"],"sourcesContent":[""],"mappings":""}
|
|
1
|
+
{"version":3,"file":"theme.stories.js","names":["title","Story","useState","Theme","get","theme","setTheme","handlePress","setVariable","accent","spaceXL","console","log","Object","entries","map","key","value","toString","storyName","args","argTypes"],"sources":["../../src/theme/theme.stories.jsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport { Button, Text, View } from '..';\nimport { Theme } from './theme';\nimport style from './default.theme.css';\n\nexport default {\n title: 'Classes',\n};\n\nexport const Story = () => {\n const [theme, setTheme] = useState(Theme.get());\n\n const handlePress = () => {\n Theme.setVariable('base', '#222');\n Theme.setVariable('content', '#fff');\n Theme.setVariable('font', 'courier');\n Theme.setVariable('font-bold', 'courier');\n Theme.setVariable('accent', '#f2a900');\n setTheme(Theme.get());\n };\n\n const { accent, spaceXL } = Theme.get();\n\n return (\n <>\n <Text>Theme</Text>\n {console.log(Theme.get())}\n {Object.entries(Theme.get()).map(([key, value]) => (\n <View row key={key}>\n <Text bold action>\n {`${key}: `}\n </Text>\n <Text action>{value.toString()}</Text>\n </View>\n ))}\n <Button onPress={handlePress}>demo</Button>\n </>\n );\n};\n\nStory.storyName = 'Theme';\n\nStory.args = {};\n\nStory.argTypes = {};\n"],"mappings":";;;;;;;AAAA;AAEA;AACA;AACA;AAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAEzB;EACbA,KAAK,EAAE;AACT,CAAC;AAAA;AAEM,IAAMC,KAAK,GAAG,SAARA,KAAK,GAAS;EACzB,gBAA0B,IAAAC,eAAQ,EAACC,YAAK,CAACC,GAAG,EAAE,CAAC;IAAA;IAAxCC,KAAK;IAAEC,QAAQ;EAEtB,IAAMC,WAAW,GAAG,SAAdA,WAAW,GAAS;IACxBJ,YAAK,CAACK,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC;IACjCL,YAAK,CAACK,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC;IACpCL,YAAK,CAACK,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC;IACpCL,YAAK,CAACK,WAAW,CAAC,WAAW,EAAE,SAAS,CAAC;IACzCL,YAAK,CAACK,WAAW,CAAC,QAAQ,EAAE,SAAS,CAAC;IACtCF,QAAQ,CAACH,YAAK,CAACC,GAAG,EAAE,CAAC;EACvB,CAAC;EAED,iBAA4BD,YAAK,CAACC,GAAG,EAAE;IAA/BK,MAAM,cAANA,MAAM;IAAEC,OAAO,cAAPA,OAAO;EAEvB,oBACE,yEACE,6BAAC,MAAI,gBAAa,EACjBC,OAAO,CAACC,GAAG,CAACT,YAAK,CAACC,GAAG,EAAE,CAAC,EACxBS,MAAM,CAACC,OAAO,CAACX,YAAK,CAACC,GAAG,EAAE,CAAC,CAACW,GAAG,CAAC;IAAA;MAAEC,GAAG;MAAEC,KAAK;IAAA,oBAC3C,6BAAC,MAAI;MAAC,GAAG;MAAC,GAAG,EAAED;IAAI,gBACjB,6BAAC,MAAI;MAAC,IAAI;MAAC,MAAM;IAAA,aACXA,GAAG,QACF,eACP,6BAAC,MAAI;MAAC,MAAM;IAAA,GAAEC,KAAK,CAACC,QAAQ,EAAE,CAAQ,CACjC;EAAA,CACR,CAAC,eACF,6BAAC,QAAM;IAAC,OAAO,EAAEX;EAAY,UAAc,CAC1C;AAEP,CAAC;AAAC;AAEFN,KAAK,CAACkB,SAAS,GAAG,OAAO;AAEzBlB,KAAK,CAACmB,IAAI,GAAG,CAAC,CAAC;AAEfnB,KAAK,CAACoB,QAAQ,GAAG,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirai/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.81-beta",
|
|
4
4
|
"repository": "git@gitlab.com:miraicorp/dev/frontend/ui.git",
|
|
5
5
|
"author": "JΛVI <hello@soyjavi.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@testing-library/react": "12.1.5",
|
|
39
39
|
"@testing-library/react-hooks": "7.0.2",
|
|
40
40
|
"babel-polyfill": "6.26.0",
|
|
41
|
-
"parcel": "2.
|
|
41
|
+
"parcel": "2.8.3",
|
|
42
42
|
"process": "0.11.10",
|
|
43
43
|
"react-scripts": "5.0.1",
|
|
44
44
|
"source-map-explorer": "2.5.3"
|