@semcore/feature-popover 2.3.0 → 2.5.0
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/CHANGELOG.md +24 -0
- package/lib/cjs/FeaturePopover.js +51 -68
- package/lib/cjs/FeaturePopover.js.map +1 -1
- package/lib/cjs/style/feature-popover.shadow.css +6 -22
- package/lib/es6/FeaturePopover.js +53 -69
- package/lib/es6/FeaturePopover.js.map +1 -1
- package/lib/es6/style/feature-popover.shadow.css +6 -22
- package/lib/types/index.d.ts +3 -3
- package/package.json +4 -3
- package/src/FeaturePopover.js +45 -31
- package/src/index.d.ts +3 -3
- package/src/style/feature-popover.shadow.css +6 -22
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [2.5.0] - 2022-01-18
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Up version icons and use new icon.
|
|
10
|
+
|
|
11
|
+
## [2.4.2] - 2021-8-26
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Add 'sideEffect=false' for more optimal build via webpack
|
|
16
|
+
|
|
17
|
+
## [2.4.1] - 2021-08-02
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- [ts] correct types.
|
|
22
|
+
|
|
23
|
+
## [2.4.0] - 2021-07-12
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- Replace animation from package `react-transition-group` to `@semcore/animation`.
|
|
28
|
+
|
|
5
29
|
## [2.3.0] - 2021-05-17
|
|
6
30
|
|
|
7
31
|
### Changed
|
|
@@ -27,54 +27,58 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
27
27
|
|
|
28
28
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
29
|
|
|
30
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
31
|
-
|
|
32
30
|
var _core = _interopRequireWildcard(require("@semcore/core"));
|
|
33
31
|
|
|
34
32
|
var _react = _interopRequireDefault(require("react"));
|
|
35
33
|
|
|
36
|
-
var
|
|
34
|
+
var _animation = require("@semcore/animation");
|
|
37
35
|
|
|
38
36
|
var _popper = _interopRequireDefault(require("@semcore/popper"));
|
|
39
37
|
|
|
40
38
|
var _flexBox = require("@semcore/flex-box");
|
|
41
39
|
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
var _if = _interopRequireDefault(require("@semcore/utils/lib/if"));
|
|
40
|
+
var _m = _interopRequireDefault(require("@semcore/icon/Close/m"));
|
|
45
41
|
|
|
46
42
|
var _assignProps3 = require("@semcore/utils/lib/assignProps");
|
|
47
43
|
|
|
48
44
|
var _this2 = void 0;
|
|
49
45
|
|
|
46
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
47
|
+
|
|
48
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
49
|
+
|
|
50
50
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
51
51
|
|
|
52
52
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
53
53
|
|
|
54
54
|
/*__reshadow-styles__:"./style/feature-popover.shadow.css"*/
|
|
55
|
-
var
|
|
55
|
+
var style = (
|
|
56
56
|
/*__reshadow_css_start__*/
|
|
57
|
-
|
|
57
|
+
_core.sstyled.insert(
|
|
58
58
|
/*__inner_css_start__*/
|
|
59
|
-
".
|
|
59
|
+
".___SFeaturePopover_16lbp_gg_{padding:16px;background-color:#ffe984;box-shadow:0 1px 10px 0 rgba(0,0,0,.1);border-radius:3px;box-sizing:border-box}.___SClose_16lbp_gg_{position:absolute;right:0;top:0;padding:8px;cursor:pointer;color:#757575;font-size:0}.___SClose_16lbp_gg_:hover{color:#5a5a5a}@-webkit-keyframes showTrigger_1vmhm6w{0%{opacity:0}to{opacity:1}}@keyframes showTrigger_1vmhm6w{0%{opacity:0}to{opacity:1}}@-webkit-keyframes scaleSizeAndHide_1vmhm6w{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(2)}}@keyframes scaleSizeAndHide_1vmhm6w{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(2)}}.___SSpot_16lbp_gg_{position:absolute;bottom:-4px;right:-4px;-webkit-animation-name:showTrigger_1vmhm6w;animation-name:showTrigger_1vmhm6w;-webkit-animation-duration:.2s;animation-duration:.2s;-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;-webkit-animation-delay:.4s;animation-delay:.4s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;width:12px;height:12px}.___SSpot_16lbp_gg_:before{transform-origin:50%;-webkit-animation-name:scaleSizeAndHide_1vmhm6w;animation-name:scaleSizeAndHide_1vmhm6w;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-delay:.5s;animation-delay:.5s}.___SSpot_16lbp_gg_:after,.___SSpot_16lbp_gg_:before{content:\"\";position:absolute;top:0;left:0;background-color:#ffd54f;border-radius:50%;width:12px;height:12px}"
|
|
60
60
|
/*__inner_css_end__*/
|
|
61
|
-
, "
|
|
61
|
+
, "1vmhm6w_gg_")
|
|
62
62
|
/*__reshadow_css_end__*/
|
|
63
63
|
, {
|
|
64
|
-
"__SFeaturePopover": "
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
64
|
+
"__SFeaturePopover": "___SFeaturePopover_16lbp_gg_",
|
|
65
|
+
"__SClose": "___SClose_16lbp_gg_",
|
|
66
|
+
"@showTrigger": "showTrigger_1vmhm6w",
|
|
67
|
+
"@scaleSizeAndHide": "scaleSizeAndHide_1vmhm6w",
|
|
68
|
+
"__SSpot": "___SSpot_16lbp_gg_"
|
|
69
|
+
});
|
|
70
|
+
var stylePopper = (
|
|
71
|
+
/*__reshadow_css_start__*/
|
|
72
|
+
_core.sstyled.insert(
|
|
73
|
+
/*__inner_css_start__*/
|
|
74
|
+
"@-webkit-keyframes enter_fbd3f1{0%{opacity:0;transform:translateX(-10px)}to{opacity:1;transform:translateX(0)}}@keyframes enter_fbd3f1{0%{opacity:0;transform:translateX(-10px)}to{opacity:1;transform:translateX(0)}}@-webkit-keyframes exit_fbd3f1{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-10px)}}@keyframes exit_fbd3f1{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-10px)}}"
|
|
75
|
+
/*__inner_css_end__*/
|
|
76
|
+
, "fbd3f1_gg_")
|
|
77
|
+
/*__reshadow_css_end__*/
|
|
78
|
+
, {
|
|
79
|
+
"@enter": "enter_fbd3f1",
|
|
80
|
+
"@exit": "exit_fbd3f1"
|
|
81
|
+
});
|
|
78
82
|
|
|
79
83
|
var FeaturePopover = /*#__PURE__*/function (_Component) {
|
|
80
84
|
(0, _inherits2["default"])(FeaturePopover, _Component);
|
|
@@ -131,6 +135,8 @@ var FeaturePopover = /*#__PURE__*/function (_Component) {
|
|
|
131
135
|
}, {
|
|
132
136
|
key: "render",
|
|
133
137
|
value: function render() {
|
|
138
|
+
var _ref3;
|
|
139
|
+
|
|
134
140
|
var _this$asProps = this.asProps,
|
|
135
141
|
styles = _this$asProps.styles,
|
|
136
142
|
forwardRef = _this$asProps.forwardRef,
|
|
@@ -138,11 +144,11 @@ var FeaturePopover = /*#__PURE__*/function (_Component) {
|
|
|
138
144
|
_this$asProps$modifie = _this$asProps.modifiers,
|
|
139
145
|
modifiers = _this$asProps$modifie === void 0 ? [] : _this$asProps$modifie,
|
|
140
146
|
other = (0, _objectWithoutProperties2["default"])(_this$asProps, ["styles", "forwardRef", "onVisibleChange", "modifiers"]);
|
|
141
|
-
return
|
|
142
|
-
ref: forwardRef,
|
|
143
|
-
onVisibleChange: (0, _assignProps3.callAllEventHandlers)(onVisibleChange, this.handleVisibleChange),
|
|
144
|
-
modifiers: [].concat((0, _toConsumableArray2["default"])(this.defaultModifiers), (0, _toConsumableArray2["default"])(modifiers))
|
|
145
|
-
}, other)))
|
|
147
|
+
return _ref3 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(_popper["default"], _ref3.cn("Popper", _objectSpread({
|
|
148
|
+
"ref": forwardRef,
|
|
149
|
+
"onVisibleChange": (0, _assignProps3.callAllEventHandlers)(onVisibleChange, this.handleVisibleChange),
|
|
150
|
+
"modifiers": [].concat((0, _toConsumableArray2["default"])(this.defaultModifiers), (0, _toConsumableArray2["default"])(modifiers))
|
|
151
|
+
}, other)));
|
|
146
152
|
}
|
|
147
153
|
}]);
|
|
148
154
|
return FeaturePopover;
|
|
@@ -162,17 +168,6 @@ var FeaturePopover = /*#__PURE__*/function (_Component) {
|
|
|
162
168
|
popper: []
|
|
163
169
|
}
|
|
164
170
|
});
|
|
165
|
-
var styled_12c = (0, _core.create)([(
|
|
166
|
-
/*__reshadow_css_start__*/
|
|
167
|
-
(0, _core.__css__)(
|
|
168
|
-
/*__inner_css_start__*/
|
|
169
|
-
".___SFeaturePopover_1qoj8_gg_{transition:all var(--80ovre_0) ease-in}"
|
|
170
|
-
/*__inner_css_end__*/
|
|
171
|
-
, "17wqyrb_gg_")
|
|
172
|
-
/*__reshadow_css_end__*/
|
|
173
|
-
, {
|
|
174
|
-
"__SFeaturePopover": "___SFeaturePopover_1qoj8_gg_"
|
|
175
|
-
})]);
|
|
176
171
|
|
|
177
172
|
var FeaturePopoverPopper = /*#__PURE__*/function (_Component2) {
|
|
178
173
|
(0, _inherits2["default"])(FeaturePopoverPopper, _Component2);
|
|
@@ -187,10 +182,11 @@ var FeaturePopoverPopper = /*#__PURE__*/function (_Component2) {
|
|
|
187
182
|
(0, _createClass2["default"])(FeaturePopoverPopper, [{
|
|
188
183
|
key: "render",
|
|
189
184
|
value: function render() {
|
|
190
|
-
var _ref = this ? this.asProps : arguments[0]
|
|
185
|
+
var _ref = this ? this.asProps : arguments[0],
|
|
186
|
+
_ref4;
|
|
191
187
|
|
|
192
188
|
var SFeaturePopover = _flexBox.Box;
|
|
193
|
-
var SClose =
|
|
189
|
+
var SClose = _m["default"];
|
|
194
190
|
var _this$asProps2 = this.asProps,
|
|
195
191
|
Children = _this$asProps2.Children,
|
|
196
192
|
styles = _this$asProps2.styles,
|
|
@@ -198,27 +194,15 @@ var FeaturePopoverPopper = /*#__PURE__*/function (_Component2) {
|
|
|
198
194
|
closeIcon = _this$asProps2.closeIcon,
|
|
199
195
|
duration = _this$asProps2.duration,
|
|
200
196
|
$onCloseClick = _this$asProps2.$onCloseClick;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
disableEnforceFocus: true,
|
|
211
|
-
$$style: _core.styled.$$style
|
|
212
|
-
}), /*#__PURE__*/_react["default"].createElement(SFeaturePopover, (0, _core.map)("SFeaturePopover", (0, _core.assignProps)({
|
|
213
|
-
"animate": state
|
|
214
|
-
}, _ref)), /*#__PURE__*/_react["default"].createElement(_if["default"], (0, _core.map)("If", {
|
|
215
|
-
condition: closeIcon
|
|
216
|
-
}), /*#__PURE__*/_react["default"].createElement(SClose, (0, _core.map)("SClose", {
|
|
217
|
-
onClick: $onCloseClick
|
|
218
|
-
}))), /*#__PURE__*/_react["default"].createElement(Children, {
|
|
219
|
-
className: _core.styled.styles["__Children"]
|
|
220
|
-
})))));
|
|
221
|
-
});
|
|
197
|
+
return _ref4 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(_popper["default"].Popper, {
|
|
198
|
+
disableEnforceFocus: true
|
|
199
|
+
}, /*#__PURE__*/_react["default"].createElement(_animation.Animation, _ref4.cn("Animation", {
|
|
200
|
+
"visible": visible,
|
|
201
|
+
"duration": duration,
|
|
202
|
+
"keyframes": [stylePopper['@enter'], stylePopper['@exit']]
|
|
203
|
+
}), /*#__PURE__*/_react["default"].createElement(SFeaturePopover, _ref4.cn("SFeaturePopover", _objectSpread({}, (0, _core.assignProps)({}, _ref))), closeIcon ? /*#__PURE__*/_react["default"].createElement(SClose, _ref4.cn("SClose", {
|
|
204
|
+
"onClick": $onCloseClick
|
|
205
|
+
})) : null, /*#__PURE__*/_react["default"].createElement(Children, _ref4.cn("Children", {})))));
|
|
222
206
|
}
|
|
223
207
|
}]);
|
|
224
208
|
return FeaturePopoverPopper;
|
|
@@ -228,17 +212,16 @@ var FeaturePopoverPopper = /*#__PURE__*/function (_Component2) {
|
|
|
228
212
|
closeIcon: false,
|
|
229
213
|
duration: 200
|
|
230
214
|
});
|
|
231
|
-
var styled_190 = (0, _core.create)([]);
|
|
232
215
|
|
|
233
216
|
var Spot = function Spot(props) {
|
|
234
|
-
var _ref2 = _this2 ? _this2.asProps : arguments[0]
|
|
217
|
+
var _ref2 = _this2 ? _this2.asProps : arguments[0],
|
|
218
|
+
_ref5;
|
|
235
219
|
|
|
236
220
|
var SSpot = _flexBox.Box;
|
|
237
221
|
var styles = props.styles,
|
|
238
222
|
visible = props.visible;
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}), /*#__PURE__*/_react["default"].createElement(SSpot, (0, _core.map)("SSpot", (0, _core.assignProps)({}, _ref2))))));
|
|
223
|
+
if (!visible) return null;
|
|
224
|
+
return _ref5 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SSpot, _ref5.cn("SSpot", _objectSpread({}, (0, _core.assignProps)({}, _ref2))));
|
|
242
225
|
};
|
|
243
226
|
|
|
244
227
|
var _default = (0, _core["default"])(FeaturePopover, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/FeaturePopover.js"],"names":["FeaturePopover","name","enabled","visible","handlers","e","asProps","$onCloseClick","handleCloseClick","styles","forwardRef","onVisibleChange","modifiers","other","handleVisibleChange","defaultModifiers","Component","style","offset","placement","defaultVisible","onOutsideClick","interaction","trigger","popper","FeaturePopoverPopper","SFeaturePopover","Box","SClose","Close","Children","closeIcon","duration","
|
|
1
|
+
{"version":3,"sources":["../../src/FeaturePopover.js"],"names":["stylePopper","sstyled","FeaturePopover","name","enabled","visible","handlers","e","asProps","$onCloseClick","handleCloseClick","styles","forwardRef","onVisibleChange","modifiers","other","handleVisibleChange","defaultModifiers","Component","style","offset","placement","defaultVisible","onOutsideClick","interaction","trigger","popper","FeaturePopoverPopper","SFeaturePopover","Box","SClose","Close","Children","closeIcon","duration","Sp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iCAA7BS,oB,kBACkB;AACpBM,EAAAA,SAAS,EAAE,KADS;AAEpBC,EAAAA,QAAQ,EAAE;AAFU,C;;AA2BxB,IAAMC,IAAI,GAAG,SAAPA,IAAO,CAACC,KAAD,EAAW;AAAA;AAAA;;AACtB,MAAMC,KAAK,GAM2BR,YANtC;AADsB,MAGdlB,MAHc,GAGMyB,KAHN,CAGdzB,MAHc;AAAA,MAGNN,OAHM,GAGM+B,KAHN,CAGN/B,OAHM;AAKtB,MAAI,CAACA,OAAL,EAAc,OAAO,IAAP;AAEd,iBAAO,mBAAQM,MAAR,CAAP,eAAuB,gCAAC,KAAD,0EAAvB;AACD,CARD;;eAUe,sBACbT,cADa,EAEb;AACEoC,EAAAA,OAAO,EAAEC,mBAAOD,OADlB;AAEEC,EAAAA,MAAM,EAAEZ,oBAFV;AAGEQ,EAAAA,IAAI,EAAJA;AAHF,CAFa,EAOb;AAAEK,EAAAA,MAAM,EAAED;AAAV,CAPa,C","sourcesContent":["import React from 'react';\nimport { Animation } from '@semcore/animation';\nimport createComponent, { Root, Component, sstyled } from '@semcore/core';\nimport Popper from '@semcore/popper';\nimport { Box } from '@semcore/flex-box';\nimport Close from '@semcore/icon/Close/m';\nimport { callAllEventHandlers } from '@semcore/utils/lib/assignProps';\n\nimport style from './style/feature-popover.shadow.css';\n\nconst stylePopper = sstyled.css`\n @keyframes enter {\n from {\n opacity: 0;\n transform: translateX(-10px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n }\n\n @keyframes exit {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(-10px);\n }\n }\n`;\n\nclass FeaturePopover extends Component {\n static displayName = 'FeaturePopover';\n static style = style;\n static defaultProps = {\n offset: [0, 12],\n placement: 'bottom-start',\n defaultVisible: false,\n onOutsideClick: () => false,\n interaction: {\n trigger: [['onClick']],\n popper: [],\n },\n };\n\n defaultModifiers = [\n {\n name: 'flip',\n enabled: false,\n },\n ];\n\n uncontrolledProps() {\n return {\n visible: null,\n };\n }\n\n handleVisibleChange = (visible) => {\n this.handlers.visible(visible);\n };\n\n handleCloseClick = (e) => {\n this.handlers.visible(false, e);\n };\n\n getPopperProps() {\n const { visible } = this.asProps;\n return {\n visible,\n $onCloseClick: this.handleCloseClick,\n };\n }\n\n getSpotProps() {\n const { visible } = this.asProps;\n return { visible };\n }\n\n render() {\n const { styles, forwardRef, onVisibleChange, modifiers = [], ...other } = this.asProps;\n\n return sstyled(styles)(\n <Popper\n ref={forwardRef}\n onVisibleChange={callAllEventHandlers(onVisibleChange, this.handleVisibleChange)}\n modifiers={[...this.defaultModifiers, ...modifiers]}\n {...other}\n />,\n );\n }\n}\n\nclass FeaturePopoverPopper extends Component {\n static defaultProps = {\n closeIcon: false,\n duration: 200,\n };\n\n render() {\n const SFeaturePopover = Root;\n const SClose = Close;\n const { Children, styles, visible, closeIcon, duration, $onCloseClick } = this.asProps;\n\n return sstyled(styles)(\n <Popper.Popper disableEnforceFocus>\n <Animation\n visible={visible}\n duration={duration}\n keyframes={[stylePopper['@enter'], stylePopper['@exit']]}\n >\n <SFeaturePopover render={Box}>\n {closeIcon ? <SClose onClick={$onCloseClick} /> : null}\n <Children />\n </SFeaturePopover>\n </Animation>\n </Popper.Popper>,\n );\n }\n}\n\nconst Spot = (props) => {\n const SSpot = Root;\n\n const { styles, visible } = props;\n\n if (!visible) return null;\n\n return sstyled(styles)(<SSpot render={Box} />);\n};\n\nexport default createComponent(\n FeaturePopover,\n {\n Trigger: Popper.Trigger,\n Popper: FeaturePopoverPopper,\n Spot,\n },\n { parent: Popper },\n);\n"],"file":"FeaturePopover.js"}
|
|
@@ -8,26 +8,6 @@ SFeaturePopover {
|
|
|
8
8
|
box-sizing: border-box;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
SFeaturePopover[animate='entered'] {
|
|
12
|
-
opacity: 1;
|
|
13
|
-
transform: translateX(0);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
SFeaturePopover[animate='entering'] {
|
|
17
|
-
opacity: 1;
|
|
18
|
-
transform: translateX(0);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
SFeaturePopover[animate='exited'] {
|
|
22
|
-
opacity: 0;
|
|
23
|
-
transform: translateX(-10px);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
SFeaturePopover[animate='exiting'] {
|
|
27
|
-
opacity: 0;
|
|
28
|
-
transform: translateX(-10px);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
11
|
SClose {
|
|
32
12
|
position: absolute;
|
|
33
13
|
right: 0;
|
|
@@ -66,7 +46,9 @@ SSpot {
|
|
|
66
46
|
position: absolute;
|
|
67
47
|
bottom: -4px;
|
|
68
48
|
right: -4px;
|
|
69
|
-
animation: showTrigger
|
|
49
|
+
animation-name: showTrigger;
|
|
50
|
+
animation-duration: 0.2s;
|
|
51
|
+
animation-timing-function: ease-in;
|
|
70
52
|
animation-delay: 0.4s;
|
|
71
53
|
animation-fill-mode: forwards;
|
|
72
54
|
width: 12px;
|
|
@@ -78,7 +60,9 @@ SSpot {
|
|
|
78
60
|
top: 0;
|
|
79
61
|
left: 0;
|
|
80
62
|
transform-origin: 50%;
|
|
81
|
-
|
|
63
|
+
animation-name: scaleSizeAndHide;
|
|
64
|
+
animation-duration: 1s;
|
|
65
|
+
animation-iteration-count: infinite;
|
|
82
66
|
animation-fill-mode: forwards;
|
|
83
67
|
animation-delay: 0.5s;
|
|
84
68
|
background-color: #ffd54f;
|
|
@@ -7,49 +7,56 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
7
7
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
-
import
|
|
10
|
+
import { sstyled as _sstyled } from "@semcore/core";
|
|
11
11
|
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
12
12
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
13
13
|
|
|
14
14
|
var _this2 = this;
|
|
15
15
|
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
19
|
+
|
|
16
20
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
17
21
|
|
|
18
22
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19
23
|
|
|
20
24
|
import React from 'react';
|
|
21
|
-
import {
|
|
22
|
-
import createComponent, { Root, Component,
|
|
25
|
+
import { Animation } from '@semcore/animation';
|
|
26
|
+
import createComponent, { Root, Component, sstyled } from '@semcore/core';
|
|
23
27
|
import Popper from '@semcore/popper';
|
|
24
28
|
import { Box } from '@semcore/flex-box';
|
|
25
|
-
import Close from '@semcore/icon/
|
|
26
|
-
import
|
|
29
|
+
import Close from '@semcore/icon/Close/m';
|
|
30
|
+
import { callAllEventHandlers } from '@semcore/utils/lib/assignProps';
|
|
27
31
|
|
|
28
32
|
/*__reshadow-styles__:"./style/feature-popover.shadow.css"*/
|
|
29
|
-
var
|
|
33
|
+
var style = (
|
|
30
34
|
/*__reshadow_css_start__*/
|
|
31
|
-
|
|
35
|
+
_sstyled.insert(
|
|
32
36
|
/*__inner_css_start__*/
|
|
33
|
-
".
|
|
37
|
+
".___SFeaturePopover_16lbp_gg_{padding:16px;background-color:#ffe984;box-shadow:0 1px 10px 0 rgba(0,0,0,.1);border-radius:3px;box-sizing:border-box}.___SClose_16lbp_gg_{position:absolute;right:0;top:0;padding:8px;cursor:pointer;color:#757575;font-size:0}.___SClose_16lbp_gg_:hover{color:#5a5a5a}@-webkit-keyframes showTrigger_1vmhm6w{0%{opacity:0}to{opacity:1}}@keyframes showTrigger_1vmhm6w{0%{opacity:0}to{opacity:1}}@-webkit-keyframes scaleSizeAndHide_1vmhm6w{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(2)}}@keyframes scaleSizeAndHide_1vmhm6w{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(2)}}.___SSpot_16lbp_gg_{position:absolute;bottom:-4px;right:-4px;-webkit-animation-name:showTrigger_1vmhm6w;animation-name:showTrigger_1vmhm6w;-webkit-animation-duration:.2s;animation-duration:.2s;-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;-webkit-animation-delay:.4s;animation-delay:.4s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;width:12px;height:12px}.___SSpot_16lbp_gg_:before{transform-origin:50%;-webkit-animation-name:scaleSizeAndHide_1vmhm6w;animation-name:scaleSizeAndHide_1vmhm6w;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-delay:.5s;animation-delay:.5s}.___SSpot_16lbp_gg_:after,.___SSpot_16lbp_gg_:before{content:\"\";position:absolute;top:0;left:0;background-color:#ffd54f;border-radius:50%;width:12px;height:12px}"
|
|
34
38
|
/*__inner_css_end__*/
|
|
35
|
-
, "
|
|
39
|
+
, "1vmhm6w_gg_")
|
|
36
40
|
/*__reshadow_css_end__*/
|
|
37
41
|
, {
|
|
38
|
-
"__SFeaturePopover": "
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
"__SFeaturePopover": "___SFeaturePopover_16lbp_gg_",
|
|
43
|
+
"__SClose": "___SClose_16lbp_gg_",
|
|
44
|
+
"@showTrigger": "showTrigger_1vmhm6w",
|
|
45
|
+
"@scaleSizeAndHide": "scaleSizeAndHide_1vmhm6w",
|
|
46
|
+
"__SSpot": "___SSpot_16lbp_gg_"
|
|
47
|
+
});
|
|
48
|
+
var stylePopper = (
|
|
49
|
+
/*__reshadow_css_start__*/
|
|
50
|
+
sstyled.insert(
|
|
51
|
+
/*__inner_css_start__*/
|
|
52
|
+
"@-webkit-keyframes enter_fbd3f1{0%{opacity:0;transform:translateX(-10px)}to{opacity:1;transform:translateX(0)}}@keyframes enter_fbd3f1{0%{opacity:0;transform:translateX(-10px)}to{opacity:1;transform:translateX(0)}}@-webkit-keyframes exit_fbd3f1{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-10px)}}@keyframes exit_fbd3f1{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-10px)}}"
|
|
53
|
+
/*__inner_css_end__*/
|
|
54
|
+
, "fbd3f1_gg_")
|
|
55
|
+
/*__reshadow_css_end__*/
|
|
56
|
+
, {
|
|
57
|
+
"@enter": "enter_fbd3f1",
|
|
58
|
+
"@exit": "exit_fbd3f1"
|
|
59
|
+
});
|
|
53
60
|
|
|
54
61
|
var FeaturePopover = /*#__PURE__*/function (_Component) {
|
|
55
62
|
_inherits(FeaturePopover, _Component);
|
|
@@ -110,6 +117,8 @@ var FeaturePopover = /*#__PURE__*/function (_Component) {
|
|
|
110
117
|
}, {
|
|
111
118
|
key: "render",
|
|
112
119
|
value: function render() {
|
|
120
|
+
var _ref3;
|
|
121
|
+
|
|
113
122
|
var _this$asProps = this.asProps,
|
|
114
123
|
styles = _this$asProps.styles,
|
|
115
124
|
forwardRef = _this$asProps.forwardRef,
|
|
@@ -118,11 +127,11 @@ var FeaturePopover = /*#__PURE__*/function (_Component) {
|
|
|
118
127
|
modifiers = _this$asProps$modifie === void 0 ? [] : _this$asProps$modifie,
|
|
119
128
|
other = _objectWithoutProperties(_this$asProps, ["styles", "forwardRef", "onVisibleChange", "modifiers"]);
|
|
120
129
|
|
|
121
|
-
return
|
|
122
|
-
ref: forwardRef,
|
|
123
|
-
onVisibleChange: callAllEventHandlers(onVisibleChange, this.handleVisibleChange),
|
|
124
|
-
modifiers: [].concat(_toConsumableArray(this.defaultModifiers), _toConsumableArray(modifiers))
|
|
125
|
-
}, other)))
|
|
130
|
+
return _ref3 = sstyled(styles), /*#__PURE__*/React.createElement(Popper, _ref3.cn("Popper", _objectSpread({
|
|
131
|
+
"ref": forwardRef,
|
|
132
|
+
"onVisibleChange": callAllEventHandlers(onVisibleChange, this.handleVisibleChange),
|
|
133
|
+
"modifiers": [].concat(_toConsumableArray(this.defaultModifiers), _toConsumableArray(modifiers))
|
|
134
|
+
}, other)));
|
|
126
135
|
}
|
|
127
136
|
}]);
|
|
128
137
|
|
|
@@ -146,18 +155,6 @@ _defineProperty(FeaturePopover, "defaultProps", {
|
|
|
146
155
|
}
|
|
147
156
|
});
|
|
148
157
|
|
|
149
|
-
var styled_12c = create([(
|
|
150
|
-
/*__reshadow_css_start__*/
|
|
151
|
-
__css__(
|
|
152
|
-
/*__inner_css_start__*/
|
|
153
|
-
".___SFeaturePopover_1qoj8_gg_{transition:all var(--80ovre_0) ease-in}"
|
|
154
|
-
/*__inner_css_end__*/
|
|
155
|
-
, "17wqyrb_gg_")
|
|
156
|
-
/*__reshadow_css_end__*/
|
|
157
|
-
, {
|
|
158
|
-
"__SFeaturePopover": "___SFeaturePopover_1qoj8_gg_"
|
|
159
|
-
})]);
|
|
160
|
-
|
|
161
158
|
var FeaturePopoverPopper = /*#__PURE__*/function (_Component2) {
|
|
162
159
|
_inherits(FeaturePopoverPopper, _Component2);
|
|
163
160
|
|
|
@@ -172,7 +169,8 @@ var FeaturePopoverPopper = /*#__PURE__*/function (_Component2) {
|
|
|
172
169
|
_createClass(FeaturePopoverPopper, [{
|
|
173
170
|
key: "render",
|
|
174
171
|
value: function render() {
|
|
175
|
-
var _ref = this ? this.asProps : arguments[0]
|
|
172
|
+
var _ref = this ? this.asProps : arguments[0],
|
|
173
|
+
_ref4;
|
|
176
174
|
|
|
177
175
|
var SFeaturePopover = Box;
|
|
178
176
|
var SClose = Close;
|
|
@@ -183,27 +181,15 @@ var FeaturePopoverPopper = /*#__PURE__*/function (_Component2) {
|
|
|
183
181
|
closeIcon = _this$asProps2.closeIcon,
|
|
184
182
|
duration = _this$asProps2.duration,
|
|
185
183
|
$onCloseClick = _this$asProps2.$onCloseClick;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
disableEnforceFocus: true,
|
|
196
|
-
$$style: styled.$$style
|
|
197
|
-
}), /*#__PURE__*/React.createElement(SFeaturePopover, map("SFeaturePopover", _assignProps({
|
|
198
|
-
"animate": state
|
|
199
|
-
}, _ref)), /*#__PURE__*/React.createElement(If, map("If", {
|
|
200
|
-
condition: closeIcon
|
|
201
|
-
}), /*#__PURE__*/React.createElement(SClose, map("SClose", {
|
|
202
|
-
onClick: $onCloseClick
|
|
203
|
-
}))), /*#__PURE__*/React.createElement(Children, {
|
|
204
|
-
className: styled.styles["__Children"]
|
|
205
|
-
})))));
|
|
206
|
-
});
|
|
184
|
+
return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(Popper.Popper, {
|
|
185
|
+
disableEnforceFocus: true
|
|
186
|
+
}, /*#__PURE__*/React.createElement(Animation, _ref4.cn("Animation", {
|
|
187
|
+
"visible": visible,
|
|
188
|
+
"duration": duration,
|
|
189
|
+
"keyframes": [stylePopper['@enter'], stylePopper['@exit']]
|
|
190
|
+
}), /*#__PURE__*/React.createElement(SFeaturePopover, _ref4.cn("SFeaturePopover", _objectSpread({}, _assignProps({}, _ref))), closeIcon ? /*#__PURE__*/React.createElement(SClose, _ref4.cn("SClose", {
|
|
191
|
+
"onClick": $onCloseClick
|
|
192
|
+
})) : null, /*#__PURE__*/React.createElement(Children, _ref4.cn("Children", {})))));
|
|
207
193
|
}
|
|
208
194
|
}]);
|
|
209
195
|
|
|
@@ -215,17 +201,15 @@ _defineProperty(FeaturePopoverPopper, "defaultProps", {
|
|
|
215
201
|
duration: 200
|
|
216
202
|
});
|
|
217
203
|
|
|
218
|
-
var styled_190 = create([]);
|
|
219
|
-
|
|
220
204
|
var Spot = function Spot(props) {
|
|
221
|
-
var _ref2 = _this2 ? _this2.asProps : arguments[0]
|
|
205
|
+
var _ref2 = _this2 ? _this2.asProps : arguments[0],
|
|
206
|
+
_ref5;
|
|
222
207
|
|
|
223
208
|
var SSpot = Box;
|
|
224
209
|
var styles = props.styles,
|
|
225
210
|
visible = props.visible;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}), /*#__PURE__*/React.createElement(SSpot, map("SSpot", _assignProps2({}, _ref2))))));
|
|
211
|
+
if (!visible) return null;
|
|
212
|
+
return _ref5 = sstyled(styles), /*#__PURE__*/React.createElement(SSpot, _ref5.cn("SSpot", _objectSpread({}, _assignProps2({}, _ref2))));
|
|
229
213
|
};
|
|
230
214
|
|
|
231
215
|
export default createComponent(FeaturePopover, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/FeaturePopover.js"],"names":["React","
|
|
1
|
+
{"version":3,"sources":["../../src/FeaturePopover.js"],"names":["React","Animation","createComponent","Root","Component","sstyled","Popper","Box","Close","callAllEventHandlers","stylePopper","FeaturePopover","name","enabled","visible","handlers","e","asProps","$onCloseClick","handleCloseClick","styles","forwardRef","onVisibleChange","modifiers","other","handleVisibleChange","defaultModifiers","style","offset","placement","defaultVisible","onOutsideClick","interaction","trigger","popper","FeaturePopoverPopper","SFeaturePopover","SClose","Children","closeIcon","duration","Spot","props","SSpot","Trigger","parent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,OAAOC,eAAP,IAA0BC,IAA1B,EAAgCC,SAAhC,EAA2CC,OAA3C,QAA0D,eAA1D;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,SAASC,GAAT,QAAoB,mBAApB;AACA,OAAOC,KAAP,MAAkB,uBAAlB;AACA,SAASC,oBAAT,QAAqC,gCAArC;;;;;;;;;;;;;;;;;;AAIA,IAAMC,WAAW;AAAA;AAAGL,OAAO,OAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAjB;;IAwBMM,c;;;;;;;;;;;;;;;;uEAce,CACjB;AACEC,MAAAA,IAAI,EAAE,MADR;AAEEC,MAAAA,OAAO,EAAE;AAFX,KADiB,C;;0EAaG,UAACC,OAAD,EAAa;AACjC,YAAKC,QAAL,CAAcD,OAAd,CAAsBA,OAAtB;AACD,K;;uEAEkB,UAACE,CAAD,EAAO;AACxB,YAAKD,QAAL,CAAcD,OAAd,CAAsB,KAAtB,EAA6BE,CAA7B;AACD,K;;;;;;;WAZD,6BAAoB;AAClB,aAAO;AACLF,QAAAA,OAAO,EAAE;AADJ,OAAP;AAGD;;;WAUD,0BAAiB;AAAA,UACPA,OADO,GACK,KAAKG,OADV,CACPH,OADO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ent":["import React from 'react';\nimport { Animation } from '@semcore/animation';\nimport createComponent, { Root, Component, sstyled } from '@semcore/core';\nimport Popper from '@semcore/popper';\nimport { Box } from '@semcore/flex-box';\nimport Close from '@semcore/icon/Close/m';\nimport { callAllEventHandlers } from '@semcore/utils/lib/assignProps';\n\nimport style from './style/feature-popover.shadow.css';\n\nconst stylePopper = sstyled.css`\n @keyframes enter {\n from {\n opacity: 0;\n transform: translateX(-10px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n }\n\n @keyframes exit {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(-10px);\n }\n }\n`;\n\nclass FeaturePopover extends Component {\n static displayName = 'FeaturePopover';\n static style = style;\n static defaultProps = {\n offset: [0, 12],\n placement: 'bottom-start',\n defaultVisible: false,\n onOutsideClick: () => false,\n interaction: {\n trigger: [['onClick']],\n popper: [],\n },\n };\n\n defaultModifiers = [\n {\n name: 'flip',\n enabled: false,\n },\n ];\n\n uncontrolledProps() {\n return {\n visible: null,\n };\n }\n\n handleVisibleChange = (visible) => {\n this.handlers.visible(visible);\n };\n\n handleCloseClick = (e) => {\n this.handlers.visible(false, e);\n };\n\n getPopperProps() {\n const { visible } = this.asProps;\n return {\n visible,\n $onCloseClick: this.handleCloseClick,\n };\n }\n\n getSpotProps() {\n const { visible } = this.asProps;\n return { visible };\n }\n\n render() {\n const { styles, forwardRef, onVisibleChange, modifiers = [], ...other } = this.asProps;\n\n return sstyled(styles)(\n <Popper\n ref={forwardRef}\n onVisibleChange={callAllEventHandlers(onVisibleChange, this.handleVisibleChange)}\n modifiers={[...this.defaultModifiers, ...modifiers]}\n {...other}\n />,\n );\n }\n}\n\nclass FeaturePopoverPopper extends Component {\n static defaultProps = {\n closeIcon: false,\n duration: 200,\n };\n\n render() {\n const SFeaturePopover = Root;\n const SClose = Close;\n const { Children, styles, visible, closeIcon, duration, $onCloseClick } = this.asProps;\n\n return sstyled(styles)(\n <Popper.Popper disableEnforceFocus>\n <Animation\n visible={visible}\n duration={duration}\n keyframes={[stylePopper['@enter'], stylePopper['@exit']]}\n >\n <SFeaturePopover render={Box}>\n {closeIcon ? <SClose onClick={$onCloseClick} /> : null}\n <Children />\n </SFeaturePopover>\n </Animation>\n </Popper.Popper>,\n );\n }\n}\n\nconst Spot = (props) => {\n const SSpot = Root;\n\n const { styles, visible } = props;\n\n if (!visible) return null;\n\n return sstyled(styles)(<SSpot render={Box} />);\n};\n\nexport default createComponent(\n FeaturePopover,\n {\n Trigger: Popper.Trigger,\n Popper: FeaturePopoverPopper,\n Spot,\n },\n { parent: Popper },\n);\n"],"file":"FeaturePopover.js"}
|
|
@@ -8,26 +8,6 @@ SFeaturePopover {
|
|
|
8
8
|
box-sizing: border-box;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
SFeaturePopover[animate='entered'] {
|
|
12
|
-
opacity: 1;
|
|
13
|
-
transform: translateX(0);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
SFeaturePopover[animate='entering'] {
|
|
17
|
-
opacity: 1;
|
|
18
|
-
transform: translateX(0);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
SFeaturePopover[animate='exited'] {
|
|
22
|
-
opacity: 0;
|
|
23
|
-
transform: translateX(-10px);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
SFeaturePopover[animate='exiting'] {
|
|
27
|
-
opacity: 0;
|
|
28
|
-
transform: translateX(-10px);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
11
|
SClose {
|
|
32
12
|
position: absolute;
|
|
33
13
|
right: 0;
|
|
@@ -66,7 +46,9 @@ SSpot {
|
|
|
66
46
|
position: absolute;
|
|
67
47
|
bottom: -4px;
|
|
68
48
|
right: -4px;
|
|
69
|
-
animation: showTrigger
|
|
49
|
+
animation-name: showTrigger;
|
|
50
|
+
animation-duration: 0.2s;
|
|
51
|
+
animation-timing-function: ease-in;
|
|
70
52
|
animation-delay: 0.4s;
|
|
71
53
|
animation-fill-mode: forwards;
|
|
72
54
|
width: 12px;
|
|
@@ -78,7 +60,9 @@ SSpot {
|
|
|
78
60
|
top: 0;
|
|
79
61
|
left: 0;
|
|
80
62
|
transform-origin: 50%;
|
|
81
|
-
|
|
63
|
+
animation-name: scaleSizeAndHide;
|
|
64
|
+
animation-duration: 1s;
|
|
65
|
+
animation-iteration-count: infinite;
|
|
82
66
|
animation-fill-mode: forwards;
|
|
83
67
|
animation-delay: 0.5s;
|
|
84
68
|
background-color: #ffd54f;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ComponentProps } from 'react';
|
|
2
1
|
import { PropGetterFn, CProps, ReturnEl } from '@semcore/core';
|
|
3
2
|
import Popper, { IPopperContext, IPopperPopperProps, IPopperProps } from '@semcore/popper';
|
|
3
|
+
import { Box } from '@semcore/flex-box';
|
|
4
4
|
|
|
5
5
|
export interface IFeaturePopoverPopperProps extends IPopperPopperProps {
|
|
6
6
|
/**
|
|
@@ -21,9 +21,9 @@ export interface IFeaturePopoverContext extends IPopperContext {
|
|
|
21
21
|
declare const FeaturePopover: ((
|
|
22
22
|
props: CProps<IPopperProps, IFeaturePopoverContext>,
|
|
23
23
|
) => ReturnEl) & {
|
|
24
|
-
Trigger:
|
|
24
|
+
Trigger: typeof Popper.Trigger;
|
|
25
25
|
Popper: <T>(props: IFeaturePopoverPopperProps & T) => ReturnEl;
|
|
26
|
-
Spot:
|
|
26
|
+
Spot: typeof Box;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export default FeaturePopover;
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/feature-popover",
|
|
3
3
|
"description": "SEMRush FeaturePopover Component",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.5.0",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
8
9
|
"author": "Roman Lysov <r.lysov@semrush.com>",
|
|
9
10
|
"license": "MIT",
|
|
10
11
|
"scripts": {
|
|
@@ -15,8 +16,8 @@
|
|
|
15
16
|
"@semcore/utils": "^3.15",
|
|
16
17
|
"@semcore/flex-box": "^4",
|
|
17
18
|
"@semcore/popper": "^4.2",
|
|
18
|
-
"@semcore/icon": "^2",
|
|
19
|
-
"
|
|
19
|
+
"@semcore/icon": "^2.16",
|
|
20
|
+
"@semcore/animation": "^1"
|
|
20
21
|
},
|
|
21
22
|
"peerDependencies": {
|
|
22
23
|
"@semcore/core": "^1.11",
|
package/src/FeaturePopover.js
CHANGED
|
@@ -1,13 +1,36 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import createComponent, { Root, Component,
|
|
2
|
+
import { Animation } from '@semcore/animation';
|
|
3
|
+
import createComponent, { Root, Component, sstyled } from '@semcore/core';
|
|
4
4
|
import Popper from '@semcore/popper';
|
|
5
5
|
import { Box } from '@semcore/flex-box';
|
|
6
|
-
import Close from '@semcore/icon/
|
|
7
|
-
import
|
|
6
|
+
import Close from '@semcore/icon/Close/m';
|
|
7
|
+
import { callAllEventHandlers } from '@semcore/utils/lib/assignProps';
|
|
8
8
|
|
|
9
9
|
import style from './style/feature-popover.shadow.css';
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
const stylePopper = sstyled.css`
|
|
12
|
+
@keyframes enter {
|
|
13
|
+
from {
|
|
14
|
+
opacity: 0;
|
|
15
|
+
transform: translateX(-10px);
|
|
16
|
+
}
|
|
17
|
+
to {
|
|
18
|
+
opacity: 1;
|
|
19
|
+
transform: translateX(0);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@keyframes exit {
|
|
24
|
+
from {
|
|
25
|
+
opacity: 1;
|
|
26
|
+
transform: translateX(0);
|
|
27
|
+
}
|
|
28
|
+
to {
|
|
29
|
+
opacity: 0;
|
|
30
|
+
transform: translateX(-10px);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
11
34
|
|
|
12
35
|
class FeaturePopover extends Component {
|
|
13
36
|
static displayName = 'FeaturePopover';
|
|
@@ -60,7 +83,7 @@ class FeaturePopover extends Component {
|
|
|
60
83
|
render() {
|
|
61
84
|
const { styles, forwardRef, onVisibleChange, modifiers = [], ...other } = this.asProps;
|
|
62
85
|
|
|
63
|
-
return
|
|
86
|
+
return sstyled(styles)(
|
|
64
87
|
<Popper
|
|
65
88
|
ref={forwardRef}
|
|
66
89
|
onVisibleChange={callAllEventHandlers(onVisibleChange, this.handleVisibleChange)}
|
|
@@ -82,26 +105,19 @@ class FeaturePopoverPopper extends Component {
|
|
|
82
105
|
const SClose = Close;
|
|
83
106
|
const { Children, styles, visible, closeIcon, duration, $onCloseClick } = this.asProps;
|
|
84
107
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
</If>
|
|
99
|
-
<Children />
|
|
100
|
-
</SFeaturePopover>
|
|
101
|
-
</Popper.Popper>,
|
|
102
|
-
);
|
|
103
|
-
}}
|
|
104
|
-
</CSSTransition>
|
|
108
|
+
return sstyled(styles)(
|
|
109
|
+
<Popper.Popper disableEnforceFocus>
|
|
110
|
+
<Animation
|
|
111
|
+
visible={visible}
|
|
112
|
+
duration={duration}
|
|
113
|
+
keyframes={[stylePopper['@enter'], stylePopper['@exit']]}
|
|
114
|
+
>
|
|
115
|
+
<SFeaturePopover render={Box}>
|
|
116
|
+
{closeIcon ? <SClose onClick={$onCloseClick} /> : null}
|
|
117
|
+
<Children />
|
|
118
|
+
</SFeaturePopover>
|
|
119
|
+
</Animation>
|
|
120
|
+
</Popper.Popper>,
|
|
105
121
|
);
|
|
106
122
|
}
|
|
107
123
|
}
|
|
@@ -111,11 +127,9 @@ const Spot = (props) => {
|
|
|
111
127
|
|
|
112
128
|
const { styles, visible } = props;
|
|
113
129
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
</If>,
|
|
118
|
-
);
|
|
130
|
+
if (!visible) return null;
|
|
131
|
+
|
|
132
|
+
return sstyled(styles)(<SSpot render={Box} />);
|
|
119
133
|
};
|
|
120
134
|
|
|
121
135
|
export default createComponent(
|
package/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ComponentProps } from 'react';
|
|
2
1
|
import { PropGetterFn, CProps, ReturnEl } from '@semcore/core';
|
|
3
2
|
import Popper, { IPopperContext, IPopperPopperProps, IPopperProps } from '@semcore/popper';
|
|
3
|
+
import { Box } from '@semcore/flex-box';
|
|
4
4
|
|
|
5
5
|
export interface IFeaturePopoverPopperProps extends IPopperPopperProps {
|
|
6
6
|
/**
|
|
@@ -21,9 +21,9 @@ export interface IFeaturePopoverContext extends IPopperContext {
|
|
|
21
21
|
declare const FeaturePopover: ((
|
|
22
22
|
props: CProps<IPopperProps, IFeaturePopoverContext>,
|
|
23
23
|
) => ReturnEl) & {
|
|
24
|
-
Trigger:
|
|
24
|
+
Trigger: typeof Popper.Trigger;
|
|
25
25
|
Popper: <T>(props: IFeaturePopoverPopperProps & T) => ReturnEl;
|
|
26
|
-
Spot:
|
|
26
|
+
Spot: typeof Box;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export default FeaturePopover;
|
|
@@ -8,26 +8,6 @@ SFeaturePopover {
|
|
|
8
8
|
box-sizing: border-box;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
SFeaturePopover[animate='entered'] {
|
|
12
|
-
opacity: 1;
|
|
13
|
-
transform: translateX(0);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
SFeaturePopover[animate='entering'] {
|
|
17
|
-
opacity: 1;
|
|
18
|
-
transform: translateX(0);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
SFeaturePopover[animate='exited'] {
|
|
22
|
-
opacity: 0;
|
|
23
|
-
transform: translateX(-10px);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
SFeaturePopover[animate='exiting'] {
|
|
27
|
-
opacity: 0;
|
|
28
|
-
transform: translateX(-10px);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
11
|
SClose {
|
|
32
12
|
position: absolute;
|
|
33
13
|
right: 0;
|
|
@@ -66,7 +46,9 @@ SSpot {
|
|
|
66
46
|
position: absolute;
|
|
67
47
|
bottom: -4px;
|
|
68
48
|
right: -4px;
|
|
69
|
-
animation: showTrigger
|
|
49
|
+
animation-name: showTrigger;
|
|
50
|
+
animation-duration: 0.2s;
|
|
51
|
+
animation-timing-function: ease-in;
|
|
70
52
|
animation-delay: 0.4s;
|
|
71
53
|
animation-fill-mode: forwards;
|
|
72
54
|
width: 12px;
|
|
@@ -78,7 +60,9 @@ SSpot {
|
|
|
78
60
|
top: 0;
|
|
79
61
|
left: 0;
|
|
80
62
|
transform-origin: 50%;
|
|
81
|
-
|
|
63
|
+
animation-name: scaleSizeAndHide;
|
|
64
|
+
animation-duration: 1s;
|
|
65
|
+
animation-iteration-count: infinite;
|
|
82
66
|
animation-fill-mode: forwards;
|
|
83
67
|
animation-delay: 0.5s;
|
|
84
68
|
background-color: #ffd54f;
|