@mirai/ui 1.0.65 → 1.0.67
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 +37 -1
- package/build/components/Action/Action.js +52 -0
- package/build/components/Action/Action.js.map +1 -0
- package/build/components/Action/Action.module.css +35 -0
- package/build/components/Action/Action.stories.js +43 -0
- package/build/components/Action/Action.stories.js.map +1 -0
- package/build/components/Action/__tests__/__snapshots__/Action.test.js.snap +83 -0
- package/build/components/Action/index.js +17 -0
- package/build/components/Action/index.js.map +1 -0
- package/build/components/Button/Button.js +17 -29
- package/build/components/Button/Button.js.map +1 -1
- package/build/components/Button/Button.module.css +1 -1
- package/build/components/Button/Button.stories.js +4 -11
- package/build/components/Button/Button.stories.js.map +1 -1
- package/build/components/Button/index.js +0 -2
- package/build/components/Button/index.js.map +1 -1
- package/build/components/Calendar/Calendar.Month.js +22 -41
- package/build/components/Calendar/Calendar.Month.js.map +1 -1
- package/build/components/Calendar/Calendar.Week.js +36 -58
- package/build/components/Calendar/Calendar.Week.js.map +1 -1
- package/build/components/Calendar/Calendar.Weekdays.js +0 -10
- package/build/components/Calendar/Calendar.Weekdays.js.map +1 -1
- package/build/components/Calendar/Calendar.constants.js.map +1 -1
- package/build/components/Calendar/Calendar.js +45 -90
- package/build/components/Calendar/Calendar.js.map +1 -1
- package/build/components/Calendar/Calendar.stories.js +4 -21
- package/build/components/Calendar/Calendar.stories.js.map +1 -1
- package/build/components/Calendar/helpers/getFirstDateOfMonth.js +0 -3
- package/build/components/Calendar/helpers/getFirstDateOfMonth.js.map +1 -1
- package/build/components/Calendar/helpers/getFirstDateOfWeek.js +0 -4
- package/build/components/Calendar/helpers/getFirstDateOfWeek.js.map +1 -1
- package/build/components/Calendar/helpers/getFirstDayOfWeek.js +0 -2
- package/build/components/Calendar/helpers/getFirstDayOfWeek.js.map +1 -1
- package/build/components/Calendar/helpers/getHeader.js +0 -3
- package/build/components/Calendar/helpers/getHeader.js.map +1 -1
- package/build/components/Calendar/helpers/getScrollTo.js +6 -19
- package/build/components/Calendar/helpers/getScrollTo.js.map +1 -1
- package/build/components/Calendar/helpers/getToday.js +0 -3
- package/build/components/Calendar/helpers/getToday.js.map +1 -1
- package/build/components/Calendar/helpers/getWeekDays.js +0 -5
- package/build/components/Calendar/helpers/getWeekDays.js.map +1 -1
- package/build/components/Calendar/helpers/getWeekNumber.js +0 -3
- package/build/components/Calendar/helpers/getWeekNumber.js.map +1 -1
- package/build/components/Calendar/helpers/index.js +0 -16
- package/build/components/Calendar/helpers/index.js.map +1 -1
- package/build/components/Calendar/index.js +0 -2
- package/build/components/Calendar/index.js.map +1 -1
- package/build/components/Form/Form.constants.js.map +1 -1
- package/build/components/Form/Form.js +39 -76
- package/build/components/Form/Form.js.map +1 -1
- package/build/components/Form/Form.stories.js +8 -16
- package/build/components/Form/Form.stories.js.map +1 -1
- package/build/components/Form/helpers/getChildrenErrors.js +10 -21
- package/build/components/Form/helpers/getChildrenErrors.js.map +1 -1
- package/build/components/Form/helpers/getChildrenValues.js +11 -25
- package/build/components/Form/helpers/getChildrenValues.js.map +1 -1
- package/build/components/Form/helpers/getField.js +2 -5
- package/build/components/Form/helpers/getField.js.map +1 -1
- package/build/components/Form/helpers/groupState.js +6 -9
- package/build/components/Form/helpers/groupState.js.map +1 -1
- package/build/components/Form/helpers/index.js +0 -8
- package/build/components/Form/helpers/index.js.map +1 -1
- package/build/components/Form/index.js +0 -2
- package/build/components/Form/index.js.map +1 -1
- package/build/components/InputDate/InputDate.js +48 -68
- package/build/components/InputDate/InputDate.js.map +1 -1
- package/build/components/InputDate/InputDate.module.css +4 -0
- package/build/components/InputDate/InputDate.stories.js +6 -20
- package/build/components/InputDate/InputDate.stories.js.map +1 -1
- package/build/components/InputDate/__tests__/__snapshots__/InputDate.test.js.snap +187 -25
- package/build/components/InputDate/index.js +0 -2
- package/build/components/InputDate/index.js.map +1 -1
- package/build/components/InputNumber/InputNumber.js +18 -32
- package/build/components/InputNumber/InputNumber.js.map +1 -1
- package/build/components/InputNumber/InputNumber.module.css +11 -6
- package/build/components/InputNumber/InputNumber.stories.js +4 -13
- package/build/components/InputNumber/InputNumber.stories.js.map +1 -1
- package/build/components/InputNumber/__tests__/__snapshots__/InputNumber.test.js.snap +2 -2
- package/build/components/InputNumber/index.js +0 -2
- package/build/components/InputNumber/index.js.map +1 -1
- package/build/components/InputOption/InputOption.constants.js.map +1 -1
- package/build/components/InputOption/InputOption.js +14 -30
- package/build/components/InputOption/InputOption.js.map +1 -1
- package/build/components/InputOption/InputOption.stories.js +4 -14
- package/build/components/InputOption/InputOption.stories.js.map +1 -1
- package/build/components/InputOption/index.js +0 -4
- package/build/components/InputOption/index.js.map +1 -1
- package/build/components/InputSelect/InputSelect.js +20 -48
- package/build/components/InputSelect/InputSelect.js.map +1 -1
- package/build/components/InputSelect/InputSelect.stories.js +4 -17
- package/build/components/InputSelect/InputSelect.stories.js.map +1 -1
- package/build/components/InputSelect/__tests__/__snapshots__/InputSelect.test.js.snap +8 -8
- package/build/components/InputSelect/index.js +0 -2
- package/build/components/InputSelect/index.js.map +1 -1
- package/build/components/InputText/InputText.js +41 -66
- package/build/components/InputText/InputText.js.map +1 -1
- package/build/components/InputText/InputText.module.css +8 -1
- package/build/components/InputText/InputText.stories.js +4 -25
- package/build/components/InputText/InputText.stories.js.map +1 -1
- package/build/components/InputText/__tests__/__snapshots__/InputText.test.js.snap +1 -1
- package/build/components/InputText/index.js +0 -2
- package/build/components/InputText/index.js.map +1 -1
- package/build/components/Menu/Menu.Option.js +8 -21
- package/build/components/Menu/Menu.Option.js.map +1 -1
- package/build/components/Menu/Menu.js +11 -29
- package/build/components/Menu/Menu.js.map +1 -1
- package/build/components/Menu/Menu.stories.js +4 -13
- package/build/components/Menu/Menu.stories.js.map +1 -1
- package/build/components/Menu/index.js +0 -2
- package/build/components/Menu/index.js.map +1 -1
- package/build/components/Modal/Modal.js +13 -29
- package/build/components/Modal/Modal.js.map +1 -1
- package/build/components/Modal/Modal.stories.js +4 -11
- package/build/components/Modal/Modal.stories.js.map +1 -1
- package/build/components/Modal/index.js +0 -2
- package/build/components/Modal/index.js.map +1 -1
- package/build/components/Notification/Notification.js +9 -22
- package/build/components/Notification/Notification.js.map +1 -1
- package/build/components/Notification/Notification.stories.js +4 -11
- package/build/components/Notification/Notification.stories.js.map +1 -1
- package/build/components/Notification/index.js +0 -2
- package/build/components/Notification/index.js.map +1 -1
- package/build/components/Table/Table.Row.js +26 -42
- package/build/components/Table/Table.Row.js.map +1 -1
- package/build/components/Table/Table.js +17 -43
- package/build/components/Table/Table.js.map +1 -1
- package/build/components/Table/Table.module.css +27 -9
- package/build/components/Table/Table.stories.js +4 -12
- package/build/components/Table/Table.stories.js.map +1 -1
- package/build/components/Table/__tests__/__snapshots__/Table.test.js.snap +30 -77
- package/build/components/Table/helpers/index.js +0 -2
- package/build/components/Table/helpers/index.js.map +1 -1
- package/build/components/Table/helpers/select.js +3 -7
- package/build/components/Table/helpers/select.js.map +1 -1
- package/build/components/Table/index.js +0 -2
- package/build/components/Table/index.js.map +1 -1
- package/build/components/Tooltip/Tooltip.js +11 -35
- package/build/components/Tooltip/Tooltip.js.map +1 -1
- package/build/components/Tooltip/Tooltip.stories.js +4 -11
- package/build/components/Tooltip/Tooltip.stories.js.map +1 -1
- package/build/components/Tooltip/index.js +0 -2
- package/build/components/Tooltip/index.js.map +1 -1
- package/build/components/index.js +11 -26
- package/build/components/index.js.map +1 -1
- package/build/helpers/getIconState.js +3 -7
- package/build/helpers/getIconState.js.map +1 -1
- package/build/helpers/getInputDateErrors.js +9 -13
- package/build/helpers/getInputDateErrors.js.map +1 -1
- package/build/helpers/getInputErrors.js +21 -30
- package/build/helpers/getInputErrors.js.map +1 -1
- package/build/helpers/index.js +11 -10
- package/build/helpers/index.js.map +1 -1
- package/build/helpers/isJest.js +0 -3
- package/build/helpers/isJest.js.map +1 -1
- package/build/helpers/isValidDate.js +8 -28
- package/build/helpers/isValidDate.js.map +1 -1
- package/build/helpers/isValidEmail.js +0 -1
- package/build/helpers/isValidEmail.js.map +1 -1
- package/build/helpers/isValidPhone.js +3 -9
- package/build/helpers/isValidPhone.js.map +1 -1
- package/build/helpers/splitDate.js +16 -0
- package/build/helpers/splitDate.js.map +1 -0
- package/build/helpers/styles.js +0 -3
- package/build/helpers/styles.js.map +1 -1
- package/build/hooks/helpers/getNavigator.js +2 -5
- package/build/hooks/helpers/getNavigator.js.map +1 -1
- package/build/hooks/helpers/getResolution.js +4 -7
- package/build/hooks/helpers/getResolution.js.map +1 -1
- package/build/hooks/helpers/index.js +0 -4
- package/build/hooks/helpers/index.js.map +1 -1
- package/build/hooks/index.js +0 -2
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/useDevice.js +8 -20
- package/build/hooks/useDevice.js.map +1 -1
- package/build/hooks/useDevice.stories.js +3 -19
- package/build/hooks/useDevice.stories.js.map +1 -1
- package/build/index.js +0 -10
- package/build/index.js.map +1 -1
- package/build/primitives/Checkbox/Checkbox.js +8 -20
- package/build/primitives/Checkbox/Checkbox.js.map +1 -1
- package/build/primitives/Checkbox/Checkbox.stories.js +4 -11
- package/build/primitives/Checkbox/Checkbox.stories.js.map +1 -1
- package/build/primitives/Checkbox/index.js +0 -2
- package/build/primitives/Checkbox/index.js.map +1 -1
- package/build/primitives/Icon/Icon.constants.js +1 -2
- package/build/primitives/Icon/Icon.constants.js.map +1 -1
- package/build/primitives/Icon/Icon.js +11 -22
- package/build/primitives/Icon/Icon.js.map +1 -1
- package/build/primitives/Icon/Icon.stories.js +7 -24
- package/build/primitives/Icon/Icon.stories.js.map +1 -1
- package/build/primitives/Icon/__tests__/__snapshots__/Icon.test.js.snap +27 -0
- package/build/primitives/Icon/index.js +0 -3
- package/build/primitives/Icon/index.js.map +1 -1
- package/build/primitives/Input/Input.js +15 -28
- package/build/primitives/Input/Input.js.map +1 -1
- package/build/primitives/Input/Input.module.css +8 -1
- package/build/primitives/Input/Input.stories.js +4 -11
- package/build/primitives/Input/Input.stories.js.map +1 -1
- package/build/primitives/Input/helpers/index.js +0 -2
- package/build/primitives/Input/helpers/index.js.map +1 -1
- package/build/primitives/Input/helpers/parseValue.js +2 -5
- package/build/primitives/Input/helpers/parseValue.js.map +1 -1
- package/build/primitives/Input/index.js +0 -2
- package/build/primitives/Input/index.js.map +1 -1
- package/build/primitives/Layer/Layer.js +25 -55
- package/build/primitives/Layer/Layer.js.map +1 -1
- package/build/primitives/Layer/Layer.stories.js +4 -13
- package/build/primitives/Layer/Layer.stories.js.map +1 -1
- package/build/primitives/Layer/LayerContent.js +0 -4
- package/build/primitives/Layer/LayerContent.js.map +1 -1
- package/build/primitives/Layer/helpers/getElementLayout.js +3 -5
- package/build/primitives/Layer/helpers/getElementLayout.js.map +1 -1
- package/build/primitives/Layer/helpers/getLayerPosition.js +18 -24
- package/build/primitives/Layer/helpers/getLayerPosition.js.map +1 -1
- package/build/primitives/Layer/helpers/index.js +0 -4
- package/build/primitives/Layer/helpers/index.js.map +1 -1
- package/build/primitives/Layer/index.js +0 -4
- package/build/primitives/Layer/index.js.map +1 -1
- package/build/primitives/Pressable/Pressable.constants.js.map +1 -1
- package/build/primitives/Pressable/Pressable.js +14 -26
- package/build/primitives/Pressable/Pressable.js.map +1 -1
- package/build/primitives/Pressable/Pressable.module.css +1 -0
- package/build/primitives/Pressable/Pressable.stories.js +4 -11
- package/build/primitives/Pressable/Pressable.stories.js.map +1 -1
- package/build/primitives/Pressable/index.js +0 -2
- package/build/primitives/Pressable/index.js.map +1 -1
- package/build/primitives/Radio/Radio.js +7 -19
- package/build/primitives/Radio/Radio.js.map +1 -1
- package/build/primitives/Radio/Radio.stories.js +4 -11
- package/build/primitives/Radio/Radio.stories.js.map +1 -1
- package/build/primitives/Radio/index.js +0 -2
- package/build/primitives/Radio/index.js.map +1 -1
- package/build/primitives/ScrollView/ScrollView.js +27 -45
- package/build/primitives/ScrollView/ScrollView.js.map +1 -1
- package/build/primitives/ScrollView/ScrollView.stories.js +6 -16
- package/build/primitives/ScrollView/ScrollView.stories.js.map +1 -1
- package/build/primitives/ScrollView/index.js +0 -2
- package/build/primitives/ScrollView/index.js.map +1 -1
- package/build/primitives/Select/Select.js +14 -31
- package/build/primitives/Select/Select.js.map +1 -1
- package/build/primitives/Select/Select.module.css +1 -0
- package/build/primitives/Select/Select.stories.js +4 -19
- package/build/primitives/Select/Select.stories.js.map +1 -1
- package/build/primitives/Select/index.js +0 -2
- package/build/primitives/Select/index.js.map +1 -1
- package/build/primitives/Switch/Switch.js +5 -18
- package/build/primitives/Switch/Switch.js.map +1 -1
- package/build/primitives/Switch/Switch.stories.js +4 -11
- package/build/primitives/Switch/Switch.stories.js.map +1 -1
- package/build/primitives/Switch/index.js +0 -2
- package/build/primitives/Switch/index.js.map +1 -1
- package/build/primitives/Text/Text.js +14 -25
- package/build/primitives/Text/Text.js.map +1 -1
- package/build/primitives/Text/Text.stories.js +4 -11
- package/build/primitives/Text/Text.stories.js.map +1 -1
- package/build/primitives/Text/index.js +0 -2
- package/build/primitives/Text/index.js.map +1 -1
- package/build/primitives/View/View.js +9 -20
- package/build/primitives/View/View.js.map +1 -1
- package/build/primitives/View/View.stories.js +4 -11
- package/build/primitives/View/View.stories.js.map +1 -1
- package/build/primitives/View/index.js +0 -2
- package/build/primitives/View/index.js.map +1 -1
- package/build/primitives/index.js +0 -22
- package/build/primitives/index.js.map +1 -1
- package/build/theme/default.theme.css +9 -3
- package/build/theme/helpers/camelcase.js +0 -2
- package/build/theme/helpers/camelcase.js.map +1 -1
- package/build/theme/helpers/colorShade.js +0 -4
- package/build/theme/helpers/colorShade.js.map +1 -1
- package/build/theme/helpers/index.js +0 -4
- package/build/theme/helpers/index.js.map +1 -1
- package/build/theme/index.js +0 -2
- package/build/theme/index.js.map +1 -1
- package/build/theme/theme.js +1 -14
- package/build/theme/theme.js.map +1 -1
- package/package.json +14 -16
|
@@ -12,9 +12,7 @@ Object.defineProperty(exports, "ICON", {
|
|
|
12
12
|
return _Icon2.ICON;
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
|
-
|
|
16
15
|
var _Icon = require("./Icon");
|
|
17
|
-
|
|
18
16
|
Object.keys(_Icon).forEach(function (key) {
|
|
19
17
|
if (key === "default" || key === "__esModule") return;
|
|
20
18
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -26,6 +24,5 @@ Object.keys(_Icon).forEach(function (key) {
|
|
|
26
24
|
}
|
|
27
25
|
});
|
|
28
26
|
});
|
|
29
|
-
|
|
30
27
|
var _Icon2 = require("./Icon.constants");
|
|
31
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/primitives/Icon/index.js"],"sourcesContent":["export * from './Icon';\nexport { ICON } from './Icon.constants';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/primitives/Icon/index.js"],"sourcesContent":["export * from './Icon';\nexport { ICON } from './Icon.constants';\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA"}
|
|
@@ -1,50 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
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); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.Input = void 0;
|
|
7
|
-
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
9
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
10
|
var _helpers = require("../../helpers");
|
|
13
|
-
|
|
14
11
|
var _helpers2 = require("./helpers");
|
|
15
|
-
|
|
16
12
|
var _InputModule = _interopRequireDefault(require("./Input.module.css"));
|
|
17
|
-
|
|
18
13
|
var _excluded = ["disabled", "multiLine", "type", "onChange", "onEnter", "onError", "onLeave"];
|
|
19
|
-
|
|
20
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
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; }
|
|
23
|
-
|
|
24
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; }
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
17
|
+
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; }
|
|
18
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
19
|
+
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); }
|
|
28
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; }
|
|
29
|
-
|
|
30
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; }
|
|
31
|
-
|
|
32
22
|
var Input = function Input(_ref) {
|
|
33
23
|
var disabled = _ref.disabled,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
24
|
+
multiLine = _ref.multiLine,
|
|
25
|
+
_ref$type = _ref.type,
|
|
26
|
+
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
27
|
+
onChange = _ref.onChange,
|
|
28
|
+
onEnter = _ref.onEnter,
|
|
29
|
+
onError = _ref.onError,
|
|
30
|
+
onLeave = _ref.onLeave,
|
|
31
|
+
others = _objectWithoutProperties(_ref, _excluded);
|
|
43
32
|
var errors = (0, _helpers.getInputErrors)(_objectSpread(_objectSpread({}, others), {}, {
|
|
44
33
|
type: type
|
|
45
34
|
}));
|
|
46
35
|
if (errors && onError) onError(errors);
|
|
47
|
-
|
|
48
36
|
var handleChange = function handleChange() {
|
|
49
37
|
var next = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
50
38
|
var event = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -56,11 +44,11 @@ var Input = function Input(_ref) {
|
|
|
56
44
|
})));
|
|
57
45
|
onChange && onChange(value || '', event);
|
|
58
46
|
};
|
|
59
|
-
|
|
60
47
|
return /*#__PURE__*/_react.default.createElement(multiLine ? 'textarea' : 'input', _objectSpread(_objectSpread({}, others), {}, {
|
|
61
48
|
disabled: disabled,
|
|
62
|
-
|
|
63
|
-
type: type
|
|
49
|
+
test: undefined,
|
|
50
|
+
type: type,
|
|
51
|
+
className: (0, _helpers.styles)(_InputModule.default.input, others.className)
|
|
64
52
|
}, !disabled ? {
|
|
65
53
|
onChange: function onChange(event) {
|
|
66
54
|
return handleChange(event.target.value, event);
|
|
@@ -69,7 +57,6 @@ var Input = function Input(_ref) {
|
|
|
69
57
|
onBlur: onLeave
|
|
70
58
|
} : {}));
|
|
71
59
|
};
|
|
72
|
-
|
|
73
60
|
exports.Input = Input;
|
|
74
61
|
Input.displayName = 'Primitive:Input';
|
|
75
62
|
Input.propTypes = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","names":["Input","disabled","multiLine","type","onChange","onEnter","onError","onLeave","others","errors","handleChange","next","event","isNaN","value","React","createElement","className","style","input","target","onFocus","onBlur","displayName","propTypes","PropTypes","bool","name","string","isRequired","func"],"sources":["../../../src/primitives/Input/Input.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { getInputErrors, styles } from '../../helpers';\nimport { parseValue } from './helpers';\nimport style from './Input.module.css';\n\nconst Input = ({ disabled, multiLine, type = 'text', onChange, onEnter, onError, onLeave, ...others }) => {\n const errors = getInputErrors({ ...others, type });\n if (errors && onError) onError(errors);\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 && onChange(value || '', event);\n };\n\n return React.createElement(multiLine ? 'textarea' : 'input', {\n ...others,\n disabled,\n className: styles(style.input, others.className),\n
|
|
1
|
+
{"version":3,"file":"Input.js","names":["Input","disabled","multiLine","type","onChange","onEnter","onError","onLeave","others","errors","getInputErrors","handleChange","next","event","isNaN","value","parseValue","React","createElement","test","undefined","className","styles","style","input","target","onFocus","onBlur","displayName","propTypes","PropTypes","bool","name","string","isRequired","func"],"sources":["../../../src/primitives/Input/Input.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { getInputErrors, styles } from '../../helpers';\nimport { parseValue } from './helpers';\nimport style from './Input.module.css';\n\nconst Input = ({ disabled, multiLine, type = 'text', onChange, onEnter, onError, onLeave, ...others }) => {\n const errors = getInputErrors({ ...others, type });\n if (errors && onError) onError(errors);\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 && onChange(value || '', event);\n };\n\n return React.createElement(multiLine ? 'textarea' : 'input', {\n ...others,\n disabled,\n test: undefined,\n type,\n className: styles(style.input, others.className),\n ...(!disabled\n ? {\n onChange: (event) => handleChange(event.target.value, event),\n onFocus: onEnter,\n onBlur: onLeave,\n }\n : {}),\n });\n};\n\nInput.displayName = 'Primitive:Input';\n\nInput.propTypes = {\n disabled: PropTypes.bool,\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;AAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEvC,IAAMA,KAAK,GAAG,SAARA,KAAK,OAA+F;EAAA,IAAzFC,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;EACjG,IAAMC,MAAM,GAAG,IAAAC,uBAAc,kCAAMF,MAAM;IAAEL,IAAI,EAAJA;EAAI,GAAG;EAClD,IAAIM,MAAM,IAAIH,OAAO,EAAEA,OAAO,CAACG,MAAM,CAAC;EAEtC,IAAME,YAAY,GAAG,SAAfA,YAAY,GAAyB;IAAA,IAArBC,IAAI,uEAAG,EAAE;IAAA,IAAEC,KAAK;IACpC,IAAIV,IAAI,KAAK,QAAQ,IAAIW,KAAK,CAACF,IAAI,CAAC,EAAE;IACtC,IAAMG,KAAK,GAAG,IAAAC,oBAAU,EAACJ,IAAI,EAAET,IAAI,EAAEK,MAAM,CAAC;IAE5CF,OAAO,IAAIA,OAAO,CAAC,IAAAI,uBAAc,kCAAMF,MAAM;MAAEL,IAAI,EAAJA,IAAI;MAAEY,KAAK,EAALA;IAAK,GAAG,CAAC;IAC9DX,QAAQ,IAAIA,QAAQ,CAACW,KAAK,IAAI,EAAE,EAAEF,KAAK,CAAC;EAC1C,CAAC;EAED,oBAAOI,cAAK,CAACC,aAAa,CAAChB,SAAS,GAAG,UAAU,GAAG,OAAO,kCACtDM,MAAM;IACTP,QAAQ,EAARA,QAAQ;IACRkB,IAAI,EAAEC,SAAS;IACfjB,IAAI,EAAJA,IAAI;IACJkB,SAAS,EAAE,IAAAC,eAAM,EAACC,oBAAK,CAACC,KAAK,EAAEhB,MAAM,CAACa,SAAS;EAAC,GAC5C,CAACpB,QAAQ,GACT;IACEG,QAAQ,EAAE,kBAACS,KAAK;MAAA,OAAKF,YAAY,CAACE,KAAK,CAACY,MAAM,CAACV,KAAK,EAAEF,KAAK,CAAC;IAAA;IAC5Da,OAAO,EAAErB,OAAO;IAChBsB,MAAM,EAAEpB;EACV,CAAC,GACD,CAAC,CAAC,EACN;AACJ,CAAC;AAAC;AAEFP,KAAK,CAAC4B,WAAW,GAAG,iBAAiB;AAErC5B,KAAK,CAAC6B,SAAS,GAAG;EAChB5B,QAAQ,EAAE6B,kBAAS,CAACC,IAAI;EACxB7B,SAAS,EAAE4B,kBAAS,CAACC,IAAI;EACzBC,IAAI,EAAEF,kBAAS,CAACG,MAAM,CAACC,UAAU;EACjC/B,IAAI,EAAE2B,kBAAS,CAACG,MAAM;EACtB7B,QAAQ,EAAE0B,kBAAS,CAACK,IAAI;EACxB9B,OAAO,EAAEyB,kBAAS,CAACK,IAAI;EACvB7B,OAAO,EAAEwB,kBAAS,CAACK,IAAI;EACvB5B,OAAO,EAAEuB,kBAAS,CAACK;AACrB,CAAC"}
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
text-align: var(--mirai-ui-text-align);
|
|
12
12
|
user-select: none;
|
|
13
13
|
width: 100%;
|
|
14
|
-
|
|
15
14
|
appearance: none;
|
|
16
15
|
-webkit-appearance: none;
|
|
17
16
|
-moz-appearance: none;
|
|
@@ -24,3 +23,11 @@
|
|
|
24
23
|
.input::placeholder {
|
|
25
24
|
color: var(--mirai-ui-input-disabled);
|
|
26
25
|
}
|
|
26
|
+
|
|
27
|
+
.input::-webkit-search-cancel-button {
|
|
28
|
+
-webkit-appearance: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.input::-ms-clear {
|
|
32
|
+
appearance: none;
|
|
33
|
+
}
|
|
@@ -1,31 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.default = exports.Story = void 0;
|
|
9
|
-
|
|
10
7
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
8
|
var _Input = require("./Input");
|
|
13
|
-
|
|
14
9
|
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); }
|
|
15
|
-
|
|
16
10
|
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
|
-
|
|
18
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
-
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
|
+
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); }
|
|
20
15
|
var _default = {
|
|
21
16
|
title: 'Primitives'
|
|
22
17
|
};
|
|
23
18
|
exports.default = _default;
|
|
24
|
-
|
|
25
19
|
var Story = function Story(props) {
|
|
26
20
|
return /*#__PURE__*/React.createElement(_Input.Input, props);
|
|
27
21
|
};
|
|
28
|
-
|
|
29
22
|
exports.Story = Story;
|
|
30
23
|
Story.storyName = 'Input';
|
|
31
24
|
Story.args = _defineProperty({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.stories.js","names":["title","Story","props","storyName","args","disabled","multiLine","name","placeholder","type","argTypes","options","control","defaultValue","onChange","action","onEnter","onError","onLeave"],"sources":["../../../src/primitives/Input/Input.stories.jsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Input } from './Input';\n\nexport default { title: 'Primitives' };\n\nexport const Story = (props) => <Input {...props} />;\n\nStory.storyName = 'Input';\n\nStory.args = {\n disabled: false,\n multiLine: false,\n name: 'Input',\n placeholder: 'placeholder',\n type: 'text',\n ['data-testid']: 'test-story',\n};\n\nStory.argTypes = {\n type: {\n options: ['text', 'password', 'number', 'email', 'date'],\n control: { type: 'select' },\n defaultValue: 'text',\n },\n onChange: { action: 'onChange' },\n onEnter: { action: 'onEnter' },\n onError: { action: 'onError' },\n onLeave: { action: 'onLeave' },\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Input.stories.js","names":["title","Story","props","storyName","args","disabled","multiLine","name","placeholder","type","argTypes","options","control","defaultValue","onChange","action","onEnter","onError","onLeave"],"sources":["../../../src/primitives/Input/Input.stories.jsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Input } from './Input';\n\nexport default { title: 'Primitives' };\n\nexport const Story = (props) => <Input {...props} />;\n\nStory.storyName = 'Input';\n\nStory.args = {\n disabled: false,\n multiLine: false,\n name: 'Input',\n placeholder: 'placeholder',\n type: 'text',\n ['data-testid']: 'test-story',\n};\n\nStory.argTypes = {\n type: {\n options: ['text', 'password', 'number', 'email', 'date'],\n control: { type: 'select' },\n defaultValue: 'text',\n },\n onChange: { action: 'onChange' },\n onEnter: { action: 'onEnter' },\n onError: { action: 'onError' },\n onLeave: { action: 'onLeave' },\n};\n"],"mappings":";;;;;;AAAA;AAEA;AAAgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAEjB;EAAEA,KAAK,EAAE;AAAa,CAAC;AAAA;AAE/B,IAAMC,KAAK,GAAG,SAARA,KAAK,CAAIC,KAAK;EAAA,oBAAK,oBAAC,YAAK,EAAKA,KAAK,CAAI;AAAA;AAAC;AAErDD,KAAK,CAACE,SAAS,GAAG,OAAO;AAEzBF,KAAK,CAACG,IAAI;EACRC,QAAQ,EAAE,KAAK;EACfC,SAAS,EAAE,KAAK;EAChBC,IAAI,EAAE,OAAO;EACbC,WAAW,EAAE,aAAa;EAC1BC,IAAI,EAAE;AAAM,GACX,aAAa,EAAG,YAAY,CAC9B;AAEDR,KAAK,CAACS,QAAQ,GAAG;EACfD,IAAI,EAAE;IACJE,OAAO,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC;IACxDC,OAAO,EAAE;MAAEH,IAAI,EAAE;IAAS,CAAC;IAC3BI,YAAY,EAAE;EAChB,CAAC;EACDC,QAAQ,EAAE;IAAEC,MAAM,EAAE;EAAW,CAAC;EAChCC,OAAO,EAAE;IAAED,MAAM,EAAE;EAAU,CAAC;EAC9BE,OAAO,EAAE;IAAEF,MAAM,EAAE;EAAU,CAAC;EAC9BG,OAAO,EAAE;IAAEH,MAAM,EAAE;EAAU;AAC/B,CAAC"}
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _parseValue = require("./parseValue");
|
|
8
|
-
|
|
9
7
|
Object.keys(_parseValue).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _parseValue[key]) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/primitives/Input/helpers/index.js"],"sourcesContent":["export * from './parseValue';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/primitives/Input/helpers/index.js"],"sourcesContent":["export * from './parseValue';\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -4,14 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.parseValue = void 0;
|
|
7
|
-
|
|
8
7
|
var parseValue = function parseValue(value, type) {
|
|
9
8
|
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
_ref$trimSpaces = _ref.trimSpaces,
|
|
10
|
+
trimSpaces = _ref$trimSpaces === void 0 ? false : _ref$trimSpaces;
|
|
13
11
|
return value && value.toString().trim().length > 0 ? type !== 'number' ? (trimSpaces ? value.trim() : value).toString() : !isNaN(value) ? parseFloat(value, 10) : undefined : undefined;
|
|
14
12
|
};
|
|
15
|
-
|
|
16
13
|
exports.parseValue = parseValue;
|
|
17
14
|
//# sourceMappingURL=parseValue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseValue.js","names":["parseValue","value","type","trimSpaces","toString","trim","length","isNaN","parseFloat","undefined"],"sources":["../../../../src/primitives/Input/helpers/parseValue.js"],"sourcesContent":["export const parseValue = (value, type, { trimSpaces = false } = {}) =>\n value && value.toString().trim().length > 0\n ? type !== 'number'\n ? (trimSpaces ? value.trim() : value).toString()\n : !isNaN(value)\n ? parseFloat(value, 10)\n : undefined\n : undefined;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"parseValue.js","names":["parseValue","value","type","trimSpaces","toString","trim","length","isNaN","parseFloat","undefined"],"sources":["../../../../src/primitives/Input/helpers/parseValue.js"],"sourcesContent":["export const parseValue = (value, type, { trimSpaces = false } = {}) =>\n value && value.toString().trim().length > 0\n ? type !== 'number'\n ? (trimSpaces ? value.trim() : value).toString()\n : !isNaN(value)\n ? parseFloat(value, 10)\n : undefined\n : undefined;\n"],"mappings":";;;;;;AAAO,IAAMA,UAAU,GAAG,SAAbA,UAAU,CAAIC,KAAK,EAAEC,IAAI;EAAA,+EAA2B,CAAC,CAAC;IAAA,uBAAzBC,UAAU;IAAVA,UAAU,gCAAG,KAAK;EAAA,OAC1DF,KAAK,IAAIA,KAAK,CAACG,QAAQ,EAAE,CAACC,IAAI,EAAE,CAACC,MAAM,GAAG,CAAC,GACvCJ,IAAI,KAAK,QAAQ,GACf,CAACC,UAAU,GAAGF,KAAK,CAACI,IAAI,EAAE,GAAGJ,KAAK,EAAEG,QAAQ,EAAE,GAC9C,CAACG,KAAK,CAACN,KAAK,CAAC,GACbO,UAAU,CAACP,KAAK,EAAE,EAAE,CAAC,GACrBQ,SAAS,GACXA,SAAS;AAAA;AAAC"}
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _Input = require("./Input");
|
|
8
|
-
|
|
9
7
|
Object.keys(_Input).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _Input[key]) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/primitives/Input/index.js"],"sourcesContent":["export * from './Input';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/primitives/Input/index.js"],"sourcesContent":["export * from './Input';\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -1,76 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
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
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.Layer = void 0;
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
10
|
var _helpers = require("../../helpers");
|
|
15
|
-
|
|
16
11
|
var _hooks = require("../../hooks");
|
|
17
|
-
|
|
18
12
|
var _helpers2 = require("./helpers");
|
|
19
|
-
|
|
20
13
|
var _LayerModule = _interopRequireDefault(require("./Layer.module.css"));
|
|
21
|
-
|
|
22
14
|
var _LayerContent = require("./LayerContent");
|
|
23
|
-
|
|
24
15
|
var _excluded = ["bottom", "centered", "forceRender", "left", "right", "top", "visible"];
|
|
25
|
-
|
|
26
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
-
|
|
28
17
|
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; }
|
|
29
|
-
|
|
30
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
-
|
|
32
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; }
|
|
33
|
-
|
|
34
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; }
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
21
|
+
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; }
|
|
22
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
23
|
+
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); }
|
|
38
24
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
39
|
-
|
|
40
25
|
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."); }
|
|
41
|
-
|
|
42
26
|
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); }
|
|
43
|
-
|
|
44
27
|
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; }
|
|
45
|
-
|
|
46
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
47
|
-
|
|
28
|
+
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; } }
|
|
48
29
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
49
|
-
|
|
50
30
|
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; }
|
|
51
|
-
|
|
52
31
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
53
|
-
|
|
54
32
|
var Layer = function Layer(_ref) {
|
|
55
33
|
var forceBottom = _ref.bottom,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
34
|
+
centered = _ref.centered,
|
|
35
|
+
_ref$forceRender = _ref.forceRender,
|
|
36
|
+
forceRender = _ref$forceRender === void 0 ? true : _ref$forceRender,
|
|
37
|
+
forceLeft = _ref.left,
|
|
38
|
+
forceRight = _ref.right,
|
|
39
|
+
forceTop = _ref.top,
|
|
40
|
+
visible = _ref.visible,
|
|
41
|
+
others = _objectWithoutProperties(_ref, _excluded);
|
|
65
42
|
var device = (0, _hooks.useDevice)();
|
|
66
43
|
var componentRef = (0, _react.useRef)();
|
|
67
44
|
var contentRef = (0, _react.useRef)();
|
|
68
|
-
|
|
69
45
|
var _useState = (0, _react.useState)(),
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
46
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
+
position = _useState2[0],
|
|
48
|
+
setPosition = _useState2[1];
|
|
74
49
|
(0, _react.useLayoutEffect)(function () {
|
|
75
50
|
var _componentRef$current = componentRef.current;
|
|
76
51
|
_componentRef$current = _componentRef$current === void 0 ? {} : _componentRef$current;
|
|
@@ -79,29 +54,25 @@ var Layer = function Layer(_ref) {
|
|
|
79
54
|
if (!componentEl || !contentEl) return setPosition();
|
|
80
55
|
var componentLayout = (0, _helpers2.getElementLayout)(componentEl);
|
|
81
56
|
var contentLayout = (0, _helpers2.getElementLayout)(contentEl);
|
|
82
|
-
|
|
83
57
|
var _getLayerPosition = (0, _helpers2.getLayerPosition)(componentLayout, contentLayout, device, {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
58
|
+
centered: centered,
|
|
59
|
+
forceBottom: forceBottom,
|
|
60
|
+
forceLeft: forceLeft,
|
|
61
|
+
forceRight: forceRight,
|
|
62
|
+
forceTop: forceTop
|
|
63
|
+
}),
|
|
64
|
+
_getLayerPosition$lef = _getLayerPosition.left,
|
|
65
|
+
left = _getLayerPosition$lef === void 0 ? 0 : _getLayerPosition$lef,
|
|
66
|
+
_getLayerPosition$top = _getLayerPosition.top,
|
|
67
|
+
top = _getLayerPosition$top === void 0 ? 0 : _getLayerPosition$top;
|
|
95
68
|
setPosition({
|
|
96
69
|
left: "".concat(left, "px"),
|
|
97
70
|
top: "".concat(top, "px")
|
|
98
71
|
});
|
|
99
72
|
}, [centered, device, forceBottom, forceLeft, forceRight, forceTop, visible]);
|
|
100
|
-
|
|
101
73
|
var children = _react.default.Children.map(others.children || [], function (child) {
|
|
102
74
|
return child;
|
|
103
75
|
});
|
|
104
|
-
|
|
105
76
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
106
77
|
"data-testid": others['data-testid'],
|
|
107
78
|
ref: componentRef
|
|
@@ -117,7 +88,6 @@ var Layer = function Layer(_ref) {
|
|
|
117
88
|
return name === _LayerContent.LayerContent.name;
|
|
118
89
|
})));
|
|
119
90
|
};
|
|
120
|
-
|
|
121
91
|
exports.Layer = Layer;
|
|
122
92
|
Layer.propTypes = {
|
|
123
93
|
bottom: _propTypes.default.bool,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layer.js","names":["Layer","forceBottom","bottom","centered","forceRender","forceLeft","left","forceRight","right","forceTop","top","visible","others","device","componentRef","contentRef","position","setPosition","current","componentEl","firstChild","contentEl","componentLayout","contentLayout","children","React","Children","map","child","find","name","type","LayerContent","style","layer","hidden","className","propTypes","PropTypes","bool","node"],"sources":["../../../src/primitives/Layer/Layer.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useLayoutEffect, useRef, useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { useDevice } from '../../hooks';\nimport { getElementLayout, getLayerPosition } from './helpers';\nimport style from './Layer.module.css';\nimport { LayerContent } from './LayerContent';\n\nconst Layer = ({\n bottom: forceBottom,\n centered,\n forceRender = true,\n left: forceLeft,\n right: forceRight,\n top: forceTop,\n visible,\n ...others\n}) => {\n const device = useDevice();\n const componentRef = useRef();\n const contentRef = useRef();\n\n const [position, setPosition] = useState();\n\n useLayoutEffect(() => {\n const { current: { firstChild: componentEl } = {} } = componentRef;\n const { current: contentEl } = contentRef;\n\n if (!componentEl || !contentEl) return setPosition();\n\n const componentLayout = getElementLayout(componentEl);\n const contentLayout = getElementLayout(contentEl);\n const { left = 0, top = 0 } = getLayerPosition(componentLayout, contentLayout, device, {\n centered,\n forceBottom,\n forceLeft,\n forceRight,\n forceTop,\n });\n\n setPosition({ left: `${left}px`, top: `${top}px` });\n }, [centered, device, forceBottom, forceLeft, forceRight, forceTop, visible]);\n\n const children = React.Children.map(others.children || [], (child) => child);\n\n return (\n <>\n <span data-testid={others['data-testid']} ref={componentRef}>\n {children.find(({ type: { name } }) => name !== LayerContent.name)}\n </span>\n\n {(forceRender || visible) && (\n <div\n ref={contentRef}\n className={styles(style.layer, !visible && style.hidden, others.className)}\n style={{ ...others.style, ...position }}\n >\n {children?.find(({ type: { name } }) => name === LayerContent.name)}\n </div>\n )}\n </>\n );\n};\n\nLayer.propTypes = {\n bottom: PropTypes.bool,\n centered: PropTypes.bool,\n children: PropTypes.node,\n forceRender: PropTypes.bool,\n left: PropTypes.bool,\n right: PropTypes.bool,\n top: PropTypes.bool,\n visible: PropTypes.bool,\n};\n\nexport { Layer };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Layer.js","names":["Layer","forceBottom","bottom","centered","forceRender","forceLeft","left","forceRight","right","forceTop","top","visible","others","device","useDevice","componentRef","useRef","contentRef","useState","position","setPosition","useLayoutEffect","current","componentEl","firstChild","contentEl","componentLayout","getElementLayout","contentLayout","getLayerPosition","children","React","Children","map","child","find","name","type","LayerContent","styles","style","layer","hidden","className","propTypes","PropTypes","bool","node"],"sources":["../../../src/primitives/Layer/Layer.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useLayoutEffect, useRef, useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { useDevice } from '../../hooks';\nimport { getElementLayout, getLayerPosition } from './helpers';\nimport style from './Layer.module.css';\nimport { LayerContent } from './LayerContent';\n\nconst Layer = ({\n bottom: forceBottom,\n centered,\n forceRender = true,\n left: forceLeft,\n right: forceRight,\n top: forceTop,\n visible,\n ...others\n}) => {\n const device = useDevice();\n const componentRef = useRef();\n const contentRef = useRef();\n\n const [position, setPosition] = useState();\n\n useLayoutEffect(() => {\n const { current: { firstChild: componentEl } = {} } = componentRef;\n const { current: contentEl } = contentRef;\n\n if (!componentEl || !contentEl) return setPosition();\n\n const componentLayout = getElementLayout(componentEl);\n const contentLayout = getElementLayout(contentEl);\n const { left = 0, top = 0 } = getLayerPosition(componentLayout, contentLayout, device, {\n centered,\n forceBottom,\n forceLeft,\n forceRight,\n forceTop,\n });\n\n setPosition({ left: `${left}px`, top: `${top}px` });\n }, [centered, device, forceBottom, forceLeft, forceRight, forceTop, visible]);\n\n const children = React.Children.map(others.children || [], (child) => child);\n\n return (\n <>\n <span data-testid={others['data-testid']} ref={componentRef}>\n {children.find(({ type: { name } }) => name !== LayerContent.name)}\n </span>\n\n {(forceRender || visible) && (\n <div\n ref={contentRef}\n className={styles(style.layer, !visible && style.hidden, others.className)}\n style={{ ...others.style, ...position }}\n >\n {children?.find(({ type: { name } }) => name === LayerContent.name)}\n </div>\n )}\n </>\n );\n};\n\nLayer.propTypes = {\n bottom: PropTypes.bool,\n centered: PropTypes.bool,\n children: PropTypes.node,\n forceRender: PropTypes.bool,\n left: PropTypes.bool,\n right: PropTypes.bool,\n top: PropTypes.bool,\n visible: PropTypes.bool,\n};\n\nexport { Layer };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AAA8C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAE9C,IAAMA,KAAK,GAAG,SAARA,KAAK,OASL;EAAA,IARIC,WAAW,QAAnBC,MAAM;IACNC,QAAQ,QAARA,QAAQ;IAAA,wBACRC,WAAW;IAAXA,WAAW,iCAAG,IAAI;IACZC,SAAS,QAAfC,IAAI;IACGC,UAAU,QAAjBC,KAAK;IACAC,QAAQ,QAAbC,GAAG;IACHC,OAAO,QAAPA,OAAO;IACJC,MAAM;EAET,IAAMC,MAAM,GAAG,IAAAC,gBAAS,GAAE;EAC1B,IAAMC,YAAY,GAAG,IAAAC,aAAM,GAAE;EAC7B,IAAMC,UAAU,GAAG,IAAAD,aAAM,GAAE;EAE3B,gBAAgC,IAAAE,eAAQ,GAAE;IAAA;IAAnCC,QAAQ;IAAEC,WAAW;EAE5B,IAAAC,sBAAe,EAAC,YAAM;IACpB,4BAAsDN,YAAY,CAA1DO,OAAO;IAAf,2DAA+C,CAAC,CAAC;IAAjD,IAA+BC,WAAW,yBAAvBC,UAAU;IAC7B,IAAiBC,SAAS,GAAKR,UAAU,CAAjCK,OAAO;IAEf,IAAI,CAACC,WAAW,IAAI,CAACE,SAAS,EAAE,OAAOL,WAAW,EAAE;IAEpD,IAAMM,eAAe,GAAG,IAAAC,0BAAgB,EAACJ,WAAW,CAAC;IACrD,IAAMK,aAAa,GAAG,IAAAD,0BAAgB,EAACF,SAAS,CAAC;IACjD,wBAA8B,IAAAI,0BAAgB,EAACH,eAAe,EAAEE,aAAa,EAAEf,MAAM,EAAE;QACrFV,QAAQ,EAARA,QAAQ;QACRF,WAAW,EAAXA,WAAW;QACXI,SAAS,EAATA,SAAS;QACTE,UAAU,EAAVA,UAAU;QACVE,QAAQ,EAARA;MACF,CAAC,CAAC;MAAA,0CANMH,IAAI;MAAJA,IAAI,sCAAG,CAAC;MAAA,0CAAEI,GAAG;MAAHA,GAAG,sCAAG,CAAC;IAQzBU,WAAW,CAAC;MAAEd,IAAI,YAAKA,IAAI,OAAI;MAAEI,GAAG,YAAKA,GAAG;IAAK,CAAC,CAAC;EACrD,CAAC,EAAE,CAACP,QAAQ,EAAEU,MAAM,EAAEZ,WAAW,EAAEI,SAAS,EAAEE,UAAU,EAAEE,QAAQ,EAAEE,OAAO,CAAC,CAAC;EAE7E,IAAMmB,QAAQ,GAAGC,cAAK,CAACC,QAAQ,CAACC,GAAG,CAACrB,MAAM,CAACkB,QAAQ,IAAI,EAAE,EAAE,UAACI,KAAK;IAAA,OAAKA,KAAK;EAAA,EAAC;EAE5E,oBACE,yEACE;IAAM,eAAatB,MAAM,CAAC,aAAa,CAAE;IAAC,GAAG,EAAEG;EAAa,GACzDe,QAAQ,CAACK,IAAI,CAAC;IAAA,IAAWC,IAAI,SAAZC,IAAI,CAAID,IAAI;IAAA,OAASA,IAAI,KAAKE,0BAAY,CAACF,IAAI;EAAA,EAAC,CAC7D,EAEN,CAAChC,WAAW,IAAIO,OAAO,kBACtB;IACE,GAAG,EAAEM,UAAW;IAChB,SAAS,EAAE,IAAAsB,eAAM,EAACC,oBAAK,CAACC,KAAK,EAAE,CAAC9B,OAAO,IAAI6B,oBAAK,CAACE,MAAM,EAAE9B,MAAM,CAAC+B,SAAS,CAAE;IAC3E,KAAK,kCAAO/B,MAAM,CAAC4B,KAAK,GAAKrB,QAAQ;EAAG,GAEvCW,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEK,IAAI,CAAC;IAAA,IAAWC,IAAI,SAAZC,IAAI,CAAID,IAAI;IAAA,OAASA,IAAI,KAAKE,0BAAY,CAACF,IAAI;EAAA,EAAC,CAEtE,CACA;AAEP,CAAC;AAAC;AAEFpC,KAAK,CAAC4C,SAAS,GAAG;EAChB1C,MAAM,EAAE2C,kBAAS,CAACC,IAAI;EACtB3C,QAAQ,EAAE0C,kBAAS,CAACC,IAAI;EACxBhB,QAAQ,EAAEe,kBAAS,CAACE,IAAI;EACxB3C,WAAW,EAAEyC,kBAAS,CAACC,IAAI;EAC3BxC,IAAI,EAAEuC,kBAAS,CAACC,IAAI;EACpBtC,KAAK,EAAEqC,kBAAS,CAACC,IAAI;EACrBpC,GAAG,EAAEmC,kBAAS,CAACC,IAAI;EACnBnC,OAAO,EAAEkC,kBAAS,CAACC;AACrB,CAAC"}
|
|
@@ -1,37 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
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
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = exports.Story = void 0;
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _Layer = require("./Layer");
|
|
13
|
-
|
|
14
10
|
var _LayerContent = require("./LayerContent");
|
|
15
|
-
|
|
16
11
|
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); }
|
|
17
|
-
|
|
18
12
|
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; }
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
function _extends() { _extends = Object.assign
|
|
23
|
-
|
|
13
|
+
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; }
|
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
|
+
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); }
|
|
16
|
+
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); }
|
|
24
17
|
var _default = {
|
|
25
18
|
title: 'Primitives'
|
|
26
19
|
};
|
|
27
20
|
exports.default = _default;
|
|
28
|
-
|
|
29
21
|
var Story = function Story(props) {
|
|
30
22
|
return /*#__PURE__*/React.createElement(_Layer.Layer, _extends({
|
|
31
23
|
className: "children"
|
|
32
24
|
}, props), /*#__PURE__*/React.createElement("span", null, "dispatcher"), /*#__PURE__*/React.createElement(_LayerContent.LayerContent, null, /*#__PURE__*/React.createElement("span", null, "children")));
|
|
33
25
|
};
|
|
34
|
-
|
|
35
26
|
exports.Story = Story;
|
|
36
27
|
Story.storyName = 'Layer';
|
|
37
28
|
Story.args = _defineProperty({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layer.stories.js","names":["title","Story","props","storyName","args","bottom","centered","forceRender","left","right","top","visible"],"sources":["../../../src/primitives/Layer/Layer.stories.jsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Layer } from './Layer';\nimport { LayerContent } from './LayerContent';\n\nexport default { title: 'Primitives' };\n\nexport const Story = (props) => (\n <Layer className=\"children\" {...props}>\n <span>dispatcher</span>\n <LayerContent>\n <span>children</span>\n </LayerContent>\n </Layer>\n);\n\nStory.storyName = 'Layer';\n\nStory.args = {\n bottom: false,\n centered: false,\n forceRender: true,\n left: false,\n right: false,\n top: false,\n visible: false,\n ['data-testid']: 'test-story',\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Layer.stories.js","names":["title","Story","props","storyName","args","bottom","centered","forceRender","left","right","top","visible"],"sources":["../../../src/primitives/Layer/Layer.stories.jsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Layer } from './Layer';\nimport { LayerContent } from './LayerContent';\n\nexport default { title: 'Primitives' };\n\nexport const Story = (props) => (\n <Layer className=\"children\" {...props}>\n <span>dispatcher</span>\n <LayerContent>\n <span>children</span>\n </LayerContent>\n </Layer>\n);\n\nStory.storyName = 'Layer';\n\nStory.args = {\n bottom: false,\n centered: false,\n forceRender: true,\n left: false,\n right: false,\n top: false,\n visible: false,\n ['data-testid']: 'test-story',\n};\n"],"mappings":";;;;;;;AAAA;AAEA;AACA;AAA8C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAE/B;EAAEA,KAAK,EAAE;AAAa,CAAC;AAAA;AAE/B,IAAMC,KAAK,GAAG,SAARA,KAAK,CAAIC,KAAK;EAAA,oBACzB,oBAAC,YAAK;IAAC,SAAS,EAAC;EAAU,GAAKA,KAAK,gBACnC,+CAAuB,eACvB,oBAAC,0BAAY,qBACX,6CAAqB,CACR,CACT;AAAA,CACT;AAAC;AAEFD,KAAK,CAACE,SAAS,GAAG,OAAO;AAEzBF,KAAK,CAACG,IAAI;EACRC,MAAM,EAAE,KAAK;EACbC,QAAQ,EAAE,KAAK;EACfC,WAAW,EAAE,IAAI;EACjBC,IAAI,EAAE,KAAK;EACXC,KAAK,EAAE,KAAK;EACZC,GAAG,EAAE,KAAK;EACVC,OAAO,EAAE;AAAK,GACb,aAAa,EAAG,YAAY,CAC9B"}
|
|
@@ -4,16 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.LayerContent = void 0;
|
|
7
|
-
|
|
8
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
9
|
var LayerContent = function LayerContent(_ref) {
|
|
13
10
|
var children = _ref.children;
|
|
14
11
|
return children;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
exports.LayerContent = LayerContent;
|
|
18
14
|
LayerContent.displayName = 'Primitive:Layer:Content';
|
|
19
15
|
LayerContent.propTypes = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayerContent.js","names":["LayerContent","children","displayName","propTypes","PropTypes","node"],"sources":["../../../src/primitives/Layer/LayerContent.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\n\nconst LayerContent = ({ children }) => children;\n\nLayerContent.displayName = 'Primitive:Layer:Content';\n\nLayerContent.propTypes = {\n children: PropTypes.node,\n};\n\nexport { LayerContent };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"LayerContent.js","names":["LayerContent","children","displayName","propTypes","PropTypes","node"],"sources":["../../../src/primitives/Layer/LayerContent.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\n\nconst LayerContent = ({ children }) => children;\n\nLayerContent.displayName = 'Primitive:Layer:Content';\n\nLayerContent.propTypes = {\n children: PropTypes.node,\n};\n\nexport { LayerContent };\n"],"mappings":";;;;;;AAAA;AAAmC;AAEnC,IAAMA,YAAY,GAAG,SAAfA,YAAY;EAAA,IAAMC,QAAQ,QAARA,QAAQ;EAAA,OAAOA,QAAQ;AAAA;AAAC;AAEhDD,YAAY,CAACE,WAAW,GAAG,yBAAyB;AAEpDF,YAAY,CAACG,SAAS,GAAG;EACvBF,QAAQ,EAAEG,kBAAS,CAACC;AACtB,CAAC"}
|
|
@@ -4,13 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getElementLayout = void 0;
|
|
7
|
-
|
|
8
7
|
var getElementLayout = function getElementLayout() {
|
|
9
8
|
var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10
9
|
var left = element.offsetLeft,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
top = element.offsetTop,
|
|
11
|
+
height = element.offsetHeight,
|
|
12
|
+
width = element.offsetWidth;
|
|
14
13
|
return {
|
|
15
14
|
left: left,
|
|
16
15
|
top: top,
|
|
@@ -18,6 +17,5 @@ var getElementLayout = function getElementLayout() {
|
|
|
18
17
|
width: width
|
|
19
18
|
};
|
|
20
19
|
};
|
|
21
|
-
|
|
22
20
|
exports.getElementLayout = getElementLayout;
|
|
23
21
|
//# sourceMappingURL=getElementLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getElementLayout.js","names":["getElementLayout","element","left","offsetLeft","top","offsetTop","height","offsetHeight","width","offsetWidth"],"sources":["../../../../src/primitives/Layer/helpers/getElementLayout.js"],"sourcesContent":["export const getElementLayout = (element = {}) => {\n const { offsetLeft: left, offsetTop: top, offsetHeight: height, offsetWidth: width } = element;\n\n return { left, top, height, width };\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getElementLayout.js","names":["getElementLayout","element","left","offsetLeft","top","offsetTop","height","offsetHeight","width","offsetWidth"],"sources":["../../../../src/primitives/Layer/helpers/getElementLayout.js"],"sourcesContent":["export const getElementLayout = (element = {}) => {\n const { offsetLeft: left, offsetTop: top, offsetHeight: height, offsetWidth: width } = element;\n\n return { left, top, height, width };\n};\n"],"mappings":";;;;;;AAAO,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgB,GAAqB;EAAA,IAAjBC,OAAO,uEAAG,CAAC,CAAC;EAC3C,IAAoBC,IAAI,GAA+DD,OAAO,CAAtFE,UAAU;IAAmBC,GAAG,GAA+CH,OAAO,CAApEI,SAAS;IAAqBC,MAAM,GAAyBL,OAAO,CAApDM,YAAY;IAAuBC,KAAK,GAAKP,OAAO,CAA9BQ,WAAW;EAE3E,OAAO;IAAEP,IAAI,EAAJA,IAAI;IAAEE,GAAG,EAAHA,GAAG;IAAEE,MAAM,EAANA,MAAM;IAAEE,KAAK,EAALA;EAAM,CAAC;AACrC,CAAC;AAAC"}
|