@semcore/feature-popover 2.6.3 → 2.6.6
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 +18 -0
- package/lib/cjs/FeaturePopover.js +2 -4
- package/lib/cjs/FeaturePopover.js.map +1 -1
- package/lib/cjs/index.d.ts +29 -0
- package/lib/cjs/index.js +2 -19
- package/lib/cjs/index.js.map +1 -1
- package/lib/es6/FeaturePopover.js +2 -5
- package/lib/es6/FeaturePopover.js.map +1 -1
- package/lib/es6/index.d.ts +29 -0
- package/lib/es6/index.js +0 -1
- package/lib/es6/index.js.map +1 -1
- package/package.json +4 -1
- package/src/index.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [2.6.6] - 2022-05-16
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Version patch update due to children dependencies update (`@semcore/icon` [2.21.0 ~> 2.24.0]).
|
|
10
|
+
|
|
11
|
+
## [2.6.5] - 2022-04-28
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Version patch update due to children dependencies update (`@semcore/icon` [2.20.0 ~> 2.21.0]).
|
|
16
|
+
|
|
17
|
+
## [2.6.4] - 2022-04-03
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Version patch update due to children dependencies update (`@semcore/animation` [1.5.0 ~> 1.5.0]).
|
|
22
|
+
|
|
5
23
|
## [2.6.3] - 2022-03-21
|
|
6
24
|
|
|
7
25
|
### Changed
|
|
@@ -41,8 +41,6 @@ var _m = _interopRequireDefault(require("@semcore/icon/Close/m"));
|
|
|
41
41
|
|
|
42
42
|
var _assignProps3 = require("@semcore/utils/lib/assignProps");
|
|
43
43
|
|
|
44
|
-
var _this2 = void 0;
|
|
45
|
-
|
|
46
44
|
var _excluded = ["styles", "forwardRef", "onVisibleChange", "modifiers"];
|
|
47
45
|
|
|
48
46
|
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); }
|
|
@@ -188,7 +186,7 @@ var FeaturePopoverPopper = /*#__PURE__*/function (_Component2) {
|
|
|
188
186
|
(0, _createClass2["default"])(FeaturePopoverPopper, [{
|
|
189
187
|
key: "render",
|
|
190
188
|
value: function render() {
|
|
191
|
-
var _ref = this
|
|
189
|
+
var _ref = this.asProps,
|
|
192
190
|
_ref4;
|
|
193
191
|
|
|
194
192
|
var SFeaturePopover = _flexBox.Box;
|
|
@@ -220,7 +218,7 @@ var FeaturePopoverPopper = /*#__PURE__*/function (_Component2) {
|
|
|
220
218
|
});
|
|
221
219
|
|
|
222
220
|
var Spot = function Spot(props) {
|
|
223
|
-
var _ref2 =
|
|
221
|
+
var _ref2 = arguments[0],
|
|
224
222
|
_ref5;
|
|
225
223
|
|
|
226
224
|
var SSpot = _flexBox.Box;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/FeaturePopover.jsx"],"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","Spot","props","SSpot","Trigger","Popper","parent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;AAFA;;AACA;;AAEA;;AACA;;AACA;;AACA
|
|
1
|
+
{"version":3,"sources":["../../src/FeaturePopover.jsx"],"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","Spot","props","SSpot","Trigger","Popper","parent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;AAFA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAMA,WAAW;AAAA;AAAGC,oBAAH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAjB;;IAwBMC,c;;;;;;;;;;;;;;;yGAce,CACjB;AACEC,MAAAA,IAAI,EAAE,MADR;AAEEC,MAAAA,OAAO,EAAE;AAFX,KADiB,C;4GAaG,UAACC,OAAD,EAAa;AACjC,YAAKC,QAAL,CAAcD,OAAd,CAAsBA,OAAtB;AACD,K;yGAEkB,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;AACf,UAAQA,OAAR,GAAoB,KAAKG,OAAzB,CAAQH,OAAR;AACA,aAAO;AACLA,QAAAA,OAAO,EAAPA,OADK;AAELI,QAAAA,aAAa,EAAE,KAAKC;AAFf,OAAP;AAID;;;WAED,wBAAe;AACb,UAAQL,OAAR,GAAoB,KAAKG,OAAzB,CAAQH,OAAR;AACA,aAAO;AAAEA,QAAAA,OAAO,EAAPA;AAAF,OAAP;AACD;;;WAED,kBAAS;AAAA;;AACP,0BAA0E,KAAKG,OAA/E;AAAA,UAAQG,MAAR,iBAAQA,MAAR;AAAA,UAAgBC,UAAhB,iBAAgBA,UAAhB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,oBAEY6B,QAFZ;AAAA,qBAGa,CAAClC,WAAW,CAAC,QAAD,CAAZ,EAAwBA,WAAW,CAAC,OAAD,CAAnC;AAHb,uBAKE,gCAAC,eAAD,oFACGiC,SAAS,gBAAG,gCAAC,MAAD;AAAA,mBAAiBxB;AAAjB,SAAH,GAAwC,IADpD,eAEE,gCAAC,QAAD,2BAFF,CALF,CADF,CADF;AAcD;;;EAzBgCS,e;;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;AAEA,MAAQlB,MAAR,GAA4ByB,KAA5B,CAAQzB,MAAR;AAAA,MAAgBN,OAAhB,GAA4B+B,KAA5B,CAAgB/B,OAAhB;AAEA,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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PropGetterFn, CProps, ReturnEl } from '@semcore/core';
|
|
2
|
+
import Popper, { IPopperContext, IPopperPopperProps, IPopperProps } from '@semcore/popper';
|
|
3
|
+
import { Box } from '@semcore/flex-box';
|
|
4
|
+
|
|
5
|
+
export interface IFeaturePopoverPopperProps extends IPopperPopperProps {
|
|
6
|
+
/**
|
|
7
|
+
* The property responsible for the visibility of the closing icon
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
10
|
+
closeIcon?: boolean;
|
|
11
|
+
/** Animation display duration in `ms`
|
|
12
|
+
* @default 200
|
|
13
|
+
*/
|
|
14
|
+
duration?: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface IFeaturePopoverContext extends IPopperContext {
|
|
18
|
+
getSpotProps: PropGetterFn;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare const FeaturePopover: ((
|
|
22
|
+
props: CProps<IPopperProps, IFeaturePopoverContext>,
|
|
23
|
+
) => ReturnEl) & {
|
|
24
|
+
Trigger: typeof Popper.Trigger;
|
|
25
|
+
Popper: <T>(props: IFeaturePopoverPopperProps & T) => ReturnEl;
|
|
26
|
+
Spot: typeof Box;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default FeaturePopover;
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
var _exportNames = {};
|
|
9
8
|
Object.defineProperty(exports, "default", {
|
|
10
9
|
enumerable: true,
|
|
11
10
|
get: function get() {
|
|
@@ -13,21 +12,5 @@ Object.defineProperty(exports, "default", {
|
|
|
13
12
|
}
|
|
14
13
|
});
|
|
15
14
|
|
|
16
|
-
var _FeaturePopover =
|
|
17
|
-
|
|
18
|
-
Object.keys(_FeaturePopover).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
21
|
-
if (key in exports && exports[key] === _FeaturePopover[key]) return;
|
|
22
|
-
Object.defineProperty(exports, key, {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function get() {
|
|
25
|
-
return _FeaturePopover[key];
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
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); }
|
|
31
|
-
|
|
32
|
-
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 _FeaturePopover = _interopRequireDefault(require("./FeaturePopover"));
|
|
33
16
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './FeaturePopover';\n"],"file":"index.js"}
|
|
@@ -10,9 +10,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
10
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
|
-
|
|
14
|
-
var _this2 = this;
|
|
15
|
-
|
|
16
13
|
var _excluded = ["styles", "forwardRef", "onVisibleChange", "modifiers"];
|
|
17
14
|
|
|
18
15
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -171,7 +168,7 @@ var FeaturePopoverPopper = /*#__PURE__*/function (_Component2) {
|
|
|
171
168
|
_createClass(FeaturePopoverPopper, [{
|
|
172
169
|
key: "render",
|
|
173
170
|
value: function render() {
|
|
174
|
-
var _ref = this
|
|
171
|
+
var _ref = this.asProps,
|
|
175
172
|
_ref4;
|
|
176
173
|
|
|
177
174
|
var SFeaturePopover = Box;
|
|
@@ -204,7 +201,7 @@ _defineProperty(FeaturePopoverPopper, "defaultProps", {
|
|
|
204
201
|
});
|
|
205
202
|
|
|
206
203
|
var Spot = function Spot(props) {
|
|
207
|
-
var _ref2 =
|
|
204
|
+
var _ref2 = arguments[0],
|
|
208
205
|
_ref5;
|
|
209
206
|
|
|
210
207
|
var SSpot = Box;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/FeaturePopover.jsx"],"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":"
|
|
1
|
+
{"version":3,"sources":["../../src/FeaturePopover.jsx"],"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,KAA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B,eAAe,CAC5BS,cAD4B,EAE5B;AACEiC,EAAAA,OAAO,EAAEtC,MAAM,CAACsC,OADlB;AAEEtC,EAAAA,MAAM,EAAE6B,oBAFV;AAGEM,EAAAA,IAAI,EAAJA;AAHF,CAF4B,EAO5B;AAAEI,EAAAA,MAAM,EAAEvC;AAAV,CAP4B,CAA9B","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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PropGetterFn, CProps, ReturnEl } from '@semcore/core';
|
|
2
|
+
import Popper, { IPopperContext, IPopperPopperProps, IPopperProps } from '@semcore/popper';
|
|
3
|
+
import { Box } from '@semcore/flex-box';
|
|
4
|
+
|
|
5
|
+
export interface IFeaturePopoverPopperProps extends IPopperPopperProps {
|
|
6
|
+
/**
|
|
7
|
+
* The property responsible for the visibility of the closing icon
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
10
|
+
closeIcon?: boolean;
|
|
11
|
+
/** Animation display duration in `ms`
|
|
12
|
+
* @default 200
|
|
13
|
+
*/
|
|
14
|
+
duration?: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface IFeaturePopoverContext extends IPopperContext {
|
|
18
|
+
getSpotProps: PropGetterFn;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare const FeaturePopover: ((
|
|
22
|
+
props: CProps<IPopperProps, IFeaturePopoverContext>,
|
|
23
|
+
) => ReturnEl) & {
|
|
24
|
+
Trigger: typeof Popper.Trigger;
|
|
25
|
+
Popper: <T>(props: IFeaturePopoverPopperProps & T) => ReturnEl;
|
|
26
|
+
Spot: typeof Box;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default FeaturePopover;
|
package/lib/es6/index.js
CHANGED
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.js"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,kBAAxB
|
|
1
|
+
{"version":3,"sources":["../../src/index.js"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,kBAAxB","sourcesContent":["export { default } from './FeaturePopover';\n"],"file":"index.js"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/feature-popover",
|
|
3
3
|
"description": "SEMRush FeaturePopover Component",
|
|
4
|
-
"version": "2.6.
|
|
4
|
+
"version": "2.6.6",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -30,5 +30,8 @@
|
|
|
30
30
|
"type": "git",
|
|
31
31
|
"url": "https://github.com/semrush/intergalactic.git",
|
|
32
32
|
"directory": "semcore/feature-popover"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@semcore/jest-preset-ui": "1.0.0"
|
|
33
36
|
}
|
|
34
37
|
}
|
package/src/index.js
CHANGED