@uncinc/uncinc-react-kitchen-sink 2.5.3 → 2.5.4-1-treeshaking
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/dist/Context/KitchenSinkComponentMapperContext.js +3 -11
- package/dist/Context/ViewportContext.js +8 -21
- package/dist/Context/withMapping.js +6 -17
- package/dist/components/AbbreviationAnnotation/index.js +17 -28
- package/dist/components/AbbreviationAnnotation/stories.js +12 -21
- package/dist/components/Accordion/AccordionItem/index.js +18 -29
- package/dist/components/Accordion/AccordionItemVariant/index.js +14 -25
- package/dist/components/Accordion/index.js +6 -14
- package/dist/components/Accordion/stories.js +16 -26
- package/dist/components/ApiAutocomplete/index.js +7 -17
- package/dist/components/ApiAutocomplete/stories.js +7 -16
- package/dist/components/Button/index.js +21 -30
- package/dist/components/Button/stories.js +11 -21
- package/dist/components/Cookie/Checkbox/index.js +6 -14
- package/dist/components/Cookie/index.js +61 -71
- package/dist/components/Cookie/stories.js +20 -33
- package/dist/components/Dialog/DialogHelpersStory/index.js +13 -25
- package/dist/components/Dialog/DialogHookStory/index.js +13 -22
- package/dist/components/Dialog/DialogOverrideStory/index.js +9 -18
- package/dist/components/Dialog/index.js +35 -46
- package/dist/components/Dialog/stories.js +10 -19
- package/dist/components/FontSizeSwitcher/index.js +17 -28
- package/dist/components/FontSizeSwitcher/stories.js +10 -20
- package/dist/components/Form/Checkbox/index.js +13 -21
- package/dist/components/Form/Checkbox/stories.js +8 -17
- package/dist/components/Form/Checkboxes/index.js +19 -27
- package/dist/components/Form/Checkboxes/index.test.js +23 -27
- package/dist/components/Form/Checkboxes/stories.js +9 -18
- package/dist/components/Form/Date/index.js +4 -12
- package/dist/components/Form/Date/stories.js +7 -16
- package/dist/components/Form/DatePicker/index.js +12 -20
- package/dist/components/Form/DatePicker/stories.js +7 -16
- package/dist/components/Form/DateSelect/index.js +24 -35
- package/dist/components/Form/DateSelect/stories.js +10 -22
- package/dist/components/Form/Email/index.js +4 -12
- package/dist/components/Form/Email/stories.js +7 -16
- package/dist/components/Form/FormikWrapper/index.js +9 -17
- package/dist/components/Form/GenericFormElement/index.js +14 -22
- package/dist/components/Form/Number/index.js +6 -14
- package/dist/components/Form/Number/stories.js +7 -16
- package/dist/components/Form/RadioButtons/index.js +17 -25
- package/dist/components/Form/RadioButtons/index.test.js +23 -27
- package/dist/components/Form/RadioButtons/stories.js +9 -18
- package/dist/components/Form/SearchField/index.js +14 -22
- package/dist/components/Form/Select/Input/index.js +10 -18
- package/dist/components/Form/Select/index.js +10 -18
- package/dist/components/Form/Select/stories.js +9 -19
- package/dist/components/Form/TextField/index.js +11 -19
- package/dist/components/Form/TextField/index.test.js +23 -27
- package/dist/components/Form/TextField/stories.js +8 -17
- package/dist/components/Form/Textarea/index.js +10 -18
- package/dist/components/Form/Textarea/stories.js +7 -16
- package/dist/components/Hamburger/index.js +7 -15
- package/dist/components/Hamburger/stories.js +12 -22
- package/dist/components/Header/index.js +23 -38
- package/dist/components/Header/stories.js +22 -34
- package/dist/components/Image/Background/index.js +10 -21
- package/dist/components/Image/LazyLoadWrapper/index.js +16 -26
- package/dist/components/Image/Picture/index.js +20 -28
- package/dist/components/Image/index.js +11 -19
- package/dist/components/Image/stories.js +28 -41
- package/dist/components/InlineMenu/index.js +14 -25
- package/dist/components/InlineMenu/stories.js +18 -27
- package/dist/components/Layout/Container/index.js +10 -18
- package/dist/components/Layout/Container/stories.js +44 -53
- package/dist/components/Layout/QuickLayout/Auto/index.js +5 -13
- package/dist/components/Layout/QuickLayout/Center/index.js +6 -14
- package/dist/components/Layout/QuickLayout/Clamp/index.js +5 -13
- package/dist/components/Layout/QuickLayout/Sidebar/index.js +6 -14
- package/dist/components/Layout/QuickLayout/SpaceBetween/index.js +6 -14
- package/dist/components/Layout/QuickLayout/Stack/index.js +6 -14
- package/dist/components/Layout/QuickLayout/Wrap/index.js +7 -15
- package/dist/components/Layout/QuickLayout/index.js +16 -24
- package/dist/components/Layout/QuickLayout/stories.js +38 -54
- package/dist/components/Lottie/LottieAnimation/index.js +12 -23
- package/dist/components/Lottie/LottieAnimationWithMousePosition.js +8 -19
- package/dist/components/Lottie/index.js +29 -41
- package/dist/components/Lottie/stories.js +25 -36
- package/dist/components/MagicLine/index.js +12 -23
- package/dist/components/MagicLine/stories.js +16 -26
- package/dist/components/NavigationScroll/index.js +11 -21
- package/dist/components/NavigationScroll/stories.js +9 -18
- package/dist/components/Pagination/index.js +27 -36
- package/dist/components/Pagination/stories.js +17 -30
- package/dist/components/SearchKit/Facets/ChipFacet/index.js +11 -20
- package/dist/components/SearchKit/Facets/ListFacet/index.js +11 -20
- package/dist/components/SearchKit/Facets/SelectFacet/index.js +15 -24
- package/dist/components/SearchKit/Query/index.js +13 -24
- package/dist/components/SearchKit/SearchFacets/index.js +10 -18
- package/dist/components/SearchKit/SearchField/index.js +12 -23
- package/dist/components/SearchKit/SearchLoadMore/index.js +7 -15
- package/dist/components/SearchKit/SearchPage/index.js +8 -17
- package/dist/components/SearchKit/SearchPagination/index.js +6 -14
- package/dist/components/SearchKit/SearchReset/index.js +8 -16
- package/dist/components/SearchKit/SearchResults/index.js +28 -39
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/CustomValue/index.js +6 -14
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/DateRange/index.js +6 -14
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/NumericRange/index.js +6 -14
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/Value/index.js +7 -18
- package/dist/components/SearchKit/SearchSelectedFilters/index.js +18 -26
- package/dist/components/SearchKit/SearchSorting/index.js +9 -17
- package/dist/components/SearchKit/index.js +29 -40
- package/dist/components/SearchKit/stories.js +54 -69
- package/dist/components/Share/index.js +18 -26
- package/dist/components/Share/stories.js +7 -16
- package/dist/components/Sliders/SliderRelated/index.js +11 -19
- package/dist/components/Sliders/SliderRelated/stories.js +22 -33
- package/dist/components/WysiwygField/index.js +10 -18
- package/dist/components/WysiwygField/stories.js +10 -20
- package/dist/components/index.js +15 -111
- package/dist/config/constants.js +17 -37
- package/dist/config/i18next/index.js +9 -17
- package/dist/helpers/date.js +4 -13
- package/dist/helpers/gtm.js +4 -11
- package/dist/helpers/link.js +4 -12
- package/dist/helpers/useValueForCurrentViewPort.js +6 -13
- package/dist/hooks/useBoolean.js +6 -12
- package/dist/hooks/useClickOutside.js +3 -9
- package/dist/hooks/useDialog.js +6 -13
- package/dist/hooks/useDialogHelpers.js +11 -18
- package/dist/hooks/useEscape.js +3 -9
- package/dist/hooks/useOnScreen.js +4 -10
- package/dist/hooks/usePrevious.js +4 -10
- package/dist/hooks/useScrollPosition.js +4 -11
- package/dist/hooks/useTrapFocus.js +3 -9
- package/dist/hooks/useWindowDimensions.js +4 -10
- package/dist/index.js +76 -471
- package/dist/setupTests.js +2 -5
- package/package.json +9 -3
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _Center = _interopRequireDefault(require("./Center"));
|
|
9
|
-
var _Wrap = _interopRequireDefault(require("./Wrap"));
|
|
10
|
-
var _Sidebar = _interopRequireDefault(require("./Sidebar"));
|
|
11
|
-
var _Stack = _interopRequireDefault(require("./Stack"));
|
|
12
|
-
var _Auto = _interopRequireDefault(require("./Auto"));
|
|
13
|
-
var _SpaceBetween = _interopRequireDefault(require("./SpaceBetween"));
|
|
14
|
-
var _Clamp = _interopRequireDefault(require("./Clamp"));
|
|
15
1
|
var _excluded = ["type", "children"];
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
2
|
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; }
|
|
18
3
|
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; }
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import QuickLayoutCentered from './Center';
|
|
6
|
+
import QuickLayoutWrap from './Wrap';
|
|
7
|
+
import QuickLayoutSidebar from './Sidebar';
|
|
8
|
+
import QuickLayoutStack from './Stack';
|
|
9
|
+
import QuickLayoutAuto from './Auto';
|
|
10
|
+
import QuickLayoutSpaceBetween from './SpaceBetween';
|
|
11
|
+
import QuickLayoutClamp from './Clamp';
|
|
19
12
|
var QuickLayout = function QuickLayout(_ref) {
|
|
20
13
|
var type = _ref.type,
|
|
21
14
|
children = _ref.children,
|
|
@@ -27,7 +20,7 @@ var QuickLayout = function QuickLayout(_ref) {
|
|
|
27
20
|
*/
|
|
28
21
|
case 'center':
|
|
29
22
|
{
|
|
30
|
-
return /*#__PURE__*/
|
|
23
|
+
return /*#__PURE__*/React.createElement(QuickLayoutCentered, null, children);
|
|
31
24
|
}
|
|
32
25
|
|
|
33
26
|
/**
|
|
@@ -41,7 +34,7 @@ var QuickLayout = function QuickLayout(_ref) {
|
|
|
41
34
|
*/
|
|
42
35
|
case 'wrap':
|
|
43
36
|
{
|
|
44
|
-
return /*#__PURE__*/
|
|
37
|
+
return /*#__PURE__*/React.createElement(QuickLayoutWrap, props, children);
|
|
45
38
|
}
|
|
46
39
|
|
|
47
40
|
/**
|
|
@@ -55,7 +48,7 @@ var QuickLayout = function QuickLayout(_ref) {
|
|
|
55
48
|
*/
|
|
56
49
|
case 'sidebar':
|
|
57
50
|
{
|
|
58
|
-
return /*#__PURE__*/
|
|
51
|
+
return /*#__PURE__*/React.createElement(QuickLayoutSidebar, props, children);
|
|
59
52
|
}
|
|
60
53
|
|
|
61
54
|
/**
|
|
@@ -68,7 +61,7 @@ var QuickLayout = function QuickLayout(_ref) {
|
|
|
68
61
|
*/
|
|
69
62
|
case 'stack':
|
|
70
63
|
{
|
|
71
|
-
return /*#__PURE__*/
|
|
64
|
+
return /*#__PURE__*/React.createElement(QuickLayoutStack, props, children);
|
|
72
65
|
}
|
|
73
66
|
|
|
74
67
|
/**
|
|
@@ -79,7 +72,7 @@ var QuickLayout = function QuickLayout(_ref) {
|
|
|
79
72
|
*/
|
|
80
73
|
case 'auto':
|
|
81
74
|
{
|
|
82
|
-
return /*#__PURE__*/
|
|
75
|
+
return /*#__PURE__*/React.createElement(QuickLayoutAuto, props, children);
|
|
83
76
|
}
|
|
84
77
|
|
|
85
78
|
/**
|
|
@@ -94,7 +87,7 @@ var QuickLayout = function QuickLayout(_ref) {
|
|
|
94
87
|
*/
|
|
95
88
|
case 'spaceBetween':
|
|
96
89
|
{
|
|
97
|
-
return /*#__PURE__*/
|
|
90
|
+
return /*#__PURE__*/React.createElement(QuickLayoutSpaceBetween, props, children);
|
|
98
91
|
}
|
|
99
92
|
|
|
100
93
|
/**
|
|
@@ -106,7 +99,7 @@ var QuickLayout = function QuickLayout(_ref) {
|
|
|
106
99
|
*/
|
|
107
100
|
case 'clamp':
|
|
108
101
|
{
|
|
109
|
-
return /*#__PURE__*/
|
|
102
|
+
return /*#__PURE__*/React.createElement(QuickLayoutClamp, props, children);
|
|
110
103
|
}
|
|
111
104
|
default:
|
|
112
105
|
{
|
|
@@ -117,5 +110,4 @@ var QuickLayout = function QuickLayout(_ref) {
|
|
|
117
110
|
QuickLayout.defaultProps = {
|
|
118
111
|
type: ''
|
|
119
112
|
};
|
|
120
|
-
|
|
121
|
-
exports.default = _default;
|
|
113
|
+
export default QuickLayout;
|
|
@@ -1,104 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.Wrap = exports.Stack = exports.SpaceBetween = exports.Sidebar = exports.Clamp = exports.Center = exports.Auto = exports.AspectRatio = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _ = _interopRequireDefault(require("."));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
var _default = {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import QuickLayout from '.';
|
|
3
|
+
export default {
|
|
11
4
|
title: 'Templates/QuickLayout'
|
|
12
5
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return /*#__PURE__*/_react.default.createElement(_.default, {
|
|
6
|
+
export var Center = function Center() {
|
|
7
|
+
return /*#__PURE__*/React.createElement(QuickLayout, {
|
|
16
8
|
type: "center"
|
|
17
|
-
}, /*#__PURE__*/
|
|
9
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
18
10
|
className: "box turqoise"
|
|
19
11
|
}, "Wow, i'm centered!"));
|
|
20
12
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return /*#__PURE__*/_react.default.createElement(_.default, {
|
|
13
|
+
export var Wrap = function Wrap() {
|
|
14
|
+
return /*#__PURE__*/React.createElement(QuickLayout, {
|
|
24
15
|
type: "wrap",
|
|
25
16
|
min: "150px",
|
|
26
17
|
stretched: true
|
|
27
|
-
}, /*#__PURE__*/
|
|
18
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
28
19
|
className: "box box__full-height sunflower"
|
|
29
|
-
}, "1"), /*#__PURE__*/
|
|
20
|
+
}, "1"), /*#__PURE__*/React.createElement("div", {
|
|
30
21
|
className: "box box__full-height midnightblue"
|
|
31
|
-
}, "2"), /*#__PURE__*/
|
|
22
|
+
}, "2"), /*#__PURE__*/React.createElement("div", {
|
|
32
23
|
className: "box box__full-height belizehole"
|
|
33
24
|
}, "3"));
|
|
34
25
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return /*#__PURE__*/_react.default.createElement(_.default, {
|
|
26
|
+
export var Sidebar = function Sidebar() {
|
|
27
|
+
return /*#__PURE__*/React.createElement(QuickLayout, {
|
|
38
28
|
type: "sidebar"
|
|
39
|
-
}, /*#__PURE__*/
|
|
29
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
40
30
|
className: "box box__full-height amethyst"
|
|
41
|
-
}, "Sidebar"), /*#__PURE__*/
|
|
31
|
+
}, "Sidebar"), /*#__PURE__*/React.createElement("div", {
|
|
42
32
|
className: "box box__full-height sunflower"
|
|
43
33
|
}, "Body"));
|
|
44
34
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return /*#__PURE__*/_react.default.createElement(_.default, {
|
|
35
|
+
export var Stack = function Stack() {
|
|
36
|
+
return /*#__PURE__*/React.createElement(QuickLayout, {
|
|
48
37
|
type: "stack"
|
|
49
|
-
}, /*#__PURE__*/
|
|
38
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
50
39
|
className: "box box__full-height turqoise"
|
|
51
|
-
}, "Navigation!"), /*#__PURE__*/
|
|
40
|
+
}, "Navigation!"), /*#__PURE__*/React.createElement("div", {
|
|
52
41
|
className: "box box__full-height pomegranate"
|
|
53
|
-
}, "Body!"), /*#__PURE__*/
|
|
42
|
+
}, "Body!"), /*#__PURE__*/React.createElement("div", {
|
|
54
43
|
className: "box box__full-height belizehole"
|
|
55
44
|
}, "Footer!"));
|
|
56
45
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return /*#__PURE__*/_react.default.createElement(_.default, {
|
|
46
|
+
export var Auto = function Auto() {
|
|
47
|
+
return /*#__PURE__*/React.createElement(QuickLayout, {
|
|
60
48
|
type: "auto",
|
|
61
49
|
gap: "1rem ",
|
|
62
50
|
min: "150px"
|
|
63
|
-
}, /*#__PURE__*/
|
|
51
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
64
52
|
className: "box turqoise"
|
|
65
|
-
}, "1"), /*#__PURE__*/
|
|
53
|
+
}, "1"), /*#__PURE__*/React.createElement("div", {
|
|
66
54
|
className: "box pomegranate"
|
|
67
|
-
}, "2"), /*#__PURE__*/
|
|
55
|
+
}, "2"), /*#__PURE__*/React.createElement("div", {
|
|
68
56
|
className: "box turqoise"
|
|
69
|
-
}, "3"), /*#__PURE__*/
|
|
57
|
+
}, "3"), /*#__PURE__*/React.createElement("div", {
|
|
70
58
|
className: "box belizehole"
|
|
71
|
-
}, "4"), /*#__PURE__*/
|
|
59
|
+
}, "4"), /*#__PURE__*/React.createElement("div", {
|
|
72
60
|
className: "box amethyst"
|
|
73
61
|
}, "5"));
|
|
74
62
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return /*#__PURE__*/_react.default.createElement(_.default, {
|
|
63
|
+
export var SpaceBetween = function SpaceBetween() {
|
|
64
|
+
return /*#__PURE__*/React.createElement(QuickLayout, {
|
|
78
65
|
type: "spaceBetween",
|
|
79
66
|
gap: "1rem",
|
|
80
67
|
items: "3"
|
|
81
|
-
}, /*#__PURE__*/
|
|
68
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
82
69
|
className: "box sunflower"
|
|
83
|
-
}, "Box 1"), /*#__PURE__*/
|
|
70
|
+
}, "Box 1"), /*#__PURE__*/React.createElement("div", {
|
|
84
71
|
className: "box midnightblue"
|
|
85
|
-
}, "Box 2"), /*#__PURE__*/
|
|
72
|
+
}, "Box 2"), /*#__PURE__*/React.createElement("div", {
|
|
86
73
|
className: "box belizehole"
|
|
87
74
|
}, "Box 3"));
|
|
88
75
|
};
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return /*#__PURE__*/_react.default.createElement(_.default, {
|
|
76
|
+
export var Clamp = function Clamp() {
|
|
77
|
+
return /*#__PURE__*/React.createElement(QuickLayout, {
|
|
92
78
|
type: "clamp",
|
|
93
79
|
min: "2rem",
|
|
94
80
|
value: "2.5vw",
|
|
95
81
|
max: "20rem"
|
|
96
82
|
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent urna lectus, condimentum eu neque ut, hendrerit scelerisque lorem. Aenean vehicula eleifend porta. Suspendisse viverra fermentum urna quis rhoncus. Nam lacinia risus vel purus vestibulum semper. Curabitur rutrum nisl consequat dui pretium, vel dapibus libero venenatis. Praesent non imperdiet ipsum. Suspendisse non enim mattis, blandit nunc et, suscipit magna. Duis eu blandit elit. Fusce rhoncus, augue ut pretium accumsan, quam dolor laoreet nisl, eu faucibus mi massa vulputate enim.");
|
|
97
83
|
};
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", null, "Coming ", /*#__PURE__*/_react.default.createElement("a", {
|
|
84
|
+
export var AspectRatio = function AspectRatio() {
|
|
85
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, "Coming ", /*#__PURE__*/React.createElement("a", {
|
|
101
86
|
href: "https://caniuse.com/mdn-css_properties_aspect-ratio"
|
|
102
|
-
}, "soon...")), /*#__PURE__*/
|
|
103
|
-
};
|
|
104
|
-
exports.AspectRatio = AspectRatio;
|
|
87
|
+
}, "soon...")), /*#__PURE__*/React.createElement("div", null));
|
|
88
|
+
};
|
|
@@ -1,33 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
-
var _lottieWeb = _interopRequireDefault(require("lottie-web"));
|
|
11
|
-
require("./style.scss");
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
var LottieAnimation = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
1
|
+
import React, { useEffect, useCallback, useRef } from 'react';
|
|
2
|
+
import c from 'classnames';
|
|
3
|
+
import lottie from 'lottie-web';
|
|
4
|
+
import './style.scss';
|
|
5
|
+
var LottieAnimation = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
16
6
|
var id = props.id,
|
|
17
7
|
className = props.className,
|
|
18
8
|
ariaLabel = props.ariaLabel,
|
|
19
9
|
data = props.data;
|
|
20
10
|
var DIRECTION_FORWARD = 1;
|
|
21
11
|
var DIRECTION_BACKWARDS = -1;
|
|
22
|
-
var lottieClasses = (
|
|
23
|
-
var refInternal =
|
|
12
|
+
var lottieClasses = c('Lottie', className);
|
|
13
|
+
var refInternal = useRef(null);
|
|
24
14
|
var lottieAnimation = ref || refInternal;
|
|
25
15
|
var lottieId = id || (data ? data.nm : null);
|
|
26
16
|
|
|
27
17
|
/*
|
|
28
18
|
* Initial load of the Lottie animation
|
|
29
19
|
*/
|
|
30
|
-
var loadAnimation =
|
|
20
|
+
var loadAnimation = useCallback(function () {
|
|
31
21
|
var renderer = props.renderer,
|
|
32
22
|
rendererSettings = props.rendererSettings,
|
|
33
23
|
direction = props.direction,
|
|
@@ -39,7 +29,7 @@ var LottieAnimation = /*#__PURE__*/_react.default.forwardRef(function (props, re
|
|
|
39
29
|
activateOnHover = props.activateOnHover,
|
|
40
30
|
startPosition = props.startPosition,
|
|
41
31
|
onInit = props.onInit;
|
|
42
|
-
lottieAnimation.current =
|
|
32
|
+
lottieAnimation.current = lottie.loadAnimation({
|
|
43
33
|
animationData: data,
|
|
44
34
|
container: document.getElementById("lottie--".concat(lottieId)),
|
|
45
35
|
renderer: renderer,
|
|
@@ -101,7 +91,7 @@ var LottieAnimation = /*#__PURE__*/_react.default.forwardRef(function (props, re
|
|
|
101
91
|
};
|
|
102
92
|
|
|
103
93
|
// Init the Lottie animation.
|
|
104
|
-
|
|
94
|
+
useEffect(function () {
|
|
105
95
|
var onDestroy = props.onDestroy;
|
|
106
96
|
loadAnimation();
|
|
107
97
|
return function () {
|
|
@@ -112,7 +102,7 @@ var LottieAnimation = /*#__PURE__*/_react.default.forwardRef(function (props, re
|
|
|
112
102
|
return (
|
|
113
103
|
/*#__PURE__*/
|
|
114
104
|
// eslint-disable-next-line jsx-a11y/interactive-supports-focus
|
|
115
|
-
|
|
105
|
+
React.createElement("div", {
|
|
116
106
|
onMouseEnter: onMouseEnter,
|
|
117
107
|
onMouseLeave: onMouseLeave,
|
|
118
108
|
onClick: onClick,
|
|
@@ -123,5 +113,4 @@ var LottieAnimation = /*#__PURE__*/_react.default.forwardRef(function (props, re
|
|
|
123
113
|
})
|
|
124
114
|
);
|
|
125
115
|
});
|
|
126
|
-
|
|
127
|
-
exports.default = _default;
|
|
116
|
+
export default LottieAnimation;
|
|
@@ -1,28 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _ola = _interopRequireDefault(require("ola"));
|
|
10
|
-
var _ = _interopRequireDefault(require("."));
|
|
11
1
|
var _excluded = ["olaTime"];
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
2
|
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); }
|
|
16
3
|
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; }
|
|
17
4
|
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; }
|
|
5
|
+
import React, { useRef } from 'react';
|
|
6
|
+
import Ola from 'ola';
|
|
7
|
+
import Lottie from '.';
|
|
18
8
|
var LottieAnimationWithMousePosition = function LottieAnimationWithMousePosition(_ref) {
|
|
19
9
|
var olaTime = _ref.olaTime,
|
|
20
10
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
21
11
|
// Create our own ref that we pass to the component so that we can use lottie functions.
|
|
22
|
-
var ref =
|
|
12
|
+
var ref = useRef(null);
|
|
23
13
|
|
|
24
14
|
// Create an Ola instance for frame interpolation.
|
|
25
|
-
var interpolatedFrame = (0,
|
|
15
|
+
var interpolatedFrame = Ola(0, olaTime);
|
|
26
16
|
|
|
27
17
|
/*
|
|
28
18
|
* Follow mouse position for animation on Mouse move.
|
|
@@ -43,12 +33,11 @@ var LottieAnimationWithMousePosition = function LottieAnimationWithMousePosition
|
|
|
43
33
|
ref.current.goToAndStop(interpolatedFrame.value, true);
|
|
44
34
|
}
|
|
45
35
|
};
|
|
46
|
-
return /*#__PURE__*/
|
|
36
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
47
37
|
onMouseMove: onMouseMove,
|
|
48
38
|
onTouchMove: onMouseMove
|
|
49
|
-
}, /*#__PURE__*/
|
|
39
|
+
}, /*#__PURE__*/React.createElement(Lottie, _extends({
|
|
50
40
|
ref: ref
|
|
51
41
|
}, props)));
|
|
52
42
|
};
|
|
53
|
-
|
|
54
|
-
exports.default = _default;
|
|
43
|
+
export default LottieAnimationWithMousePosition;
|
|
@@ -1,57 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _component = _interopRequireDefault(require("@loadable/component"));
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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
1
|
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); }
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import loadable from '@loadable/component';
|
|
5
|
+
|
|
15
6
|
// Lazy-load Lottie animations with a delay.
|
|
16
|
-
var Lottie = /*#__PURE__*/
|
|
7
|
+
var Lottie = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
17
8
|
var delay = props.delay;
|
|
18
|
-
var LottieAnimation = (
|
|
9
|
+
var LottieAnimation = loadable(function () {
|
|
19
10
|
return new Promise(function (resolve) {
|
|
20
11
|
setTimeout(function () {
|
|
21
|
-
return resolve(
|
|
22
|
-
return _interopRequireWildcard(require('./LottieAnimation'));
|
|
23
|
-
}));
|
|
12
|
+
return resolve(import('./LottieAnimation'));
|
|
24
13
|
}, delay);
|
|
25
14
|
});
|
|
26
15
|
});
|
|
27
|
-
return /*#__PURE__*/
|
|
16
|
+
return /*#__PURE__*/React.createElement(LottieAnimation, _extends({
|
|
28
17
|
ref: ref
|
|
29
18
|
}, props));
|
|
30
19
|
});
|
|
31
20
|
Lottie.propTypes = {
|
|
32
|
-
id:
|
|
33
|
-
className:
|
|
34
|
-
renderer:
|
|
35
|
-
rendererSettings:
|
|
36
|
-
preserveAspectRatio:
|
|
21
|
+
id: PropTypes.string,
|
|
22
|
+
className: PropTypes.string,
|
|
23
|
+
renderer: PropTypes.string,
|
|
24
|
+
rendererSettings: PropTypes.shape({
|
|
25
|
+
preserveAspectRatio: PropTypes.string
|
|
37
26
|
}),
|
|
38
|
-
data:
|
|
39
|
-
path:
|
|
40
|
-
segments:
|
|
27
|
+
data: PropTypes.object,
|
|
28
|
+
path: PropTypes.string,
|
|
29
|
+
segments: PropTypes.array,
|
|
41
30
|
// Events
|
|
42
|
-
onInit:
|
|
43
|
-
onDestroy:
|
|
31
|
+
onInit: PropTypes.func,
|
|
32
|
+
onDestroy: PropTypes.func,
|
|
44
33
|
// Options
|
|
45
|
-
delay:
|
|
46
|
-
autoPlay:
|
|
47
|
-
loop:
|
|
48
|
-
speed:
|
|
49
|
-
direction:
|
|
50
|
-
activateOnHover:
|
|
51
|
-
pauseOnClick:
|
|
52
|
-
olaTime:
|
|
53
|
-
startPosition:
|
|
54
|
-
ariaLabel:
|
|
34
|
+
delay: PropTypes.number,
|
|
35
|
+
autoPlay: PropTypes.bool,
|
|
36
|
+
loop: PropTypes.bool,
|
|
37
|
+
speed: PropTypes.number,
|
|
38
|
+
direction: PropTypes.number,
|
|
39
|
+
activateOnHover: PropTypes.bool,
|
|
40
|
+
pauseOnClick: PropTypes.bool,
|
|
41
|
+
olaTime: PropTypes.number,
|
|
42
|
+
startPosition: PropTypes.number,
|
|
43
|
+
ariaLabel: PropTypes.string
|
|
55
44
|
};
|
|
56
45
|
Lottie.defaultProps = {
|
|
57
46
|
id: null,
|
|
@@ -78,5 +67,4 @@ Lottie.defaultProps = {
|
|
|
78
67
|
olaTime: 300,
|
|
79
68
|
startPosition: null
|
|
80
69
|
};
|
|
81
|
-
|
|
82
|
-
exports.default = _default;
|
|
70
|
+
export default Lottie;
|
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.playAnimationOnMousePosition = exports.pauseOnClickAnimation = exports.default = exports.activateOnHoverAnimation = exports.PathLoad = exports.DefaultAnimation = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _ = _interopRequireDefault(require("."));
|
|
9
|
-
var _LottieAnimationWithMousePosition = _interopRequireDefault(require("./LottieAnimationWithMousePosition"));
|
|
10
|
-
var _example = _interopRequireDefault(require("../../assets/lottie/example.json"));
|
|
11
|
-
var _data = _interopRequireDefault(require("../../assets/lottie/data.json"));
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
1
|
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); }
|
|
14
|
-
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Lottie from '.';
|
|
4
|
+
import LottieAnimationWithMousePosition from './LottieAnimationWithMousePosition';
|
|
5
|
+
import exampleLottie from '../../assets/lottie/example.json';
|
|
6
|
+
import exampleLottieEspero from '../../assets/lottie/data.json';
|
|
7
|
+
export default {
|
|
15
8
|
title: 'Atoms/Lottie',
|
|
16
|
-
component:
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
component: Lottie
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// Default animation
|
|
13
|
+
export var DefaultAnimation = function DefaultAnimation(args) {
|
|
14
|
+
return /*#__PURE__*/React.createElement(Lottie, _extends({
|
|
21
15
|
id: "example",
|
|
22
|
-
data:
|
|
16
|
+
data: exampleLottie,
|
|
23
17
|
onInit: function onInit(lottie) {
|
|
24
18
|
return console.log(lottie);
|
|
25
19
|
}
|
|
@@ -27,40 +21,35 @@ var DefaultAnimation = function DefaultAnimation(args) {
|
|
|
27
21
|
};
|
|
28
22
|
|
|
29
23
|
// Animation active on hover
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
data: _example.default,
|
|
24
|
+
export var activateOnHoverAnimation = function activateOnHoverAnimation(args) {
|
|
25
|
+
return /*#__PURE__*/React.createElement(Lottie, _extends({
|
|
26
|
+
data: exampleLottie,
|
|
34
27
|
activateOnHover: true
|
|
35
28
|
}, args));
|
|
36
29
|
};
|
|
37
30
|
|
|
38
31
|
// Animation plays on mouse position
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return /*#__PURE__*/_react.default.createElement(_LottieAnimationWithMousePosition.default, _extends({
|
|
32
|
+
export var playAnimationOnMousePosition = function playAnimationOnMousePosition(args) {
|
|
33
|
+
return /*#__PURE__*/React.createElement(LottieAnimationWithMousePosition, _extends({
|
|
42
34
|
loop: false,
|
|
43
35
|
autoplay: false,
|
|
44
|
-
data:
|
|
36
|
+
data: exampleLottieEspero,
|
|
45
37
|
olaTime: 100,
|
|
46
38
|
startPosition: 0.5
|
|
47
39
|
}, args));
|
|
48
40
|
};
|
|
49
41
|
|
|
50
42
|
// Pause animation on click
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
data: _example.default,
|
|
43
|
+
export var pauseOnClickAnimation = function pauseOnClickAnimation(args) {
|
|
44
|
+
return /*#__PURE__*/React.createElement(Lottie, _extends({
|
|
45
|
+
data: exampleLottie,
|
|
55
46
|
pauseOnClick: true
|
|
56
47
|
}, args));
|
|
57
48
|
};
|
|
58
49
|
|
|
59
50
|
// Via path load
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return /*#__PURE__*/_react.default.createElement(_.default, _extends({
|
|
51
|
+
export var PathLoad = function PathLoad(args) {
|
|
52
|
+
return /*#__PURE__*/React.createElement(Lottie, _extends({
|
|
63
53
|
path: "https://maxst.icons8.com/vue-static/landings/animated-icons/icons/checkmark-ok/checkmark-ok.json"
|
|
64
54
|
}, args));
|
|
65
|
-
};
|
|
66
|
-
exports.PathLoad = PathLoad;
|
|
55
|
+
};
|
|
@@ -1,33 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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); }
|
|
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; }
|
|
13
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
2
|
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
3
|
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
4
|
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
5
|
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
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useRef, useState, useEffect } from 'react';
|
|
8
|
+
import c from 'classnames';
|
|
19
9
|
var MagicLine = function MagicLine(_ref) {
|
|
20
10
|
var _ref$activeClassName = _ref.activeClassName,
|
|
21
11
|
activeClassName = _ref$activeClassName === void 0 ? 'Menu__item--active' : _ref$activeClassName,
|
|
22
12
|
children = _ref.children;
|
|
23
|
-
var magicLineParentRef =
|
|
24
|
-
var magicLineRef =
|
|
25
|
-
var currentActiveItem =
|
|
26
|
-
var _useState =
|
|
13
|
+
var magicLineParentRef = useRef(null);
|
|
14
|
+
var magicLineRef = useRef(null);
|
|
15
|
+
var currentActiveItem = useRef(null);
|
|
16
|
+
var _useState = useState(false),
|
|
27
17
|
_useState2 = _slicedToArray(_useState, 2),
|
|
28
18
|
loaded = _useState2[0],
|
|
29
19
|
setLoaded = _useState2[1];
|
|
30
|
-
var _useState3 =
|
|
20
|
+
var _useState3 = useState(false),
|
|
31
21
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
32
22
|
activeItemInNavigation = _useState4[0],
|
|
33
23
|
_setActiveItemInNavigation = _useState4[1];
|
|
@@ -36,7 +26,7 @@ var MagicLine = function MagicLine(_ref) {
|
|
|
36
26
|
_setActiveItemInNavigation(value);
|
|
37
27
|
}
|
|
38
28
|
};
|
|
39
|
-
var MagicLineRefClasses = (
|
|
29
|
+
var MagicLineRefClasses = c('MagicLine__magic_line', {
|
|
40
30
|
'MagicLine__magic_line--visible': activeItemInNavigation && loaded
|
|
41
31
|
});
|
|
42
32
|
var alignMagicLine = function alignMagicLine() {
|
|
@@ -60,7 +50,7 @@ var MagicLine = function MagicLine(_ref) {
|
|
|
60
50
|
}
|
|
61
51
|
alignMagicLine();
|
|
62
52
|
};
|
|
63
|
-
|
|
53
|
+
useEffect(function () {
|
|
64
54
|
var initialize = function initialize() {
|
|
65
55
|
setInitialMagicLine();
|
|
66
56
|
};
|
|
@@ -75,13 +65,12 @@ var MagicLine = function MagicLine(_ref) {
|
|
|
75
65
|
window.removeEventListener('resize', handleResize);
|
|
76
66
|
};
|
|
77
67
|
}, []);
|
|
78
|
-
return /*#__PURE__*/
|
|
68
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
79
69
|
ref: magicLineParentRef,
|
|
80
70
|
className: "MagicLine"
|
|
81
|
-
}, /*#__PURE__*/
|
|
71
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
82
72
|
ref: magicLineRef,
|
|
83
73
|
className: MagicLineRefClasses
|
|
84
74
|
}), children(setInitialMagicLine, hoverMagicLine, setActiveItemInNavigation));
|
|
85
75
|
};
|
|
86
|
-
|
|
87
|
-
exports.default = _default;
|
|
76
|
+
export default MagicLine;
|