@mirai/ui 2.0.43 → 2.1.1
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/build/components/Action/Action.js +24 -30
- package/build/components/Action/Action.js.map +1 -1
- package/build/components/Action/Action.stories.js +3 -6
- package/build/components/Action/Action.stories.js.map +1 -1
- package/build/components/Action/index.js +1 -1
- package/build/components/Action/index.js.map +1 -1
- package/build/components/Button/Button.js +32 -39
- package/build/components/Button/Button.js.map +1 -1
- package/build/components/Button/Button.stories.js +25 -48
- package/build/components/Button/Button.stories.js.map +1 -1
- package/build/components/Button/index.js +1 -1
- package/build/components/Button/index.js.map +1 -1
- package/build/components/Calendar/Calendar.Month.js +45 -57
- package/build/components/Calendar/Calendar.Month.js.map +1 -1
- package/build/components/Calendar/Calendar.Week.js +54 -83
- package/build/components/Calendar/Calendar.Week.js.map +1 -1
- package/build/components/Calendar/Calendar.Weekdays.js +15 -15
- package/build/components/Calendar/Calendar.Weekdays.js.map +1 -1
- package/build/components/Calendar/Calendar.constants.js +2 -4
- package/build/components/Calendar/Calendar.constants.js.map +1 -1
- package/build/components/Calendar/Calendar.js +110 -162
- package/build/components/Calendar/Calendar.js.map +1 -1
- package/build/components/Calendar/Calendar.stories.js +75 -90
- package/build/components/Calendar/Calendar.stories.js.map +1 -1
- package/build/components/Calendar/helpers/getFirstDateOfMonth.js +2 -2
- package/build/components/Calendar/helpers/getFirstDateOfMonth.js.map +1 -1
- package/build/components/Calendar/helpers/getFirstDateOfWeek.js +6 -6
- package/build/components/Calendar/helpers/getFirstDateOfWeek.js.map +1 -1
- package/build/components/Calendar/helpers/getFirstDayOfWeek.js +5 -5
- package/build/components/Calendar/helpers/getFirstDayOfWeek.js.map +1 -1
- package/build/components/Calendar/helpers/getHeader.js +6 -6
- package/build/components/Calendar/helpers/getHeader.js.map +1 -1
- package/build/components/Calendar/helpers/getMonthRef.js +9 -8
- package/build/components/Calendar/helpers/getMonthRef.js.map +1 -1
- package/build/components/Calendar/helpers/getScrollTo.js +8 -15
- package/build/components/Calendar/helpers/getScrollTo.js.map +1 -1
- package/build/components/Calendar/helpers/getToday.js +1 -3
- package/build/components/Calendar/helpers/getToday.js.map +1 -1
- package/build/components/Calendar/helpers/getWeekDays.js +8 -8
- package/build/components/Calendar/helpers/getWeekDays.js.map +1 -1
- package/build/components/Calendar/helpers/getWeekNumber.js +3 -3
- package/build/components/Calendar/helpers/getWeekNumber.js.map +1 -1
- package/build/components/Calendar/helpers/index.js +9 -9
- package/build/components/Calendar/helpers/index.js.map +1 -1
- package/build/components/Calendar/index.js +1 -1
- package/build/components/Calendar/index.js.map +1 -1
- package/build/components/Form/Form.constants.js +5 -10
- package/build/components/Form/Form.constants.js.map +1 -1
- package/build/components/Form/Form.js +86 -118
- package/build/components/Form/Form.js.map +1 -1
- package/build/components/Form/Form.stories.js +47 -83
- package/build/components/Form/Form.stories.js.map +1 -1
- package/build/components/Form/helpers/getChildrenErrors.js +18 -22
- package/build/components/Form/helpers/getChildrenErrors.js.map +1 -1
- package/build/components/Form/helpers/getChildrenValues.js +15 -22
- package/build/components/Form/helpers/getChildrenValues.js.map +1 -1
- package/build/components/Form/helpers/getField.js +5 -4
- package/build/components/Form/helpers/getField.js.map +1 -1
- package/build/components/Form/helpers/groupState.js +8 -10
- package/build/components/Form/helpers/groupState.js.map +1 -1
- package/build/components/Form/helpers/index.js +4 -4
- package/build/components/Form/helpers/index.js.map +1 -1
- package/build/components/Form/index.js +1 -1
- package/build/components/Form/index.js.map +1 -1
- package/build/components/InputDate/InputDate.js +23 -38
- package/build/components/InputDate/InputDate.js.map +1 -1
- package/build/components/InputDate/InputDate.stories.js +18 -34
- package/build/components/InputDate/InputDate.stories.js.map +1 -1
- package/build/components/InputDate/helpers/formatValue.js +11 -13
- package/build/components/InputDate/helpers/formatValue.js.map +1 -1
- package/build/components/InputDate/helpers/index.js +1 -1
- package/build/components/InputDate/helpers/index.js.map +1 -1
- package/build/components/InputDate/index.js +1 -1
- package/build/components/InputDate/index.js.map +1 -1
- package/build/components/InputNumber/InputNumber.js +31 -44
- package/build/components/InputNumber/InputNumber.js.map +1 -1
- package/build/components/InputNumber/InputNumber.stories.js +8 -20
- package/build/components/InputNumber/InputNumber.stories.js.map +1 -1
- package/build/components/InputNumber/index.js +1 -1
- package/build/components/InputNumber/index.js.map +1 -1
- package/build/components/InputOption/InputOption.constants.js +3 -6
- package/build/components/InputOption/InputOption.constants.js.map +1 -1
- package/build/components/InputOption/InputOption.js +34 -38
- package/build/components/InputOption/InputOption.js.map +1 -1
- package/build/components/InputOption/InputOption.stories.js +8 -20
- package/build/components/InputOption/InputOption.stories.js.map +1 -1
- package/build/components/InputOption/index.js +2 -2
- package/build/components/InputOption/index.js.map +1 -1
- package/build/components/InputPhone/InputPhone.js +99 -143
- package/build/components/InputPhone/InputPhone.js.map +1 -1
- package/build/components/InputPhone/InputPhone.stories.js +22 -45
- package/build/components/InputPhone/InputPhone.stories.js.map +1 -1
- package/build/components/InputPhone/helpers/index.js +2 -2
- package/build/components/InputPhone/helpers/index.js.map +1 -1
- package/build/components/InputPhone/helpers/parseValue.js +8 -17
- package/build/components/InputPhone/helpers/parseValue.js.map +1 -1
- package/build/components/InputPhone/helpers/sanitizePrefixes.js +4 -12
- package/build/components/InputPhone/helpers/sanitizePrefixes.js.map +1 -1
- package/build/components/InputPhone/index.js +1 -1
- package/build/components/InputPhone/index.js.map +1 -1
- package/build/components/InputSelect/InputSelect.js +47 -70
- package/build/components/InputSelect/InputSelect.js.map +1 -1
- package/build/components/InputSelect/InputSelect.stories.js +12 -26
- package/build/components/InputSelect/InputSelect.stories.js.map +1 -1
- package/build/components/InputSelect/index.js +1 -1
- package/build/components/InputSelect/index.js.map +1 -1
- package/build/components/InputSelect/partials/InputSelect.Expand.js +3 -3
- package/build/components/InputSelect/partials/InputSelect.Expand.js.map +1 -1
- package/build/components/InputSelect/partials/index.js +1 -1
- package/build/components/InputSelect/partials/index.js.map +1 -1
- package/build/components/InputText/InputText.js +54 -87
- package/build/components/InputText/InputText.js.map +1 -1
- package/build/components/InputText/InputText.stories.js +17 -36
- package/build/components/InputText/InputText.stories.js.map +1 -1
- package/build/components/InputText/index.js +1 -1
- package/build/components/InputText/index.js.map +1 -1
- package/build/components/InputText/partials/InputText.Hint.js +8 -9
- package/build/components/InputText/partials/InputText.Hint.js.map +1 -1
- package/build/components/InputText/partials/InputText.IconState.js +10 -8
- package/build/components/InputText/partials/InputText.IconState.js.map +1 -1
- package/build/components/InputText/partials/InputText.Label.js +13 -15
- package/build/components/InputText/partials/InputText.Label.js.map +1 -1
- package/build/components/InputText/partials/index.js +3 -3
- package/build/components/InputText/partials/index.js.map +1 -1
- package/build/components/Menu/Menu.Option.js +14 -15
- package/build/components/Menu/Menu.Option.js.map +1 -1
- package/build/components/Menu/Menu.js +30 -41
- package/build/components/Menu/Menu.js.map +1 -1
- package/build/components/Menu/Menu.stories.js +9 -23
- package/build/components/Menu/Menu.stories.js.map +1 -1
- package/build/components/Menu/index.js +1 -1
- package/build/components/Menu/index.js.map +1 -1
- package/build/components/Modal/Modal.constants.js +2 -4
- package/build/components/Modal/Modal.constants.js.map +1 -1
- package/build/components/Modal/Modal.js +70 -103
- package/build/components/Modal/Modal.js.map +1 -1
- package/build/components/Modal/Modal.stories.js +15 -36
- package/build/components/Modal/Modal.stories.js.map +1 -1
- package/build/components/Modal/index.js +2 -2
- package/build/components/Modal/index.js.map +1 -1
- package/build/components/Notification/Notification.js +24 -26
- package/build/components/Notification/Notification.js.map +1 -1
- package/build/components/Notification/Notification.stories.js +14 -17
- package/build/components/Notification/Notification.stories.js.map +1 -1
- package/build/components/Notification/index.js +1 -1
- package/build/components/Notification/index.js.map +1 -1
- package/build/components/Progress/Progress.js +11 -15
- package/build/components/Progress/Progress.js.map +1 -1
- package/build/components/Progress/Progress.stories.js +4 -7
- package/build/components/Progress/Progress.stories.js.map +1 -1
- package/build/components/Progress/index.js +1 -1
- package/build/components/Progress/index.js.map +1 -1
- package/build/components/Slider/Slider.Item.js +17 -25
- package/build/components/Slider/Slider.Item.js.map +1 -1
- package/build/components/Slider/Slider.constants.js +2 -4
- package/build/components/Slider/Slider.constants.js.map +1 -1
- package/build/components/Slider/Slider.js +78 -130
- package/build/components/Slider/Slider.js.map +1 -1
- package/build/components/Slider/Slider.stories.js +25 -30
- package/build/components/Slider/Slider.stories.js.map +1 -1
- package/build/components/Slider/index.js +1 -1
- package/build/components/Slider/index.js.map +1 -1
- package/build/components/Table/Table.ColumnFilter.js +77 -116
- package/build/components/Table/Table.ColumnFilter.js.map +1 -1
- package/build/components/Table/Table.Filter.js +31 -41
- package/build/components/Table/Table.Filter.js.map +1 -1
- package/build/components/Table/Table.Row.js +48 -65
- package/build/components/Table/Table.Row.js.map +1 -1
- package/build/components/Table/Table.constants.js +4 -7
- package/build/components/Table/Table.constants.js.map +1 -1
- package/build/components/Table/Table.js +96 -125
- package/build/components/Table/Table.js.map +1 -1
- package/build/components/Table/Table.stories.js +38 -70
- package/build/components/Table/Table.stories.js.map +1 -1
- package/build/components/Table/helpers/index.js +2 -2
- package/build/components/Table/helpers/index.js.map +1 -1
- package/build/components/Table/helpers/select.js +54 -68
- package/build/components/Table/helpers/select.js.map +1 -1
- package/build/components/Table/helpers/storage.js +5 -6
- package/build/components/Table/helpers/storage.js.map +1 -1
- package/build/components/Table/index.js +1 -1
- package/build/components/Table/index.js.map +1 -1
- package/build/components/Tooltip/Tooltip.js +63 -84
- package/build/components/Tooltip/Tooltip.js.map +1 -1
- package/build/components/Tooltip/Tooltip.stories.js +87 -100
- package/build/components/Tooltip/Tooltip.stories.js.map +1 -1
- package/build/components/Tooltip/helpers/index.js +1 -1
- package/build/components/Tooltip/helpers/index.js.map +1 -1
- package/build/components/Tooltip/helpers/isPressableInstance.js +6 -5
- package/build/components/Tooltip/helpers/isPressableInstance.js.map +1 -1
- package/build/components/Tooltip/index.js +1 -1
- package/build/components/Tooltip/index.js.map +1 -1
- package/build/components/components.customElements.js.map +1 -1
- package/build/components/index.js +17 -17
- package/build/components/index.js.map +1 -1
- package/build/helpers/CustomElement.js +9 -29
- package/build/helpers/CustomElement.js.map +1 -1
- package/build/helpers/getIconState.js +6 -5
- package/build/helpers/getIconState.js.map +1 -1
- package/build/helpers/getInputDateErrors.js +10 -10
- package/build/helpers/getInputDateErrors.js.map +1 -1
- package/build/helpers/getInputErrors.js +25 -28
- package/build/helpers/getInputErrors.js.map +1 -1
- package/build/helpers/getInputPhoneErrors.js +11 -13
- package/build/helpers/getInputPhoneErrors.js.map +1 -1
- package/build/helpers/getNavigator.js +10 -10
- package/build/helpers/getNavigator.js.map +1 -1
- package/build/helpers/index.js +9 -9
- package/build/helpers/index.js.map +1 -1
- package/build/helpers/isJest.js +4 -6
- package/build/helpers/isJest.js.map +1 -1
- package/build/helpers/isPlaywright.js +3 -4
- package/build/helpers/isPlaywright.js.map +1 -1
- package/build/helpers/isValidDate.js +21 -38
- package/build/helpers/isValidDate.js.map +1 -1
- package/build/helpers/isValidEmail.js +3 -3
- package/build/helpers/isValidEmail.js.map +1 -1
- package/build/helpers/isValidPhone.js +9 -8
- package/build/helpers/isValidPhone.js.map +1 -1
- package/build/helpers/styles.js +3 -7
- package/build/helpers/styles.js.map +1 -1
- package/build/hooks/helpers/getResolution.js +7 -8
- package/build/hooks/helpers/getResolution.js.map +1 -1
- package/build/hooks/helpers/index.js +2 -2
- package/build/hooks/helpers/index.js.map +1 -1
- package/build/hooks/helpers/sanitizePx.js +1 -3
- package/build/hooks/helpers/sanitizePx.js.map +1 -1
- package/build/hooks/index.js +1 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/useDevice.js +21 -39
- package/build/hooks/useDevice.js.map +1 -1
- package/build/hooks/useDevice.stories.js +7 -16
- package/build/hooks/useDevice.stories.js.map +1 -1
- package/build/index.js +5 -5
- package/build/index.js.map +1 -1
- package/build/primitives/Checkbox/Checkbox.js +18 -18
- package/build/primitives/Checkbox/Checkbox.js.map +1 -1
- package/build/primitives/Checkbox/Checkbox.stories.js +8 -20
- package/build/primitives/Checkbox/Checkbox.stories.js.map +1 -1
- package/build/primitives/Checkbox/index.js +1 -1
- 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 +34 -41
- package/build/primitives/Icon/Icon.js.map +1 -1
- package/build/primitives/Icon/Icon.stories.js +8 -10
- package/build/primitives/Icon/Icon.stories.js.map +1 -1
- package/build/primitives/Icon/index.js +2 -2
- package/build/primitives/Icon/index.js.map +1 -1
- package/build/primitives/Input/Input.js +49 -63
- package/build/primitives/Input/Input.js.map +1 -1
- package/build/primitives/Input/Input.stories.js +14 -29
- package/build/primitives/Input/Input.stories.js.map +1 -1
- package/build/primitives/Input/helpers/index.js +1 -1
- package/build/primitives/Input/helpers/index.js.map +1 -1
- package/build/primitives/Input/helpers/parseValue.js +5 -5
- package/build/primitives/Input/helpers/parseValue.js.map +1 -1
- package/build/primitives/Input/index.js +1 -1
- package/build/primitives/Input/index.js.map +1 -1
- package/build/primitives/Layer/Layer.js +79 -93
- package/build/primitives/Layer/Layer.js.map +1 -1
- package/build/primitives/Layer/Layer.stories.js +10 -13
- package/build/primitives/Layer/Layer.stories.js.map +1 -1
- package/build/primitives/Layer/LayerContent.js +5 -3
- package/build/primitives/Layer/LayerContent.js.map +1 -1
- package/build/primitives/Layer/helpers/getElementLayout.js +18 -15
- package/build/primitives/Layer/helpers/getElementLayout.js.map +1 -1
- package/build/primitives/Layer/helpers/getLayerPosition.js +66 -69
- package/build/primitives/Layer/helpers/getLayerPosition.js.map +1 -1
- package/build/primitives/Layer/helpers/getModalParent.js +10 -9
- package/build/primitives/Layer/helpers/getModalParent.js.map +1 -1
- package/build/primitives/Layer/helpers/getScrollParent.js +4 -3
- package/build/primitives/Layer/helpers/getScrollParent.js.map +1 -1
- package/build/primitives/Layer/helpers/index.js +5 -5
- package/build/primitives/Layer/helpers/index.js.map +1 -1
- package/build/primitives/Layer/helpers/isComponentFixed.js +8 -19
- package/build/primitives/Layer/helpers/isComponentFixed.js.map +1 -1
- package/build/primitives/Layer/index.js +2 -2
- package/build/primitives/Layer/index.js.map +1 -1
- package/build/primitives/Pressable/Pressable.constants.js +1 -2
- package/build/primitives/Pressable/Pressable.constants.js.map +1 -1
- package/build/primitives/Pressable/Pressable.js +34 -44
- package/build/primitives/Pressable/Pressable.js.map +1 -1
- package/build/primitives/Pressable/Pressable.stories.js +5 -8
- package/build/primitives/Pressable/Pressable.stories.js.map +1 -1
- package/build/primitives/Pressable/index.js +1 -1
- package/build/primitives/Pressable/index.js.map +1 -1
- package/build/primitives/Primitive/Primitive.constants.js +4 -8
- package/build/primitives/Primitive/Primitive.constants.js.map +1 -1
- package/build/primitives/Primitive/Primitive.js +20 -28
- package/build/primitives/Primitive/Primitive.js.map +1 -1
- package/build/primitives/Primitive/Primitive.stories.js +7 -10
- package/build/primitives/Primitive/Primitive.stories.js.map +1 -1
- package/build/primitives/Primitive/helpers/getProps.js +8 -17
- package/build/primitives/Primitive/helpers/getProps.js.map +1 -1
- package/build/primitives/Primitive/helpers/getTag.js +4 -4
- package/build/primitives/Primitive/helpers/getTag.js.map +1 -1
- package/build/primitives/Primitive/helpers/index.js +2 -2
- package/build/primitives/Primitive/helpers/index.js.map +1 -1
- package/build/primitives/Primitive/index.js +1 -1
- package/build/primitives/Primitive/index.js.map +1 -1
- package/build/primitives/Radio/Radio.js +11 -15
- package/build/primitives/Radio/Radio.js.map +1 -1
- package/build/primitives/Radio/Radio.stories.js +8 -20
- package/build/primitives/Radio/Radio.stories.js.map +1 -1
- package/build/primitives/Radio/index.js +1 -1
- package/build/primitives/Radio/index.js.map +1 -1
- package/build/primitives/ScrollView/ScrollView.js +73 -96
- package/build/primitives/ScrollView/ScrollView.js.map +1 -1
- package/build/primitives/ScrollView/ScrollView.stories.js +12 -17
- package/build/primitives/ScrollView/ScrollView.stories.js.map +1 -1
- package/build/primitives/ScrollView/index.js +1 -1
- package/build/primitives/ScrollView/index.js.map +1 -1
- package/build/primitives/Select/Select.js +44 -54
- package/build/primitives/Select/Select.js.map +1 -1
- package/build/primitives/Select/Select.stories.js +14 -29
- package/build/primitives/Select/Select.stories.js.map +1 -1
- package/build/primitives/Select/index.js +1 -1
- package/build/primitives/Select/index.js.map +1 -1
- package/build/primitives/Switch/Switch.js +14 -16
- package/build/primitives/Switch/Switch.js.map +1 -1
- package/build/primitives/Switch/Switch.stories.js +8 -20
- package/build/primitives/Switch/Switch.stories.js.map +1 -1
- package/build/primitives/Switch/index.js +1 -1
- package/build/primitives/Switch/index.js.map +1 -1
- package/build/primitives/Text/Text.js +43 -55
- package/build/primitives/Text/Text.js.map +1 -1
- package/build/primitives/Text/Text.stories.js +8 -10
- package/build/primitives/Text/Text.stories.js.map +1 -1
- package/build/primitives/Text/helpers/color.js +13 -12
- package/build/primitives/Text/helpers/color.js.map +1 -1
- package/build/primitives/Text/helpers/index.js +2 -2
- package/build/primitives/Text/helpers/index.js.map +1 -1
- package/build/primitives/Text/helpers/parseMarkdown.js +41 -54
- package/build/primitives/Text/helpers/parseMarkdown.js.map +1 -1
- package/build/primitives/Text/index.js +1 -1
- package/build/primitives/Text/index.js.map +1 -1
- package/build/primitives/View/View.js +16 -25
- package/build/primitives/View/View.js.map +1 -1
- package/build/primitives/View/View.stories.js +7 -10
- package/build/primitives/View/View.stories.js.map +1 -1
- package/build/primitives/View/index.js +1 -1
- package/build/primitives/View/index.js.map +1 -1
- package/build/primitives/index.js +12 -12
- package/build/primitives/index.js.map +1 -1
- package/build/primitives/primitives.customElements.js.map +1 -1
- package/build/theme/helpers/camelcase.js +3 -5
- package/build/theme/helpers/camelcase.js.map +1 -1
- package/build/theme/helpers/index.js +2 -2
- package/build/theme/helpers/index.js.map +1 -1
- package/build/theme/helpers/palette.js +18 -32
- package/build/theme/helpers/palette.js.map +1 -1
- package/build/theme/index.js +2 -2
- package/build/theme/index.js.map +1 -1
- package/build/theme/theme.constants.js +16 -23
- package/build/theme/theme.constants.js.map +1 -1
- package/build/theme/theme.js +61 -81
- package/build/theme/theme.js.map +1 -1
- package/build/theme/theme.stories.js +25 -38
- package/build/theme/theme.stories.js.map +1 -1
- package/package.json +18 -15
|
@@ -1,37 +1,25 @@
|
|
|
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
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = exports.Story = void 0;
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
8
|
var _Input = require("./Input");
|
|
10
|
-
function _getRequireWildcardCache(
|
|
11
|
-
function _interopRequireWildcard(
|
|
12
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
13
|
-
|
|
14
|
-
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."); }
|
|
15
|
-
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); }
|
|
16
|
-
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; }
|
|
17
|
-
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; } }
|
|
18
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
-
var _default = {
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
12
|
+
var _default = exports.default = {
|
|
20
13
|
title: 'Primitives'
|
|
21
14
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
-
value = _useState2[0],
|
|
27
|
-
setValue = _useState2[1];
|
|
28
|
-
var handleChange = function handleChange(next) {
|
|
29
|
-
var _console;
|
|
15
|
+
const Story = props => {
|
|
16
|
+
const [value, setValue] = (0, _react.useState)();
|
|
17
|
+
const handleChange = function (next) {
|
|
30
18
|
setValue(next);
|
|
31
19
|
for (var _len = arguments.length, others = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
32
20
|
others[_key - 1] = arguments[_key];
|
|
33
21
|
}
|
|
34
|
-
|
|
22
|
+
console.log('<Input>::onChange', next, ...others);
|
|
35
23
|
};
|
|
36
24
|
return /*#__PURE__*/_react.default.createElement(_Input.Input, _extends({}, props, {
|
|
37
25
|
value: value,
|
|
@@ -49,26 +37,23 @@ Story.args = {
|
|
|
49
37
|
name: 'Input',
|
|
50
38
|
placeholder: 'placeholder',
|
|
51
39
|
type: 'text',
|
|
52
|
-
onEnter: function
|
|
53
|
-
var _console2;
|
|
40
|
+
onEnter: function () {
|
|
54
41
|
for (var _len2 = arguments.length, props = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
55
42
|
props[_key2] = arguments[_key2];
|
|
56
43
|
}
|
|
57
|
-
return
|
|
44
|
+
return console.log('<Select>::onEnter', ...props);
|
|
58
45
|
},
|
|
59
|
-
onError: function
|
|
60
|
-
var _console3;
|
|
46
|
+
onError: function () {
|
|
61
47
|
for (var _len3 = arguments.length, props = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
62
48
|
props[_key3] = arguments[_key3];
|
|
63
49
|
}
|
|
64
|
-
return
|
|
50
|
+
return console.log('<Select>::onError', ...props);
|
|
65
51
|
},
|
|
66
|
-
onLeave: function
|
|
67
|
-
var _console4;
|
|
52
|
+
onLeave: function () {
|
|
68
53
|
for (var _len4 = arguments.length, props = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
69
54
|
props[_key4] = arguments[_key4];
|
|
70
55
|
}
|
|
71
|
-
return
|
|
56
|
+
return console.log('<Select>::onLeave', ...props);
|
|
72
57
|
},
|
|
73
58
|
// inherited properties
|
|
74
59
|
testId: 'test-story',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.stories.js","names":["title","Story","props","
|
|
1
|
+
{"version":3,"file":"Input.stories.js","names":["_react","_interopRequireWildcard","require","_Input","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","_default","exports","title","Story","props","value","setValue","useState","handleChange","next","_len","others","Array","_key","console","log","createElement","Input","onChange","storyName","args","autoResize","disabled","max","min","multiLine","name","placeholder","type","onEnter","_len2","_key2","onError","_len3","_key3","onLeave","_len4","_key4","testId","style","argTypes","options","control","defaultValue"],"sources":["../../../src/primitives/Input/Input.stories.jsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport { Input } from './Input';\n\nexport default { title: 'Primitives' };\n\nexport const Story = (props) => {\n const [value, setValue] = useState();\n\n const handleChange = (next, ...others) => {\n setValue(next);\n console.log('<Input>::onChange', next, ...others);\n };\n\n return <Input {...props} value={value} onChange={handleChange} />;\n};\n\nStory.storyName = 'Input';\n\nStory.args = {\n autoResize: false,\n disabled: false,\n max: 100,\n min: 1,\n multiLine: false,\n name: 'Input',\n placeholder: 'placeholder',\n type: 'text',\n onEnter: (...props) => console.log('<Select>::onEnter', ...props),\n onError: (...props) => console.log('<Select>::onError', ...props),\n onLeave: (...props) => console.log('<Select>::onLeave', ...props),\n // inherited properties\n testId: 'test-story',\n style: {},\n};\n\nStory.argTypes = {\n type: {\n options: ['text', 'password', 'number', 'email', 'date'],\n control: { type: 'select' },\n defaultValue: 'text',\n },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAAgC,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG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keys(_parseValue).forEach(function (key) {
|
|
|
9
9
|
if (key in exports && exports[key] === _parseValue[key]) return;
|
|
10
10
|
Object.defineProperty(exports, key, {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function
|
|
12
|
+
get: function () {
|
|
13
13
|
return _parseValue[key];
|
|
14
14
|
}
|
|
15
15
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/primitives/Input/helpers/index.js"],"sourcesContent":["export * from './parseValue';\n"],"mappings":";;;;;AAAA;
|
|
1
|
+
{"version":3,"file":"index.js","names":["_parseValue","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../../src/primitives/Input/helpers/index.js"],"sourcesContent":["export * from './parseValue';\n"],"mappings":";;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.parseValue = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
const EMOJI_REGEX = /[\p{Emoji_Presentation}\p{Extended_Pictographic}]/gu;
|
|
8
|
+
const parseValue = function (value, type) {
|
|
9
|
+
let {
|
|
10
|
+
trimSpaces = false
|
|
11
|
+
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
12
12
|
return value && value.toString().trim().length > 0 ? type !== 'number' ? (trimSpaces ? value.trim() : value).toString().replace(EMOJI_REGEX, '') : !isNaN(value) ? parseFloat(value, 10) : undefined : undefined;
|
|
13
13
|
};
|
|
14
14
|
exports.parseValue = parseValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseValue.js","names":["EMOJI_REGEX","parseValue","value","type","trimSpaces","
|
|
1
|
+
{"version":3,"file":"parseValue.js","names":["EMOJI_REGEX","parseValue","value","type","trimSpaces","arguments","length","undefined","toString","trim","replace","isNaN","parseFloat","exports"],"sources":["../../../../src/primitives/Input/helpers/parseValue.js"],"sourcesContent":["const EMOJI_REGEX = /[\\p{Emoji_Presentation}\\p{Extended_Pictographic}]/gu;\n\nexport const parseValue = (value, type, { trimSpaces = false } = {}) =>\n value && value.toString().trim().length > 0\n ? type !== 'number'\n ? (trimSpaces ? value.trim() : value).toString().replace(EMOJI_REGEX, '')\n : !isNaN(value)\n ? parseFloat(value, 10)\n : undefined\n : undefined;\n"],"mappings":";;;;;;AAAA,MAAMA,WAAW,GAAG,qDAAqD;AAElE,MAAMC,UAAU,GAAG,SAAAA,CAACC,KAAK,EAAEC,IAAI;EAAA,IAAE;IAAEC,UAAU,GAAG;EAAM,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,OACjEH,KAAK,IAAIA,KAAK,CAACM,QAAQ,CAAC,CAAC,CAACC,IAAI,CAAC,CAAC,CAACH,MAAM,GAAG,CAAC,GACvCH,IAAI,KAAK,QAAQ,GACf,CAACC,UAAU,GAAGF,KAAK,CAACO,IAAI,CAAC,CAAC,GAAGP,KAAK,EAAEM,QAAQ,CAAC,CAAC,CAACE,OAAO,CAACV,WAAW,EAAE,EAAE,CAAC,GACvE,CAACW,KAAK,CAACT,KAAK,CAAC,GACbU,UAAU,CAACV,KAAK,EAAE,EAAE,CAAC,GACrBK,SAAS,GACXA,SAAS;AAAA;AAACM,OAAA,CAAAZ,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/primitives/Input/index.js"],"sourcesContent":["export * from './Input';\n"],"mappings":";;;;;AAAA;
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Input","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/primitives/Input/index.js"],"sourcesContent":["export * from './Input';\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -1,6 +1,5 @@
|
|
|
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
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -13,123 +12,110 @@ var _Primitive = require("../Primitive");
|
|
|
13
12
|
var _helpers2 = require("./helpers");
|
|
14
13
|
var _LayerModule = _interopRequireDefault(require("./Layer.module.css"));
|
|
15
14
|
var _LayerContent = require("./LayerContent");
|
|
16
|
-
|
|
17
|
-
function
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
_ref$tag = _ref.tag,
|
|
42
|
-
tag = _ref$tag === void 0 ? 'layer' : _ref$tag,
|
|
43
|
-
forceTop = _ref.top,
|
|
44
|
-
timestamp = _ref.timestamp,
|
|
45
|
-
visible = _ref.visible,
|
|
46
|
-
_ref$onPosition = _ref.onPosition,
|
|
47
|
-
onPosition = _ref$onPosition === void 0 ? function () {} : _ref$onPosition,
|
|
48
|
-
others = _objectWithoutProperties(_ref, _excluded);
|
|
49
|
-
var device = (0, _hooks.useDevice)();
|
|
50
|
-
var componentRef = (0, _react.useRef)();
|
|
51
|
-
var contentRef = (0, _react.useRef)();
|
|
52
|
-
var _useState = (0, _react.useState)(),
|
|
53
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
54
|
-
fixed = _useState2[0],
|
|
55
|
-
setFixed = _useState2[1];
|
|
56
|
-
var _useState3 = (0, _react.useState)(),
|
|
57
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
58
|
-
position = _useState4[0],
|
|
59
|
-
setPosition = _useState4[1];
|
|
60
|
-
(0, _react.useLayoutEffect)(function () {
|
|
61
|
-
var content = contentRef === null || contentRef === void 0 ? void 0 : contentRef.current;
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
const Layer = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
bottom: forceBottom,
|
|
21
|
+
centered,
|
|
22
|
+
fixed: propFixed,
|
|
23
|
+
forceRender = true,
|
|
24
|
+
left: forceLeft,
|
|
25
|
+
right: forceRight,
|
|
26
|
+
tag = 'layer',
|
|
27
|
+
top: forceTop,
|
|
28
|
+
timestamp,
|
|
29
|
+
visible,
|
|
30
|
+
onPosition = () => {},
|
|
31
|
+
...others
|
|
32
|
+
} = _ref;
|
|
33
|
+
const device = (0, _hooks.useDevice)();
|
|
34
|
+
const componentRef = (0, _react.useRef)();
|
|
35
|
+
const contentRef = (0, _react.useRef)();
|
|
36
|
+
const [fixed, setFixed] = (0, _react.useState)();
|
|
37
|
+
const [position, setPosition] = (0, _react.useState)();
|
|
38
|
+
(0, _react.useLayoutEffect)(() => {
|
|
39
|
+
const content = contentRef?.current;
|
|
62
40
|
if (!content || typeof ResizeObserver === 'undefined') return;
|
|
63
|
-
|
|
41
|
+
const observer = new ResizeObserver(calcPosition);
|
|
64
42
|
observer.observe(content);
|
|
65
|
-
return
|
|
66
|
-
return observer.unobserve(content);
|
|
67
|
-
};
|
|
43
|
+
return () => observer.unobserve(content);
|
|
68
44
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
45
|
}, []);
|
|
70
|
-
(0, _react.useLayoutEffect)(
|
|
71
|
-
return calcPosition();
|
|
72
|
-
},
|
|
46
|
+
(0, _react.useLayoutEffect)(() => calcPosition(),
|
|
73
47
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
74
48
|
[centered, device, forceBottom, forceLeft, forceRight, forceTop, timestamp, visible]);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
49
|
+
const calcPosition = () => {
|
|
50
|
+
const {
|
|
51
|
+
current: {
|
|
52
|
+
firstChild: componentEl
|
|
53
|
+
} = {}
|
|
54
|
+
} = componentRef;
|
|
55
|
+
const {
|
|
56
|
+
current: contentEl
|
|
57
|
+
} = contentRef;
|
|
81
58
|
if (!componentEl || !contentEl) return setPosition();
|
|
82
|
-
|
|
83
|
-
|
|
59
|
+
const componentLayout = {
|
|
60
|
+
...(0, _helpers2.getElementLayout)(componentEl),
|
|
61
|
+
scrollTop: (0, _helpers2.getScrollParent)(componentEl)?.scrollTop
|
|
62
|
+
};
|
|
63
|
+
const contentLayout = (0, _helpers2.getElementLayout)(contentEl);
|
|
64
|
+
const modal = (0, _helpers2.getModalParent)(componentEl);
|
|
65
|
+
const {
|
|
66
|
+
left = 0,
|
|
67
|
+
top = 0,
|
|
68
|
+
orientation = {}
|
|
69
|
+
} = (0, _helpers2.getLayerPosition)(componentLayout, contentLayout, device, modal, {
|
|
70
|
+
centered,
|
|
71
|
+
forceBottom,
|
|
72
|
+
forceLeft,
|
|
73
|
+
forceRight,
|
|
74
|
+
forceTop
|
|
84
75
|
});
|
|
85
|
-
var contentLayout = (0, _helpers2.getElementLayout)(contentEl);
|
|
86
|
-
var modal = (0, _helpers2.getModalParent)(componentEl);
|
|
87
|
-
var _getLayerPosition = (0, _helpers2.getLayerPosition)(componentLayout, contentLayout, device, modal, {
|
|
88
|
-
centered: centered,
|
|
89
|
-
forceBottom: forceBottom,
|
|
90
|
-
forceLeft: forceLeft,
|
|
91
|
-
forceRight: forceRight,
|
|
92
|
-
forceTop: forceTop
|
|
93
|
-
}),
|
|
94
|
-
_getLayerPosition$lef = _getLayerPosition.left,
|
|
95
|
-
left = _getLayerPosition$lef === void 0 ? 0 : _getLayerPosition$lef,
|
|
96
|
-
_getLayerPosition$top = _getLayerPosition.top,
|
|
97
|
-
top = _getLayerPosition$top === void 0 ? 0 : _getLayerPosition$top,
|
|
98
|
-
_getLayerPosition$ori = _getLayerPosition.orientation,
|
|
99
|
-
orientation = _getLayerPosition$ori === void 0 ? {} : _getLayerPosition$ori;
|
|
100
76
|
setFixed(propFixed || (0, _helpers2.isComponentFixed)(componentEl));
|
|
101
77
|
setPosition({
|
|
102
|
-
left:
|
|
103
|
-
top:
|
|
78
|
+
left: `${left}px`,
|
|
79
|
+
top: `${top}px`
|
|
104
80
|
});
|
|
105
81
|
onPosition(orientation);
|
|
106
82
|
};
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
83
|
+
const children = _react.default.Children.map(others.children || [], child => child);
|
|
84
|
+
const {
|
|
85
|
+
className,
|
|
86
|
+
style: contentStyle
|
|
87
|
+
} = others;
|
|
88
|
+
const createWrapper = className || contentStyle;
|
|
113
89
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Primitive.Primitive, {
|
|
114
90
|
ref: componentRef,
|
|
115
91
|
role: others.role,
|
|
116
92
|
tag: tag,
|
|
117
93
|
className: _LayerModule.default.container,
|
|
118
94
|
testId: others.testId
|
|
119
|
-
}, children.find(
|
|
120
|
-
|
|
95
|
+
}, children.find(_ref2 => {
|
|
96
|
+
let {
|
|
97
|
+
type: {
|
|
98
|
+
name
|
|
99
|
+
}
|
|
100
|
+
} = _ref2;
|
|
121
101
|
return name !== _LayerContent.LayerContent.name;
|
|
122
102
|
})), (forceRender || visible) && /*#__PURE__*/_react.default.createElement(_Primitive.Primitive, {
|
|
123
103
|
ref: contentRef,
|
|
124
|
-
role: others.role ?
|
|
125
|
-
tag:
|
|
104
|
+
role: others.role ? `${others.role}-content` : undefined,
|
|
105
|
+
tag: `${tag}-content`,
|
|
126
106
|
className: (0, _helpers.styles)(_LayerModule.default.layer, fixed && _LayerModule.default.fixed, !visible && _LayerModule.default.hidden),
|
|
127
|
-
style:
|
|
107
|
+
style: {
|
|
108
|
+
...position
|
|
109
|
+
}
|
|
128
110
|
}, /*#__PURE__*/_react.default.createElement(createWrapper ? 'div' : _react.default.Fragment, createWrapper ? {
|
|
129
|
-
className
|
|
111
|
+
className,
|
|
130
112
|
style: contentStyle
|
|
131
|
-
} : undefined, children
|
|
132
|
-
|
|
113
|
+
} : undefined, children?.find(_ref3 => {
|
|
114
|
+
let {
|
|
115
|
+
type: {
|
|
116
|
+
name
|
|
117
|
+
}
|
|
118
|
+
} = _ref3;
|
|
133
119
|
return name === _LayerContent.LayerContent.name;
|
|
134
120
|
}))));
|
|
135
121
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layer.js","names":["Layer","forceBottom","bottom","centered","propFixed","fixed","forceRender","forceLeft","left","forceRight","right","tag","forceTop","top","timestamp","visible","onPosition","others","device","useDevice","componentRef","useRef","contentRef","useState","setFixed","position","setPosition","useLayoutEffect","content","current","ResizeObserver","observer","calcPosition","observe","unobserve","componentEl","firstChild","contentEl","componentLayout","getElementLayout","scrollTop","getScrollParent","contentLayout","modal","getModalParent","getLayerPosition","orientation","isComponentFixed","children","React","Children","map","child","className","contentStyle","style","createWrapper","role","container","testId","find","name","type","LayerContent","undefined","styles","layer","hidden","createElement","Fragment","displayName","propTypes","PropTypes","bool","node","number","string","func"],"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 { Primitive } from '../Primitive';\nimport { getElementLayout, getLayerPosition, getModalParent, getScrollParent, isComponentFixed } from './helpers';\nimport style from './Layer.module.css';\nimport { LayerContent } from './LayerContent';\n\nconst Layer = ({\n bottom: forceBottom,\n centered,\n fixed: propFixed,\n forceRender = true,\n left: forceLeft,\n right: forceRight,\n tag = 'layer',\n top: forceTop,\n timestamp,\n visible,\n onPosition = () => {},\n ...others\n}) => {\n const device = useDevice();\n const componentRef = useRef();\n const contentRef = useRef();\n\n const [fixed, setFixed] = useState();\n const [position, setPosition] = useState();\n\n useLayoutEffect(() => {\n const content = contentRef?.current;\n if (!content || typeof ResizeObserver === 'undefined') return;\n\n const observer = new ResizeObserver(calcPosition);\n observer.observe(content);\n\n return () => observer.unobserve(content);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useLayoutEffect(\n () => calcPosition(),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [centered, device, forceBottom, forceLeft, forceRight, forceTop, timestamp, visible],\n );\n\n const calcPosition = () => {\n const { current: { firstChild: componentEl } = {} } = componentRef;\n const { current: contentEl } = contentRef;\n\n if (!componentEl || !contentEl) return setPosition();\n\n const componentLayout = { ...getElementLayout(componentEl), scrollTop: getScrollParent(componentEl)?.scrollTop };\n const contentLayout = getElementLayout(contentEl);\n const modal = getModalParent(componentEl);\n const {\n left = 0,\n top = 0,\n orientation = {},\n } = getLayerPosition(componentLayout, contentLayout, device, modal, {\n centered,\n forceBottom,\n forceLeft,\n forceRight,\n forceTop,\n });\n\n setFixed(propFixed || isComponentFixed(componentEl));\n setPosition({ left: `${left}px`, top: `${top}px` });\n onPosition(orientation);\n };\n\n const children = React.Children.map(others.children || [], (child) => child);\n const { className, style: contentStyle } = others;\n const createWrapper = className || contentStyle;\n\n return (\n <>\n <Primitive ref={componentRef} role={others.role} tag={tag} className={style.container} testId={others.testId}>\n {children.find(({ type: { name } }) => name !== LayerContent.name)}\n </Primitive>\n\n {(forceRender || visible) && (\n <Primitive\n ref={contentRef}\n role={others.role ? `${others.role}-content` : undefined}\n tag={`${tag}-content`}\n className={styles(style.layer, fixed && style.fixed, !visible && style.hidden)}\n style={{ ...position }}\n >\n {React.createElement(\n createWrapper ? 'div' : React.Fragment,\n createWrapper ? { className, style: contentStyle } : undefined,\n children?.find(({ type: { name } }) => name === LayerContent.name),\n )}\n </Primitive>\n )}\n </>\n );\n};\n\nLayer.displayName = 'Primitive:Layer';\n\nLayer.propTypes = {\n bottom: PropTypes.bool,\n centered: PropTypes.bool,\n children: PropTypes.node,\n fixed: PropTypes.bool,\n forceRender: PropTypes.bool,\n left: PropTypes.bool,\n right: PropTypes.bool,\n timestamp: PropTypes.number,\n tag: PropTypes.string,\n top: PropTypes.bool,\n visible: PropTypes.bool,\n onPosition: PropTypes.func,\n};\n\nexport { Layer };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;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,OAaL;EAAA,IAZIC,WAAW,QAAnBC,MAAM;IACNC,QAAQ,QAARA,QAAQ;IACDC,SAAS,QAAhBC,KAAK;IAAA,wBACLC,WAAW;IAAXA,WAAW,iCAAG,IAAI;IACZC,SAAS,QAAfC,IAAI;IACGC,UAAU,QAAjBC,KAAK;IAAA,gBACLC,GAAG;IAAHA,GAAG,yBAAG,OAAO;IACRC,QAAQ,QAAbC,GAAG;IACHC,SAAS,QAATA,SAAS;IACTC,OAAO,QAAPA,OAAO;IAAA,uBACPC,UAAU;IAAVA,UAAU,gCAAG,YAAM,CAAC,CAAC;IAClBC,MAAM;EAET,IAAMC,MAAM,GAAG,IAAAC,gBAAS,GAAE;EAC1B,IAAMC,YAAY,GAAG,IAAAC,aAAM,GAAE;EAC7B,IAAMC,UAAU,GAAG,IAAAD,aAAM,GAAE;EAE3B,gBAA0B,IAAAE,eAAQ,GAAE;IAAA;IAA7BlB,KAAK;IAAEmB,QAAQ;EACtB,iBAAgC,IAAAD,eAAQ,GAAE;IAAA;IAAnCE,QAAQ;IAAEC,WAAW;EAE5B,IAAAC,sBAAe,EAAC,YAAM;IACpB,IAAMC,OAAO,GAAGN,UAAU,aAAVA,U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M,EAACV,oBAAK,CAACW,KAAK,EAAE7D,KAAK,IAAIkD,oBAAK,CAAClD,KAAK,EAAE,CAACU,OAAO,IAAIwC,oBAAK,CAACY,MAAM,CAAE;IAC/E,KAAK,oBAAO1C,QAAQ;EAAG,gBAEtBwB,cAAK,CAACmB,aAAa,CAClBZ,aAAa,GAAG,KAAK,GAAGP,cAAK,CAACoB,QAAQ,EACtCb,aAAa,GAAG;IAAEH,SAAS,EAATA,SAAS;IAAEE,KAAK,EAAED;EAAa,CAAC,GAAGU,SAAS,EAC9DhB,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEY,IAAI,CAAC;IAAA,IAAWC,IAAI,SAAZC,IAAI,CAAID,IAAI;IAAA,OAASA,IAAI,KAAKE,0BAAY,CAACF,IAAI;EAAA,EAAC,CACnE,CAEJ,CACA;AAEP,CAAC;AAAC;AAEF7D,KAAK,CAACsE,WAAW,GAAG,iBAAiB;AAErCtE,KAAK,CAACuE,SAAS,GAAG;EAChBrE,MAAM,EAAEsE,kBAAS,CAACC,IAAI;EACtBtE,QAAQ,EAAEqE,kBAAS,CAACC,IAAI;EACxBzB,QAAQ,EAAEwB,kBAAS,CAACE,IAAI;EACxBrE,KAAK,EAAEmE,kBAAS,CAACC,IAAI;EACrBnE,WAAW,EAAEkE,kBAAS,CAACC,IAAI;EAC3BjE,IAAI,EAAEgE,kBAAS,CAACC,IAAI;EACpB/D,KAAK,EAAE8D,kBAAS,CAACC,IAAI;EACrB3D,SAAS,EAAE0D,kBAAS,CAACG,MAAM;EAC3BhE,GAAG,EAAE6D,kBAAS,CAACI,MAAM;EACrB/D,GAAG,EAAE2D,kBAAS,CAACC,IAAI;EACnB1D,OAAO,EAAEyD,kBAAS,CAACC,IAAI;EACvBzD,UAAU,EAAEwD,kBAAS,CAACK;AACxB,CAAC"}
|
|
1
|
+
{"version":3,"file":"Layer.js","names":["_propTypes","_interopRequireDefault","require","_react","_interopRequireWildcard","_helpers","_hooks","_Primitive","_helpers2","_LayerModule","_LayerContent","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Layer","_ref","bottom","forceBottom","centered","fixed","propFixed","forceRender","left","forceLeft","right","forceRight","tag","top","forceTop","timestamp","visible","onPosition","others","device","useDevice","componentRef","useRef","contentRef","setFixed","useState","position","setPosition","useLayoutEffect","content","current","ResizeObserver","observer","calcPosition","observe","unobserve","firstChild","componentEl","contentEl","componentLayout","getElementLayout","scrollTop","getScrollParent","contentLayout","modal","getModalParent","orientation","getLayerPosition","isComponentFixed","children","React","Children","map","child","className","style","contentStyle","createWrapper","createElement","Fragment","Primitive","ref","role","container","testId","find","_ref2","type","name","LayerContent","undefined","styles","layer","hidden","_ref3","exports","displayName","propTypes","PropTypes","bool","node","number","string","func"],"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 { Primitive } from '../Primitive';\nimport { getElementLayout, getLayerPosition, getModalParent, getScrollParent, isComponentFixed } from './helpers';\nimport style from './Layer.module.css';\nimport { LayerContent } from './LayerContent';\n\nconst Layer = ({\n bottom: forceBottom,\n centered,\n fixed: propFixed,\n forceRender = true,\n left: forceLeft,\n right: forceRight,\n tag = 'layer',\n top: forceTop,\n timestamp,\n visible,\n onPosition = () => {},\n ...others\n}) => {\n const device = useDevice();\n const componentRef = useRef();\n const contentRef = useRef();\n\n const [fixed, setFixed] = useState();\n const [position, setPosition] = useState();\n\n useLayoutEffect(() => {\n const content = contentRef?.current;\n if (!content || typeof ResizeObserver === 'undefined') return;\n\n const observer = new ResizeObserver(calcPosition);\n observer.observe(content);\n\n return () => observer.unobserve(content);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useLayoutEffect(\n () => calcPosition(),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [centered, device, forceBottom, forceLeft, forceRight, forceTop, timestamp, visible],\n );\n\n const calcPosition = () => {\n const { current: { firstChild: componentEl } = {} } = componentRef;\n const { current: contentEl } = contentRef;\n\n if (!componentEl || !contentEl) return setPosition();\n\n const componentLayout = { ...getElementLayout(componentEl), scrollTop: getScrollParent(componentEl)?.scrollTop };\n const contentLayout = getElementLayout(contentEl);\n const modal = getModalParent(componentEl);\n const {\n left = 0,\n top = 0,\n orientation = {},\n } = getLayerPosition(componentLayout, contentLayout, device, modal, {\n centered,\n forceBottom,\n forceLeft,\n forceRight,\n forceTop,\n });\n\n setFixed(propFixed || isComponentFixed(componentEl));\n setPosition({ left: `${left}px`, top: `${top}px` });\n onPosition(orientation);\n };\n\n const children = React.Children.map(others.children || [], (child) => child);\n const { className, style: contentStyle } = others;\n const createWrapper = className || contentStyle;\n\n return (\n <>\n <Primitive ref={componentRef} role={others.role} tag={tag} className={style.container} testId={others.testId}>\n {children.find(({ type: { name } }) => name !== LayerContent.name)}\n </Primitive>\n\n {(forceRender || visible) && (\n <Primitive\n ref={contentRef}\n role={others.role ? `${others.role}-content` : undefined}\n tag={`${tag}-content`}\n className={styles(style.layer, fixed && style.fixed, !visible && style.hidden)}\n style={{ ...position }}\n >\n {React.createElement(\n createWrapper ? 'div' : React.Fragment,\n createWrapper ? { className, style: contentStyle } : undefined,\n children?.find(({ type: { name } }) => name === LayerContent.name),\n )}\n </Primitive>\n )}\n </>\n );\n};\n\nLayer.displayName = 'Primitive:Layer';\n\nLayer.propTypes = {\n bottom: PropTypes.bool,\n centered: PropTypes.bool,\n children: PropTypes.node,\n fixed: PropTypes.bool,\n forceRender: PropTypes.bool,\n left: PropTypes.bool,\n right: PropTypes.bool,\n timestamp: PropTypes.number,\n tag: PropTypes.string,\n top: PropTypes.bool,\n visible: PropTypes.bool,\n onPosition: PropTypes.func,\n};\n\nexport { Layer };\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;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,KAAK,GAAGP,cAAK,CAACS,QAAQ,EACtCF,aAAa,GAAG;IAAEH,SAAS;IAAEC,KAAK,EAAEC;EAAa,CAAC,GAAGc,SAAS,EAC9DrB,QAAQ,EAAEgB,IAAI,CAACS,KAAA;IAAA,IAAC;MAAEP,IAAI,EAAE;QAAEC;MAAK;IAAE,CAAC,GAAAM,KAAA;IAAA,OAAKN,IAAI,KAAKC,0BAAY,CAACD,IAAI;EAAA,EACnE,CACS,CAEb,CAAC;AAEP,CAAC;AAACO,OAAA,CAAA3E,KAAA,GAAAA,KAAA;AAEFA,KAAK,CAAC4E,WAAW,GAAG,iBAAiB;AAErC5E,KAAK,CAAC6E,SAAS,GAAG;EAChB3E,MAAM,EAAE4E,kBAAS,CAACC,IAAI;EACtB3E,QAAQ,EAAE0E,kBAAS,CAACC,IAAI;EACxB9B,QAAQ,EAAE6B,kBAAS,CAACE,IAAI;EACxB3E,KAAK,EAAEyE,kBAAS,CAACC,IAAI;EACrBxE,WAAW,EAAEuE,kBAAS,CAACC,IAAI;EAC3BvE,IAAI,EAAEsE,kBAAS,CAACC,IAAI;EACpBrE,KAAK,EAAEoE,kBAAS,CAACC,IAAI;EACrBhE,SAAS,EAAE+D,kBAAS,CAACG,MAAM;EAC3BrE,GAAG,EAAEkE,kBAAS,CAACI,MAAM;EACrBrE,GAAG,EAAEiE,kBAAS,CAACC,IAAI;EACnB/D,OAAO,EAAE8D,kBAAS,CAACC,IAAI;EACvB9D,UAAU,EAAE6D,kBAAS,CAACK;AACxB,CAAC","ignoreList":[]}
|
|
@@ -8,21 +8,18 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _ = require("../../");
|
|
9
9
|
var _Layer = require("./Layer");
|
|
10
10
|
var _LayerContent = require("./LayerContent");
|
|
11
|
-
function _interopRequireDefault(
|
|
12
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
13
|
-
var _default = {
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
13
|
+
var _default = exports.default = {
|
|
14
14
|
title: 'Primitives'
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
}, "Parent element"), /*#__PURE__*/_react.default.createElement(_LayerContent.LayerContent, null, /*#__PURE__*/_react.default.createElement("span", null, "Lorem ipsum, dolor sit amet consectetur adipisicing elit.")));
|
|
25
|
-
};
|
|
16
|
+
const Story = props => /*#__PURE__*/_react.default.createElement(_Layer.Layer, _extends({}, props, {
|
|
17
|
+
className: "children"
|
|
18
|
+
}), /*#__PURE__*/_react.default.createElement(_.Action, {
|
|
19
|
+
style: {
|
|
20
|
+
margin: '0 auto'
|
|
21
|
+
}
|
|
22
|
+
}, "Parent element"), /*#__PURE__*/_react.default.createElement(_LayerContent.LayerContent, null, /*#__PURE__*/_react.default.createElement("span", null, "Lorem ipsum, dolor sit amet consectetur adipisicing elit.")));
|
|
26
23
|
exports.Story = Story;
|
|
27
24
|
Story.storyName = 'Layer';
|
|
28
25
|
Story.args = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layer.stories.js","names":["title","Story","props","margin","storyName","args","bottom","centered","fixed","forceRender","left","right","top","visible","testId"
|
|
1
|
+
{"version":3,"file":"Layer.stories.js","names":["_react","_interopRequireDefault","require","_","_Layer","_LayerContent","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_default","exports","title","Story","props","createElement","Layer","className","Action","style","margin","LayerContent","storyName","args","bottom","centered","fixed","forceRender","left","right","top","visible","testId"],"sources":["../../../src/primitives/Layer/Layer.stories.jsx"],"sourcesContent":["import React from 'react';\n\nimport { Action } from '../../';\nimport { Layer } from './Layer';\nimport { LayerContent } from './LayerContent';\n\nexport default { title: 'Primitives' };\n\nexport const Story = (props) => (\n <Layer {...props} className=\"children\">\n <Action style={{ margin: '0 auto' }}>Parent element</Action>\n\n <LayerContent>\n <span>Lorem ipsum, dolor sit amet consectetur adipisicing elit.</span>\n </LayerContent>\n </Layer>\n);\n\nStory.storyName = 'Layer';\n\nStory.args = {\n bottom: false,\n centered: false,\n fixed: false,\n forceRender: true,\n left: false,\n right: false,\n top: false,\n visible: true,\n // inherited properties\n testId: 'test-story',\n style: {},\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,CAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AAA8C,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH,CAAA,EAAAC,CAAA,MAAAJ,CAAA,CAAAI,CAAA,IAAAD,CAAA,CAAAC,CAAA,aAAAJ,CAAA,KAAAJ,QAAA,CAAAW,KAAA,OAAAN,SAAA;AAAA,IAAAO,QAAA,GAAAC,OAAA,CAAAd,OAAA,GAE/B;EAAEe,KAAK,EAAE;AAAa,CAAC;AAE/B,MAAMC,KAAK,GAAIC,KAAK,iBACzBzB,MAAA,CAAAQ,OAAA,CAAAkB,aAAA,CAACtB,MAAA,CAAAuB,KAAK,EAAAlB,QAAA,KAAKgB,KAAK;EAAEG,SAAS,EAAC;AAAU,iBACpC5B,MAAA,CAAAQ,OAAA,CAAAkB,aAAA,CAACvB,CAAA,CAAA0B,MAAM;EAACC,KAAK,EAAE;IAAEC,MAAM,EAAE;EAAS;AAAE,GAAC,gBAAsB,CAAC,eAE5D/B,MAAA,CAAAQ,OAAA,CAAAkB,aAAA,CAACrB,aAAA,CAAA2B,YAAY,qBACXhC,MAAA,CAAAQ,OAAA,CAAAkB,aAAA,eAAM,2DAA+D,CACzD,CACT,CACR;AAACJ,OAAA,CAAAE,KAAA,GAAAA,KAAA;AAEFA,KAAK,CAACS,SAAS,GAAG,OAAO;AAEzBT,KAAK,CAACU,IAAI,GAAG;EACXC,MAAM,EAAE,KAAK;EACbC,QAAQ,EAAE,KAAK;EACfC,KAAK,EAAE,KAAK;EACZC,WAAW,EAAE,IAAI;EACjBC,IAAI,EAAE,KAAK;EACXC,KAAK,EAAE,KAAK;EACZC,GAAG,EAAE,KAAK;EACVC,OAAO,EAAE,IAAI;EACb;EACAC,MAAM,EAAE,YAAY;EACpBb,KAAK,EAAE,CAAC;AACV,CAAC","ignoreList":[]}
|
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.LayerContent = void 0;
|
|
7
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
|
-
function _interopRequireDefault(
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
const LayerContent = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
children
|
|
12
|
+
} = _ref;
|
|
11
13
|
return children;
|
|
12
14
|
};
|
|
13
15
|
exports.LayerContent = LayerContent;
|
|
@@ -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":";;;;;;AAAA;AAAmC;AAEnC,
|
|
1
|
+
{"version":3,"file":"LayerContent.js","names":["_propTypes","_interopRequireDefault","require","e","__esModule","default","LayerContent","_ref","children","exports","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,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAmC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnC,MAAMG,YAAY,GAAGC,IAAA;EAAA,IAAC;IAAEC;EAAS,CAAC,GAAAD,IAAA;EAAA,OAAKC,QAAQ;AAAA;AAACC,OAAA,CAAAH,YAAA,GAAAA,YAAA;AAEhDA,YAAY,CAACI,WAAW,GAAG,yBAAyB;AAEpDJ,YAAY,CAACK,SAAS,GAAG;EACvBH,QAAQ,EAAEI,kBAAS,CAACC;AACtB,CAAC","ignoreList":[]}
|
|
@@ -4,22 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getElementLayout = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
const getElementLayout = function () {
|
|
8
|
+
let element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9
|
+
const {
|
|
10
|
+
offsetLeft: left,
|
|
11
|
+
offsetTop: top,
|
|
12
|
+
offsetHeight: height,
|
|
13
|
+
offsetWidth: width
|
|
14
|
+
} = element;
|
|
15
|
+
const {
|
|
16
|
+
left: screenLeft,
|
|
17
|
+
top: screenTop
|
|
18
|
+
} = element.getBoundingClientRect && element.getBoundingClientRect() || {};
|
|
16
19
|
return {
|
|
17
|
-
left
|
|
18
|
-
top
|
|
19
|
-
height
|
|
20
|
-
width
|
|
21
|
-
screenLeft
|
|
22
|
-
screenTop
|
|
20
|
+
left,
|
|
21
|
+
top,
|
|
22
|
+
height,
|
|
23
|
+
width,
|
|
24
|
+
screenLeft,
|
|
25
|
+
screenTop
|
|
23
26
|
};
|
|
24
27
|
};
|
|
25
28
|
exports.getElementLayout = getElementLayout;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getElementLayout.js","names":["getElementLayout","element","
|
|
1
|
+
{"version":3,"file":"getElementLayout.js","names":["getElementLayout","element","arguments","length","undefined","offsetLeft","left","offsetTop","top","offsetHeight","height","offsetWidth","width","screenLeft","screenTop","getBoundingClientRect","exports"],"sources":["../../../../src/primitives/Layer/helpers/getElementLayout.js"],"sourcesContent":["export const getElementLayout = (element = {}) => {\n const { offsetLeft: left, offsetTop: top, offsetHeight: height, offsetWidth: width } = element;\n const { left: screenLeft, top: screenTop } = (element.getBoundingClientRect && element.getBoundingClientRect()) || {};\n\n return { left, top, height, width, screenLeft, screenTop };\n};\n"],"mappings":";;;;;;AAAO,MAAMA,gBAAgB,GAAG,SAAAA,CAAA,EAAkB;EAAA,IAAjBC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAC3C,MAAM;IAAEG,UAAU,EAAEC,IAAI;IAAEC,SAAS,EAAEC,GAAG;IAAEC,YAAY,EAAEC,MAAM;IAAEC,WAAW,EAAEC;EAAM,CAAC,GAAGX,OAAO;EAC9F,MAAM;IAAEK,IAAI,EAAEO,UAAU;IAAEL,GAAG,EAAEM;EAAU,CAAC,GAAIb,OAAO,CAACc,qBAAqB,IAAId,OAAO,CAACc,qBAAqB,CAAC,CAAC,IAAK,CAAC,CAAC;EAErH,OAAO;IAAET,IAAI;IAAEE,GAAG;IAAEE,MAAM;IAAEE,KAAK;IAAEC,UAAU;IAAEC;EAAU,CAAC;AAC5D,CAAC;AAACE,OAAA,CAAAhB,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|