@semcore/feature-popover 17.1.0 → 17.2.0-prerelease.5
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 +6 -0
- package/lib/cjs/FeaturePopover.js +20 -14
- package/lib/cjs/FeaturePopover.js.map +1 -1
- package/lib/cjs/FeaturePopover.type.js.map +1 -1
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/FeaturePopover.js +20 -14
- package/lib/es6/FeaturePopover.js.map +1 -1
- package/lib/es6/FeaturePopover.type.js.map +1 -1
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/esm/FeaturePopover.mjs +18 -17
- package/lib/types/FeaturePopover.d.ts +5 -0
- package/lib/types/FeaturePopover.type.d.ts +11 -0
- package/lib/types/translations/__intergalactic-dynamic-locales.d.ts +1 -0
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -15,24 +15,24 @@ var _m = _interopRequireDefault(require("@semcore/icon/Close/m"));
|
|
|
15
15
|
var _react = _interopRequireDefault(require("react"));
|
|
16
16
|
var _intergalacticDynamicLocales = require("./translations/__intergalactic-dynamic-locales");
|
|
17
17
|
/*!__reshadow-styles__:"./style/feature-popover.shadow.css"*/
|
|
18
|
-
const style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/"
|
|
18
|
+
const style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___SFeaturePopover_1dpi4_gg_{padding:var(--intergalactic-spacing-4x,16px) var(--intergalactic-spacing-10x,40px) var(--intergalactic-spacing-4x,16px) var(--intergalactic-spacing-4x,16px);border-radius:var(--intergalactic-popper-rounded,6px);box-sizing:border-box;box-shadow:var(--intergalactic-box-shadow-popper,1px 1px 10px 0 #00151012);position:relative}@supports (color:color(display-p3 0 0 0%)){.___SFeaturePopover_1dpi4_gg_{box-shadow:var(--intergalactic-box-shadow-popper,1px 1px 10px 0 #00151012)}@media (color-gamut:p3){.___SFeaturePopover_1dpi4_gg_{box-shadow:var(--intergalactic-box-shadow-popper,1px 1px 10px 0 color(display-p3 .01753 .08157 .06372/.07))}}}.___SFeaturePopover_1dpi4_gg_._theme_accent_1dpi4_gg_{background-color:var(--intergalactic-feature-popover-bg,#e1cdff);color:var(--intergalactic-text-primary,#010500e5)}@supports (color:color(display-p3 0 0 0%)){.___SFeaturePopover_1dpi4_gg_._theme_accent_1dpi4_gg_{background-color:var(--intergalactic-feature-popover-bg,#e1cdff)}@media (color-gamut:p3){.___SFeaturePopover_1dpi4_gg_._theme_accent_1dpi4_gg_{background-color:var(--intergalactic-feature-popover-bg,color(display-p3 .87005 .8017 .99841))}}}.___SFeaturePopover_1dpi4_gg_._theme_neutral_1dpi4_gg_{background-color:var(--intergalactic-feature-popover-bg-neutral,#1a1e1a);color:var(--intergalactic-text-primary-invert,#fefffff2)}.___STrigger_1dpi4_gg_{position:relative}.___SClose_1dpi4_gg_{position:absolute;z-index:1;right:var(--intergalactic-spacing-2x,8px);top:var(--intergalactic-spacing-2x,8px)}.___SClose_1dpi4_gg_ .___SAddon_1dpi4_gg_:only-child{margin-left:calc(var(--intergalactic-spacing-2x, 8px) - 1px);margin-right:calc(var(--intergalactic-spacing-2x, 8px) - 1px)}@keyframes showTrigger_1dpi4{0%{opacity:0}to{opacity:1}}@keyframes scaleSizeAndHide_1dpi4{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(2)}}.___SSpot_1dpi4_gg_{position:absolute;bottom:calc(var(--intergalactic-spacing-1x, 4px)*-1);right:calc(var(--intergalactic-spacing-1x, 4px)*-1);animation-name:showTrigger_1dpi4;animation-duration:.2s;animation-timing-function:ease-in;animation-delay:.4s;animation-fill-mode:forwards;width:12px;height:12px}.___SSpot_1dpi4_gg_:before{transform-origin:50%;animation-name:scaleSizeAndHide_1dpi4;animation-duration:1s;animation-iteration-count:infinite;animation-fill-mode:forwards;animation-delay:.5s}.___SSpot_1dpi4_gg_:after,.___SSpot_1dpi4_gg_:before{content:\"\";position:absolute;top:0;left:0;border-radius:50%;width:12px;height:12px}.___SSpot_1dpi4_gg_._theme_accent_1dpi4_gg_:before{background-color:var(--intergalactic-feature-popover-dot-outer-border,#e1cdff)}@supports (color:color(display-p3 0 0 0%)){.___SSpot_1dpi4_gg_._theme_accent_1dpi4_gg_:before{background-color:var(--intergalactic-feature-popover-dot-outer-border,#e1cdff)}@media (color-gamut:p3){.___SSpot_1dpi4_gg_._theme_accent_1dpi4_gg_:before{background-color:var(--intergalactic-feature-popover-dot-outer-border,color(display-p3 .87005 .8017 .99841))}}}.___SSpot_1dpi4_gg_._theme_accent_1dpi4_gg_:after{background-color:var(--intergalactic-feature-popover-bg,#e1cdff)}@supports (color:color(display-p3 0 0 0%)){.___SSpot_1dpi4_gg_._theme_accent_1dpi4_gg_:after{background-color:var(--intergalactic-feature-popover-bg,#e1cdff)}@media (color-gamut:p3){.___SSpot_1dpi4_gg_._theme_accent_1dpi4_gg_:after{background-color:var(--intergalactic-feature-popover-bg,color(display-p3 .87005 .8017 .99841))}}}.___SSpot_1dpi4_gg_._theme_neutral_1dpi4_gg_:before{background-color:var(--intergalactic-feature-popover-dot-neutral-outer-border,#e1cdff)}@supports (color:color(display-p3 0 0 0%)){.___SSpot_1dpi4_gg_._theme_neutral_1dpi4_gg_:before{background-color:var(--intergalactic-feature-popover-dot-neutral-outer-border,#e1cdff)}@media (color-gamut:p3){.___SSpot_1dpi4_gg_._theme_neutral_1dpi4_gg_:before{background-color:var(--intergalactic-feature-popover-dot-neutral-outer-border,color(display-p3 .87005 .8017 .99841))}}}.___SSpot_1dpi4_gg_._theme_neutral_1dpi4_gg_:after{background-color:var(--intergalactic-feature-popover-dot-neutral,#e1cdff)}@supports (color:color(display-p3 0 0 0%)){.___SSpot_1dpi4_gg_._theme_neutral_1dpi4_gg_:after{background-color:var(--intergalactic-feature-popover-dot-neutral,#e1cdff)}@media (color-gamut:p3){.___SSpot_1dpi4_gg_._theme_neutral_1dpi4_gg_:after{background-color:var(--intergalactic-feature-popover-dot-neutral,color(display-p3 .87005 .8017 .99841))}}}@media (prefers-reduced-motion){.___SSpot_1dpi4_gg_,.___SSpot_1dpi4_gg_:before{animation-name:none}}", /*__inner_css_end__*/"1dpi4_gg_"),
|
|
19
19
|
/*__reshadow_css_end__*/
|
|
20
20
|
{
|
|
21
|
-
"__STrigger": "
|
|
22
|
-
"@showTrigger": "
|
|
23
|
-
"@scaleSizeAndHide": "
|
|
24
|
-
"__SFeaturePopover": "
|
|
25
|
-
"_theme_accent": "
|
|
26
|
-
"_theme_neutral": "
|
|
27
|
-
"__SClose": "
|
|
28
|
-
"__SAddon": "
|
|
29
|
-
"__SSpot": "
|
|
21
|
+
"__STrigger": "___STrigger_1dpi4_gg_",
|
|
22
|
+
"@showTrigger": "showTrigger_1dpi4",
|
|
23
|
+
"@scaleSizeAndHide": "scaleSizeAndHide_1dpi4",
|
|
24
|
+
"__SFeaturePopover": "___SFeaturePopover_1dpi4_gg_",
|
|
25
|
+
"_theme_accent": "_theme_accent_1dpi4_gg_",
|
|
26
|
+
"_theme_neutral": "_theme_neutral_1dpi4_gg_",
|
|
27
|
+
"__SClose": "___SClose_1dpi4_gg_",
|
|
28
|
+
"__SAddon": "___SAddon_1dpi4_gg_",
|
|
29
|
+
"__SSpot": "___SSpot_1dpi4_gg_"
|
|
30
30
|
});
|
|
31
|
-
const stylePopper = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/"@keyframes
|
|
31
|
+
const stylePopper = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/"@keyframes enter_5mxl8{0%{opacity:0;transform:translateX(-10px)}to{opacity:1;transform:translateX(0)}}@keyframes exit_5mxl8{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-10px)}}", /*__inner_css_end__*/"5mxl8_gg_"),
|
|
32
32
|
/*__reshadow_css_end__*/
|
|
33
33
|
{
|
|
34
|
-
"@enter": "
|
|
35
|
-
"@exit": "
|
|
34
|
+
"@enter": "enter_5mxl8",
|
|
35
|
+
"@exit": "exit_5mxl8"
|
|
36
36
|
});
|
|
37
37
|
const enhance = [(0, _i18nEnhance.default)(_intergalacticDynamicLocales.localizedMessages)];
|
|
38
38
|
class FeaturePopover extends _core.Component {
|
|
@@ -100,7 +100,7 @@ class FeaturePopover extends _core.Component {
|
|
|
100
100
|
offset: [0, 12],
|
|
101
101
|
placement: 'bottom-start',
|
|
102
102
|
defaultVisible: false,
|
|
103
|
-
onOutsideClick: () =>
|
|
103
|
+
onOutsideClick: () => {},
|
|
104
104
|
interaction: 'none',
|
|
105
105
|
i18n: _intergalacticDynamicLocales.localizedMessages,
|
|
106
106
|
locale: 'en',
|
|
@@ -203,6 +203,12 @@ function Spot(props) {
|
|
|
203
203
|
...(0, _core.assignProps)({}, _ref3)
|
|
204
204
|
}));
|
|
205
205
|
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* FeaturePopover
|
|
209
|
+
*
|
|
210
|
+
* {@link https://developer.semrush.com/intergalactic/components/feature-popover/feature-popover-api/|API} | {@link https://developer.semrush.com/intergalactic/components/feature-popover/feature-popover-code/|Examples}
|
|
211
|
+
*/
|
|
206
212
|
var _default = exports.default = (0, _core.createComponent)(FeaturePopover, {
|
|
207
213
|
Trigger: Trigger,
|
|
208
214
|
Popper: FeaturePopoverPopper,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeaturePopover.js","names":["_core","require","_baseComponents","_button","_interopRequireDefault","_assignProps4","_i18nEnhance","_m","_react","_intergalacticDynamicLocales","style","sstyled","insert","stylePopper","enhance","i18nEnhance","localizedMessages","FeaturePopover","Component","constructor","args","_defineProperty2","default","name","enabled","visible","handlers","e","uncontrolledProps","getPopperProps","getI18nText","theme","asProps","$onCloseClick","handleCloseClick","getSpotProps","render","_ref4","styles","forwardRef","onVisibleChange","modifiers","other","createElement","Popper","cn","callAllEventHandlers","handleVisibleChange","defaultModifiers","offset","placement","defaultVisible","onOutsideClick","interaction","i18n","locale","Trigger","Children","_ref","arguments[0]","_ref5","STrigger","assignProps","Box","FeaturePopoverPopper","React","createRef","componentDidMount","autoFocus","setTimeout","popperRef","current","focus","_ref2","_ref6","SFeaturePopover","SClose","Button","closeIcon","duration","animationsDisabled","zIndex","ariaLabel","ariaDescribedBy","ariaLabelledby","title","ref","disableEnforceFocus","tabIndex","role","Animation","CloseIcon","Spot","props","_ref3","_ref7","SSpot","_default","exports","createComponent","parent"],"sources":["../../src/FeaturePopover.tsx"],"sourcesContent":["import { Box, Popper, Animation } from '@semcore/base-components';\nimport Button from '@semcore/button';\nimport type { IRootComponentProps } from '@semcore/core';\nimport { createComponent, Root, Component, sstyled } from '@semcore/core';\nimport { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport CloseIcon from '@semcore/icon/Close/m';\nimport React from 'react';\n\nimport type {\n FeaturePopoverProps,\n FeaturePopoverComponent,\n FeaturePopoverSpotProps,\n FeaturePopoverPopperProps,\n FeaturePopoverPopperInnerProps,\n} from './FeaturePopover.type';\nimport style from './style/feature-popover.shadow.css';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\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\nconst enhance = [\n i18nEnhance(localizedMessages),\n] as const;\n\nclass FeaturePopover extends Component<FeaturePopoverProps, typeof enhance, { visible: null }> {\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: 'none',\n i18n: localizedMessages,\n locale: 'en',\n theme: 'accent',\n };\n\n static enhance = enhance;\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: boolean) => {\n this.handlers.visible(visible);\n };\n\n handleCloseClick = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n this.handlers.visible(false, e);\n };\n\n getPopperProps() {\n const { visible, getI18nText, theme } = this.asProps;\n return {\n visible,\n $onCloseClick: this.handleCloseClick,\n getI18nText,\n theme,\n };\n }\n\n getSpotProps() {\n const { visible, theme } = this.asProps;\n return { visible, theme };\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\nfunction Trigger({ Children, styles }: IRootComponentProps) {\n const STrigger = Root;\n return sstyled(styles)(\n <STrigger render={Popper.Trigger} tag={Box} aria-haspopup={false}>\n <Children />\n </STrigger>,\n );\n}\n\nclass FeaturePopoverPopper extends Component<FeaturePopoverPopperProps, [], {}, FeaturePopoverPopperInnerProps> {\n static defaultProps = {\n closeIcon: false,\n duration: 200,\n autoFocus: true,\n };\n\n popperRef = React.createRef<HTMLDivElement>();\n\n componentDidMount() {\n if (this.asProps.autoFocus) {\n setTimeout(() => {\n this.popperRef.current?.focus();\n }, 0);\n }\n }\n\n render() {\n const SFeaturePopover = Root;\n const SClose = Button;\n const {\n Children,\n styles,\n visible,\n closeIcon,\n duration,\n $onCloseClick,\n animationsDisabled,\n getI18nText,\n zIndex,\n 'aria-label': ariaLabel,\n 'aria-describedby': ariaDescribedBy,\n 'aria-labelledby': ariaLabelledby,\n title,\n theme,\n } = this.asProps;\n\n return sstyled(styles)(\n <Popper.Popper\n ref={this.popperRef}\n disableEnforceFocus\n zIndex={zIndex}\n tabIndex={0}\n role='dialog'\n aria-describedby={ariaDescribedBy}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n title={title}\n >\n <Animation\n visible={visible}\n duration={duration}\n keyframes={[stylePopper['@enter'], stylePopper['@exit']]}\n initialAnimation\n animationsDisabled={animationsDisabled}\n >\n <SFeaturePopover\n render={Box}\n __excludeProps={['aria-label', 'aria-describedBy', 'title']}\n >\n {closeIcon && (\n <SClose\n aria-label={getI18nText('close')}\n onClick={$onCloseClick}\n use='tertiary'\n theme={theme === 'accent' ? 'muted' : 'invert'}\n size='m'\n addonLeft={CloseIcon}\n type='button'\n />\n )}\n <Children />\n </SFeaturePopover>\n </Animation>\n </Popper.Popper>,\n );\n }\n}\n\nfunction Spot(props: IRootComponentProps & FeaturePopoverSpotProps) {\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: Trigger,\n Popper: FeaturePopoverPopper,\n Spot,\n },\n // @ts-ignore\n { parent: Popper },\n) as FeaturePopoverComponent;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AAGA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,EAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,MAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAUA,IAAAQ,4BAAA,GAAAR,OAAA;AAAmF;AAAA,MAAAS,KAAA,8BAAAV,KAAA,CAAAW,OAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAEnF,MAAMC,WAAW,8BAAGF,aAAO,CAAAC,MAAI;AAAA;AAAA;EAAA;EAAA;AAAA,EAsB9B;AA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,EAAC2B,MAAM,CAAC,eAAC9B,MAAA,CAAAc,OAAA,CAAAqB,aAAA,CAACqD,KAAK,EAAAD,KAAA,CAAAlD,EAAA;IAAA,OAAA7C,KAAA,CAAA8D,WAAA,MAAAgC,KAAA;EAAA,EAAe,CAAC;AAC/C;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAA5E,OAAA,GAEc,IAAA6E,qBAAe,EAC5BlF,cAAc,EACd;EACEuC,OAAO,EAAEA,OAAO;EAChBZ,MAAM,EAAEoB,oBAAoB;EAC5B4B;AACF,CAAC;AACD;AACA;EAAEQ,MAAM,EAAExD;AAAO,CACnB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FeaturePopover.js","names":["_core","require","_baseComponents","_button","_interopRequireDefault","_assignProps4","_i18nEnhance","_m","_react","_intergalacticDynamicLocales","style","sstyled","insert","stylePopper","enhance","i18nEnhance","localizedMessages","FeaturePopover","Component","constructor","args","_defineProperty2","default","name","enabled","visible","handlers","e","uncontrolledProps","getPopperProps","getI18nText","theme","asProps","$onCloseClick","handleCloseClick","getSpotProps","render","_ref4","styles","forwardRef","onVisibleChange","modifiers","other","createElement","Popper","cn","callAllEventHandlers","handleVisibleChange","defaultModifiers","offset","placement","defaultVisible","onOutsideClick","interaction","i18n","locale","Trigger","Children","_ref","arguments[0]","_ref5","STrigger","assignProps","Box","FeaturePopoverPopper","React","createRef","componentDidMount","autoFocus","setTimeout","popperRef","current","focus","_ref2","_ref6","SFeaturePopover","SClose","Button","closeIcon","duration","animationsDisabled","zIndex","ariaLabel","ariaDescribedBy","ariaLabelledby","title","ref","disableEnforceFocus","tabIndex","role","Animation","CloseIcon","Spot","props","_ref3","_ref7","SSpot","_default","exports","createComponent","parent"],"sources":["../../src/FeaturePopover.tsx"],"sourcesContent":["import type { PopperProps } from '@semcore/base-components';\nimport { Box, Popper, Animation } from '@semcore/base-components';\nimport Button from '@semcore/button';\nimport type { IRootComponentProps } from '@semcore/core';\nimport { createComponent, Root, Component, sstyled } from '@semcore/core';\nimport { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';\nimport type { WithI18nEnhanceProps } from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport CloseIcon from '@semcore/icon/Close/m';\nimport React from 'react';\n\nimport type {\n FeaturePopoverProps,\n FeaturePopoverComponent,\n FeaturePopoverSpotProps,\n FeaturePopoverPopperProps,\n FeaturePopoverPopperInnerProps,\n FeaturePopoverDefaultProps,\n} from './FeaturePopover.type';\nimport style from './style/feature-popover.shadow.css';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\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\nconst enhance = [\n i18nEnhance(localizedMessages),\n] as const;\n\ntype FeaturePopoverInternalProps = {\n interaction?: PopperProps['interaction'];\n};\n\nclass FeaturePopover extends Component<\n FeaturePopoverProps,\n typeof enhance,\n { visible: null },\n WithI18nEnhanceProps & FeaturePopoverInternalProps,\n {},\n FeaturePopoverDefaultProps\n> {\n static displayName = 'FeaturePopover';\n static style = style;\n static defaultProps: FeaturePopoverDefaultProps = {\n offset: [0, 12],\n placement: 'bottom-start',\n defaultVisible: false,\n onOutsideClick: () => {},\n interaction: 'none',\n i18n: localizedMessages,\n locale: 'en',\n theme: 'accent',\n };\n\n static enhance = enhance;\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: boolean) => {\n this.handlers.visible(visible);\n };\n\n handleCloseClick = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n this.handlers.visible(false, e);\n };\n\n getPopperProps() {\n const { visible, getI18nText, theme } = this.asProps;\n return {\n visible,\n $onCloseClick: this.handleCloseClick,\n getI18nText,\n theme,\n };\n }\n\n getSpotProps() {\n const { visible, theme } = this.asProps;\n return { visible, theme };\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\nfunction Trigger({ Children, styles }: IRootComponentProps) {\n const STrigger = Root;\n return sstyled(styles)(\n <STrigger render={Popper.Trigger} tag={Box} aria-haspopup={false}>\n <Children />\n </STrigger>,\n );\n}\n\nclass FeaturePopoverPopper extends Component<FeaturePopoverPopperProps, [], {}, FeaturePopoverPopperInnerProps> {\n static defaultProps = {\n closeIcon: false,\n duration: 200,\n autoFocus: true,\n };\n\n popperRef = React.createRef<HTMLDivElement>();\n\n componentDidMount() {\n if (this.asProps.autoFocus) {\n setTimeout(() => {\n this.popperRef.current?.focus();\n }, 0);\n }\n }\n\n render() {\n const SFeaturePopover = Root;\n const SClose = Button;\n const {\n Children,\n styles,\n visible,\n closeIcon,\n duration,\n $onCloseClick,\n animationsDisabled,\n getI18nText,\n zIndex,\n 'aria-label': ariaLabel,\n 'aria-describedby': ariaDescribedBy,\n 'aria-labelledby': ariaLabelledby,\n title,\n theme,\n } = this.asProps;\n\n return sstyled(styles)(\n <Popper.Popper\n ref={this.popperRef}\n disableEnforceFocus\n zIndex={zIndex}\n tabIndex={0}\n role='dialog'\n aria-describedby={ariaDescribedBy}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n title={title}\n >\n <Animation\n visible={visible}\n duration={duration}\n keyframes={[stylePopper['@enter'], stylePopper['@exit']]}\n initialAnimation\n animationsDisabled={animationsDisabled}\n >\n <SFeaturePopover\n render={Box}\n __excludeProps={['aria-label', 'aria-describedBy', 'title']}\n >\n {closeIcon && (\n <SClose\n aria-label={getI18nText('close')}\n onClick={$onCloseClick}\n use='tertiary'\n theme={theme === 'accent' ? 'muted' : 'invert'}\n size='m'\n addonLeft={CloseIcon}\n type='button'\n />\n )}\n <Children />\n </SFeaturePopover>\n </Animation>\n </Popper.Popper>,\n );\n }\n}\n\nfunction Spot(props: IRootComponentProps & FeaturePopoverSpotProps) {\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\n/**\n * FeaturePopover\n *\n * {@link https://developer.semrush.com/intergalactic/components/feature-popover/feature-popover-api/|API} | {@link https://developer.semrush.com/intergalactic/components/feature-popover/feature-popover-code/|Examples}\n */\nexport default createComponent<\n FeaturePopoverComponent,\n typeof FeaturePopover\n>(\n FeaturePopover,\n {\n Trigger: Trigger,\n Popper: FeaturePopoverPopper,\n Spot,\n },\n // @ts-ignore\n { parent: Popper },\n);\n"],"mappings":";;;;;;;;AAIA,IAAAA,KAAA,GAAAC,OAAA;AAHA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AAGA,IAAAI,aAAA,GAAAJ,OAAA;AAEA,IAAAK,YAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,EAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,MAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAWA,IAAAQ,4BAAA,GAAAR,OAAA;AAAmF;AAAA,MAAAS,KAAA,8BAAAV,KAAA,CAAAW,OAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAEnF,MAAMC,WAAW,8BAAGF,aAAO,CAAAC,MAAI;AAAA;AAAA;EAAA;EAAA;AAAA,EAsB9B;AAED,MAAME,OAAO,GAAG,CACd,IAAAC,oBAAW,EAACC,8CAAiB,CAAC,CACtB;AAMV,MAAMC,cAAc,S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AAD,KAAA,CAAAlD,EAAA;IAAA,OAAA7C,KAAA,CAAA8D,WAAA,MAAAgC,KAAA;EAAA,EAAe,CAAC;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AAJA,IAAAG,QAAA,GAAAC,OAAA,CAAA5E,OAAA,GAKe,IAAA6E,qBAAe,EAI5BlF,cAAc,EACd;EACEuC,OAAO,EAAEA,OAAO;EAChBZ,MAAM,EAAEoB,oBAAoB;EAC5B4B;AACF,CAAC;AACD;AACA;EAAEQ,MAAM,EAAExD;AAAO,CACnB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeaturePopover.type.js","names":[],"sources":["../../src/FeaturePopover.type.ts"],"sourcesContent":["import type { Options as OptionsArrow } from '@popperjs/core/lib/modifiers/arrow';\nimport type { Options as OptionsComputeStyles } from '@popperjs/core/lib/modifiers/computeStyles';\nimport type { Options as OptionsEventListeners } from '@popperjs/core/lib/modifiers/eventListeners';\nimport type { Options as OptionsFlip } from '@popperjs/core/lib/modifiers/flip';\nimport type { Options as OptionsOffset } from '@popperjs/core/lib/modifiers/offset';\nimport type { Options as OptionsPreventOverflow } from '@popperjs/core/lib/modifiers/preventOverflow';\nimport type { Modifier, Options, PositioningStrategy } from '@popperjs/core/lib/types';\nimport type {\n AnimationProps,\n BoxProps,\n OutsideClickProps,\n PortalProps,\n Box, PopperContext, PopperPopperProps, Placement, Popper } from '@semcore/base-components';\nimport type { Intergalactic, PropGetterFn } from '@semcore/core';\nimport type { UniqueIDProps } from '@semcore/core/lib/utils/uniqueID';\nimport type React from 'react';\n\n/**\n * Popper must have an accessible names (aria-group-name).\n */\ntype AriaProps = Intergalactic.RequireAtLeastOne<{\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'title'?: string;\n}>;\n\nexport type FeaturePopoverPopperProps = PopperPopperProps & {\n /**\n * The property responsible for the visibility of the closing icon\n * @default false\n */\n closeIcon?: boolean;\n /** Animation display duration in `ms`\n * @default 200\n */\n duration?: number;\n /** Specifies the locale for i18n support */\n locale?: string;\n};\n\nexport type FeaturePopoverPopperInnerProps = {\n theme: FeaturePopoverProps['theme'];\n\n visible: boolean;\n\n $onCloseClick: (e: React.SyntheticEvent<HTMLButtonElement>) => void;\n animationsDisabled: boolean;\n getI18nText: (message: string, opts?: Record<string, unknown>) => string;\n autofocus: boolean;\n};\n\nexport type FeaturePopoverContext = PopperContext & {\n getSpotProps: PropGetterFn;\n};\n\nexport type FPPopperProps = OutsideClickProps &\n PortalProps &\n UniqueIDProps &\n AnimationProps & {\n /**\n * Popper can have different positioning options\n * @default absolute\n */\n strategy?: PositioningStrategy;\n /**\n * Modifiers for popper.js\n */\n modifiers?: Array<Partial<Modifier<any, any>>>;\n /** Timer to show and hide the popper */\n timeout?: number | [number, number];\n /** PopperJS modifier settings for popper indent */\n offset?: Partial<OptionsOffset> | number | [number, number];\n /** PopperJS modifier settings for finding borders */\n preventOverflow?: Partial<OptionsPreventOverflow>;\n /** PopperJS modifier settings responsible for the arrow */\n arrow?: Partial<OptionsArrow>;\n /** PopperJS modifier settings responsible for turning the popper when there is not enough space */\n flip?: Partial<OptionsFlip>;\n /** PopperJS modifier settings for applying styles */\n computeStyles?: Partial<OptionsComputeStyles>;\n /** PopperJS modifier settings responsible for subscribing to global events */\n eventListeners?: Partial<OptionsEventListeners>;\n /** @ignore */\n onFirstUpdate?: Options['onFirstUpdate'];\n /**\n * Flag for disable Popover (if true, it will close Popper and it will not respond to handlers)\n * @default false\n */\n disabled?: boolean;\n /**\n * If enabled, you will need to use setTrigger function from children rendering function to set popper trigger.\n */\n explicitTriggerSet?: boolean;\n\n popperMargin?: number;\n };\n\nexport type FeaturePopoverProps = FPPopperProps & {\n /** Popper visibility value */\n visible?: boolean;\n /** Function called when visibility changes */\n onVisibleChange?: (visible: boolean, e?: Event) => boolean | void;\n /**\n * The position of the popper relative to the trigger that called it.\n * @default auto\n */\n placement?: Placement;\n /**\n * The theme of FeaturePopover\n * @default accent\n */\n theme?: 'accent' | 'neutral';\n};\n\nexport type FeaturePopoverTriggerProps = BoxProps & {\n theme?: FeaturePopoverProps['theme'];\n};\n\nexport type FeaturePopoverSpotProps = {\n visible?: boolean;\n theme?: FeaturePopoverProps['theme'];\n};\n\nexport type FeaturePopoverComponent = Intergalactic.Component<'div', FeaturePopoverProps, FeaturePopoverContext> & {\n Trigger: Intergalactic.Component<typeof Popper.Trigger, FeaturePopoverTriggerProps>;\n Popper: Intergalactic.Component<'div', FeaturePopoverPopperProps & AriaProps>;\n Spot: Intergalactic.Component<typeof Box, FeaturePopoverSpotProps>;\n};\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FeaturePopover.type.js","names":[],"sources":["../../src/FeaturePopover.type.ts"],"sourcesContent":["import type { Options as OptionsArrow } from '@popperjs/core/lib/modifiers/arrow';\nimport type { Options as OptionsComputeStyles } from '@popperjs/core/lib/modifiers/computeStyles';\nimport type { Options as OptionsEventListeners } from '@popperjs/core/lib/modifiers/eventListeners';\nimport type { Options as OptionsFlip } from '@popperjs/core/lib/modifiers/flip';\nimport type { Options as OptionsOffset } from '@popperjs/core/lib/modifiers/offset';\nimport type { Options as OptionsPreventOverflow } from '@popperjs/core/lib/modifiers/preventOverflow';\nimport type { Modifier, Options, PositioningStrategy } from '@popperjs/core/lib/types';\nimport type {\n AnimationProps,\n BoxProps,\n OutsideClickProps,\n PortalProps,\n Box, PopperContext, PopperPopperProps, Placement, Popper } from '@semcore/base-components';\nimport type { Intergalactic, PropGetterFn } from '@semcore/core';\nimport type { UniqueIDProps } from '@semcore/core/lib/utils/uniqueID';\nimport type React from 'react';\n\nimport type { LocalizedMessages } from './translations/__intergalactic-dynamic-locales';\n\n/**\n * Popper must have an accessible names (aria-group-name).\n */\ntype AriaProps = Intergalactic.RequireAtLeastOne<{\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'title'?: string;\n}>;\n\nexport type FeaturePopoverPopperProps = PopperPopperProps & {\n /**\n * The property responsible for the visibility of the closing icon\n * @default false\n */\n closeIcon?: boolean;\n /** Animation display duration in `ms`\n * @default 200\n */\n duration?: number;\n /** Specifies the locale for i18n support */\n locale?: string;\n};\n\nexport type FeaturePopoverPopperInnerProps = {\n theme: FeaturePopoverProps['theme'];\n\n visible: boolean;\n\n $onCloseClick: (e: React.SyntheticEvent<HTMLButtonElement>) => void;\n animationsDisabled: boolean;\n getI18nText: (message: string, opts?: Record<string, unknown>) => string;\n autofocus: boolean;\n};\n\nexport type FeaturePopoverContext = PopperContext & {\n getSpotProps: PropGetterFn;\n};\n\nexport type FPPopperProps = OutsideClickProps &\n PortalProps &\n UniqueIDProps &\n AnimationProps & {\n /**\n * Popper can have different positioning options\n * @default absolute\n */\n strategy?: PositioningStrategy;\n /**\n * Modifiers for popper.js\n */\n modifiers?: Array<Partial<Modifier<any, any>>>;\n /** Timer to show and hide the popper */\n timeout?: number | [number, number];\n /** PopperJS modifier settings for popper indent */\n offset?: Partial<OptionsOffset> | number | [number, number];\n /** PopperJS modifier settings for finding borders */\n preventOverflow?: Partial<OptionsPreventOverflow>;\n /** PopperJS modifier settings responsible for the arrow */\n arrow?: Partial<OptionsArrow>;\n /** PopperJS modifier settings responsible for turning the popper when there is not enough space */\n flip?: Partial<OptionsFlip>;\n /** PopperJS modifier settings for applying styles */\n computeStyles?: Partial<OptionsComputeStyles>;\n /** PopperJS modifier settings responsible for subscribing to global events */\n eventListeners?: Partial<OptionsEventListeners>;\n /** @ignore */\n onFirstUpdate?: Options['onFirstUpdate'];\n /**\n * Flag for disable Popover (if true, it will close Popper and it will not respond to handlers)\n * @default false\n */\n disabled?: boolean;\n /**\n * If enabled, you will need to use setTrigger function from children rendering function to set popper trigger.\n */\n explicitTriggerSet?: boolean;\n\n popperMargin?: number;\n };\n\nexport type FeaturePopoverProps = FPPopperProps & {\n /** Popper visibility value */\n visible?: boolean;\n /** Function called when visibility changes */\n onVisibleChange?: (visible: boolean, e?: Event) => boolean | void;\n /**\n * The position of the popper relative to the trigger that called it.\n * @default auto\n */\n placement?: Placement;\n /**\n * The theme of FeaturePopover\n * @default accent\n */\n theme?: 'accent' | 'neutral';\n};\n\nexport type FeaturePopoverDefaultProps = {\n offset: FPPopperProps['offset'];\n placement: 'bottom-start';\n defaultVisible: false;\n onOutsideClick: () => void;\n interaction: 'none';\n i18n: LocalizedMessages;\n locale: 'en';\n theme: 'accent';\n};\n\nexport type FeaturePopoverTriggerProps = BoxProps & {\n theme?: FeaturePopoverProps['theme'];\n};\n\nexport type FeaturePopoverSpotProps = {\n visible?: boolean;\n theme?: FeaturePopoverProps['theme'];\n};\n\nexport type FeaturePopoverComponent = Intergalactic.Component<'div', FeaturePopoverProps, FeaturePopoverContext> & {\n Trigger: Intergalactic.Component<typeof Popper.Trigger, FeaturePopoverTriggerProps>;\n Popper: Intergalactic.Component<'div', FeaturePopoverPopperProps & AriaProps>;\n Spot: Intergalactic.Component<typeof Box, FeaturePopoverSpotProps>;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"__intergalactic-dynamic-locales.js","names":["_de","_interopRequireDefault","require","_en","_es","_fr","_it","_ja","_ko","_nl","_pl","_pt","_sv","_tr","_vi","_zh","localizedMessages","exports","de","en","es","fr","it","ja","ko","nl","pt","tr","vi","zh","pl","sv"],"sources":["../../../src/translations/__intergalactic-dynamic-locales.ts"],"sourcesContent":["import de from './de.json';\nimport en from './en.json';\nimport es from './es.json';\nimport fr from './fr.json';\nimport it from './it.json';\nimport ja from './ja.json';\nimport ko from './ko.json';\nimport nl from './nl.json';\nimport pl from './pl.json';\nimport pt from './pt.json';\nimport sv from './sv.json';\nimport tr from './tr.json';\nimport vi from './vi.json';\nimport zh from './zh.json';\n\nexport const localizedMessages = {\n de,\n en,\n es,\n fr,\n it,\n ja,\n ko,\n nl,\n pt,\n tr,\n vi,\n zh,\n pl,\n sv,\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,GAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,GAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,GAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,GAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,GAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,GAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,GAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,GAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,GAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,GAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,GAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,GAAA,GAAAd,sBAAA,CAAAC,OAAA;AAEO,MAAMc,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EAC/BE,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA;AACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"__intergalactic-dynamic-locales.js","names":["_de","_interopRequireDefault","require","_en","_es","_fr","_it","_ja","_ko","_nl","_pl","_pt","_sv","_tr","_vi","_zh","localizedMessages","exports","de","en","es","fr","it","ja","ko","nl","pt","tr","vi","zh","pl","sv"],"sources":["../../../src/translations/__intergalactic-dynamic-locales.ts"],"sourcesContent":["import de from './de.json';\nimport en from './en.json';\nimport es from './es.json';\nimport fr from './fr.json';\nimport it from './it.json';\nimport ja from './ja.json';\nimport ko from './ko.json';\nimport nl from './nl.json';\nimport pl from './pl.json';\nimport pt from './pt.json';\nimport sv from './sv.json';\nimport tr from './tr.json';\nimport vi from './vi.json';\nimport zh from './zh.json';\n\nexport const localizedMessages = {\n de,\n en,\n es,\n fr,\n it,\n ja,\n ko,\n nl,\n pt,\n tr,\n vi,\n zh,\n pl,\n sv,\n};\n\nexport type LocalizedMessages = typeof localizedMessages;\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,GAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,GAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,GAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,GAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,GAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,GAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,GAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,GAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,GAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,GAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,GAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,GAAA,GAAAd,sBAAA,CAAAC,OAAA;AAEO,MAAMc,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EAC/BE,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA;AACF,CAAC","ignoreList":[]}
|
|
@@ -11,25 +11,25 @@ import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
|
|
|
11
11
|
import CloseIcon from '@semcore/icon/Close/m';
|
|
12
12
|
import React from 'react';
|
|
13
13
|
/*!__reshadow-styles__:"./style/feature-popover.shadow.css"*/
|
|
14
|
-
const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/"
|
|
14
|
+
const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SFeaturePopover_1dpi4_gg_{padding:var(--intergalactic-spacing-4x,16px) var(--intergalactic-spacing-10x,40px) var(--intergalactic-spacing-4x,16px) var(--intergalactic-spacing-4x,16px);border-radius:var(--intergalactic-popper-rounded,6px);box-sizing:border-box;box-shadow:var(--intergalactic-box-shadow-popper,1px 1px 10px 0 #00151012);position:relative}@supports (color:color(display-p3 0 0 0%)){.___SFeaturePopover_1dpi4_gg_{box-shadow:var(--intergalactic-box-shadow-popper,1px 1px 10px 0 #00151012)}@media (color-gamut:p3){.___SFeaturePopover_1dpi4_gg_{box-shadow:var(--intergalactic-box-shadow-popper,1px 1px 10px 0 color(display-p3 .01753 .08157 .06372/.07))}}}.___SFeaturePopover_1dpi4_gg_._theme_accent_1dpi4_gg_{background-color:var(--intergalactic-feature-popover-bg,#e1cdff);color:var(--intergalactic-text-primary,#010500e5)}@supports (color:color(display-p3 0 0 0%)){.___SFeaturePopover_1dpi4_gg_._theme_accent_1dpi4_gg_{background-color:var(--intergalactic-feature-popover-bg,#e1cdff)}@media (color-gamut:p3){.___SFeaturePopover_1dpi4_gg_._theme_accent_1dpi4_gg_{background-color:var(--intergalactic-feature-popover-bg,color(display-p3 .87005 .8017 .99841))}}}.___SFeaturePopover_1dpi4_gg_._theme_neutral_1dpi4_gg_{background-color:var(--intergalactic-feature-popover-bg-neutral,#1a1e1a);color:var(--intergalactic-text-primary-invert,#fefffff2)}.___STrigger_1dpi4_gg_{position:relative}.___SClose_1dpi4_gg_{position:absolute;z-index:1;right:var(--intergalactic-spacing-2x,8px);top:var(--intergalactic-spacing-2x,8px)}.___SClose_1dpi4_gg_ .___SAddon_1dpi4_gg_:only-child{margin-left:calc(var(--intergalactic-spacing-2x, 8px) - 1px);margin-right:calc(var(--intergalactic-spacing-2x, 8px) - 1px)}@keyframes showTrigger_1dpi4{0%{opacity:0}to{opacity:1}}@keyframes scaleSizeAndHide_1dpi4{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(2)}}.___SSpot_1dpi4_gg_{position:absolute;bottom:calc(var(--intergalactic-spacing-1x, 4px)*-1);right:calc(var(--intergalactic-spacing-1x, 4px)*-1);animation-name:showTrigger_1dpi4;animation-duration:.2s;animation-timing-function:ease-in;animation-delay:.4s;animation-fill-mode:forwards;width:12px;height:12px}.___SSpot_1dpi4_gg_:before{transform-origin:50%;animation-name:scaleSizeAndHide_1dpi4;animation-duration:1s;animation-iteration-count:infinite;animation-fill-mode:forwards;animation-delay:.5s}.___SSpot_1dpi4_gg_:after,.___SSpot_1dpi4_gg_:before{content:\"\";position:absolute;top:0;left:0;border-radius:50%;width:12px;height:12px}.___SSpot_1dpi4_gg_._theme_accent_1dpi4_gg_:before{background-color:var(--intergalactic-feature-popover-dot-outer-border,#e1cdff)}@supports (color:color(display-p3 0 0 0%)){.___SSpot_1dpi4_gg_._theme_accent_1dpi4_gg_:before{background-color:var(--intergalactic-feature-popover-dot-outer-border,#e1cdff)}@media (color-gamut:p3){.___SSpot_1dpi4_gg_._theme_accent_1dpi4_gg_:before{background-color:var(--intergalactic-feature-popover-dot-outer-border,color(display-p3 .87005 .8017 .99841))}}}.___SSpot_1dpi4_gg_._theme_accent_1dpi4_gg_:after{background-color:var(--intergalactic-feature-popover-bg,#e1cdff)}@supports (color:color(display-p3 0 0 0%)){.___SSpot_1dpi4_gg_._theme_accent_1dpi4_gg_:after{background-color:var(--intergalactic-feature-popover-bg,#e1cdff)}@media (color-gamut:p3){.___SSpot_1dpi4_gg_._theme_accent_1dpi4_gg_:after{background-color:var(--intergalactic-feature-popover-bg,color(display-p3 .87005 .8017 .99841))}}}.___SSpot_1dpi4_gg_._theme_neutral_1dpi4_gg_:before{background-color:var(--intergalactic-feature-popover-dot-neutral-outer-border,#e1cdff)}@supports (color:color(display-p3 0 0 0%)){.___SSpot_1dpi4_gg_._theme_neutral_1dpi4_gg_:before{background-color:var(--intergalactic-feature-popover-dot-neutral-outer-border,#e1cdff)}@media (color-gamut:p3){.___SSpot_1dpi4_gg_._theme_neutral_1dpi4_gg_:before{background-color:var(--intergalactic-feature-popover-dot-neutral-outer-border,color(display-p3 .87005 .8017 .99841))}}}.___SSpot_1dpi4_gg_._theme_neutral_1dpi4_gg_:after{background-color:var(--intergalactic-feature-popover-dot-neutral,#e1cdff)}@supports (color:color(display-p3 0 0 0%)){.___SSpot_1dpi4_gg_._theme_neutral_1dpi4_gg_:after{background-color:var(--intergalactic-feature-popover-dot-neutral,#e1cdff)}@media (color-gamut:p3){.___SSpot_1dpi4_gg_._theme_neutral_1dpi4_gg_:after{background-color:var(--intergalactic-feature-popover-dot-neutral,color(display-p3 .87005 .8017 .99841))}}}@media (prefers-reduced-motion){.___SSpot_1dpi4_gg_,.___SSpot_1dpi4_gg_:before{animation-name:none}}", /*__inner_css_end__*/"1dpi4_gg_"),
|
|
15
15
|
/*__reshadow_css_end__*/
|
|
16
16
|
{
|
|
17
|
-
"__STrigger": "
|
|
18
|
-
"@showTrigger": "
|
|
19
|
-
"@scaleSizeAndHide": "
|
|
20
|
-
"__SFeaturePopover": "
|
|
21
|
-
"_theme_accent": "
|
|
22
|
-
"_theme_neutral": "
|
|
23
|
-
"__SClose": "
|
|
24
|
-
"__SAddon": "
|
|
25
|
-
"__SSpot": "
|
|
17
|
+
"__STrigger": "___STrigger_1dpi4_gg_",
|
|
18
|
+
"@showTrigger": "showTrigger_1dpi4",
|
|
19
|
+
"@scaleSizeAndHide": "scaleSizeAndHide_1dpi4",
|
|
20
|
+
"__SFeaturePopover": "___SFeaturePopover_1dpi4_gg_",
|
|
21
|
+
"_theme_accent": "_theme_accent_1dpi4_gg_",
|
|
22
|
+
"_theme_neutral": "_theme_neutral_1dpi4_gg_",
|
|
23
|
+
"__SClose": "___SClose_1dpi4_gg_",
|
|
24
|
+
"__SAddon": "___SAddon_1dpi4_gg_",
|
|
25
|
+
"__SSpot": "___SSpot_1dpi4_gg_"
|
|
26
26
|
});
|
|
27
27
|
import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
|
|
28
|
-
const stylePopper = (/*__reshadow_css_start__*/sstyled.insert(/*__inner_css_start__*/"@keyframes
|
|
28
|
+
const stylePopper = (/*__reshadow_css_start__*/sstyled.insert(/*__inner_css_start__*/"@keyframes enter_5mxl8{0%{opacity:0;transform:translateX(-10px)}to{opacity:1;transform:translateX(0)}}@keyframes exit_5mxl8{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-10px)}}", /*__inner_css_end__*/"5mxl8_gg_"),
|
|
29
29
|
/*__reshadow_css_end__*/
|
|
30
30
|
{
|
|
31
|
-
"@enter": "
|
|
32
|
-
"@exit": "
|
|
31
|
+
"@enter": "enter_5mxl8",
|
|
32
|
+
"@exit": "exit_5mxl8"
|
|
33
33
|
});
|
|
34
34
|
const enhance = [i18nEnhance(localizedMessages)];
|
|
35
35
|
class FeaturePopover extends Component {
|
|
@@ -97,7 +97,7 @@ _defineProperty(FeaturePopover, "defaultProps", {
|
|
|
97
97
|
offset: [0, 12],
|
|
98
98
|
placement: 'bottom-start',
|
|
99
99
|
defaultVisible: false,
|
|
100
|
-
onOutsideClick: () =>
|
|
100
|
+
onOutsideClick: () => {},
|
|
101
101
|
interaction: 'none',
|
|
102
102
|
i18n: localizedMessages,
|
|
103
103
|
locale: 'en',
|
|
@@ -200,6 +200,12 @@ function Spot(props) {
|
|
|
200
200
|
..._assignProps3({}, _ref3)
|
|
201
201
|
}));
|
|
202
202
|
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* FeaturePopover
|
|
206
|
+
*
|
|
207
|
+
* {@link https://developer.semrush.com/intergalactic/components/feature-popover/feature-popover-api/|API} | {@link https://developer.semrush.com/intergalactic/components/feature-popover/feature-popover-code/|Examples}
|
|
208
|
+
*/
|
|
203
209
|
export default createComponent(FeaturePopover, {
|
|
204
210
|
Trigger: Trigger,
|
|
205
211
|
Popper: FeaturePopoverPopper,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeaturePopover.js","names":["Box","Popper","Animation","Button","createComponent","Root","Component","sstyled","callAllEventHandlers","i18nEnhance","CloseIcon","React","style","_sstyled","insert","localizedMessages","stylePopper","enhance","FeaturePopover","constructor","args","_defineProperty","name","enabled","visible","handlers","e","uncontrolledProps","getPopperProps","getI18nText","theme","asProps","$onCloseClick","handleCloseClick","getSpotProps","render","_ref4","styles","forwardRef","onVisibleChange","modifiers","other","createElement","cn","handleVisibleChange","defaultModifiers","offset","placement","defaultVisible","onOutsideClick","interaction","i18n","locale","Trigger","Children","_ref","arguments[0]","_ref5","STrigger","_assignProps","FeaturePopoverPopper","createRef","componentDidMount","autoFocus","setTimeout","popperRef","current","focus","_ref2","_ref6","SFeaturePopover","SClose","closeIcon","duration","animationsDisabled","zIndex","ariaLabel","ariaDescribedBy","ariaLabelledby","title","ref","disableEnforceFocus","tabIndex","role","_assignProps2","Spot","props","_ref3","_ref7","SSpot","_assignProps3","parent"],"sources":["../../src/FeaturePopover.tsx"],"sourcesContent":["import { Box, Popper, Animation } from '@semcore/base-components';\nimport Button from '@semcore/button';\nimport type { IRootComponentProps } from '@semcore/core';\nimport { createComponent, Root, Component, sstyled } from '@semcore/core';\nimport { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport CloseIcon from '@semcore/icon/Close/m';\nimport React from 'react';\n\nimport type {\n FeaturePopoverProps,\n FeaturePopoverComponent,\n FeaturePopoverSpotProps,\n FeaturePopoverPopperProps,\n FeaturePopoverPopperInnerProps,\n} from './FeaturePopover.type';\nimport style from './style/feature-popover.shadow.css';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\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\nconst enhance = [\n i18nEnhance(localizedMessages),\n] as const;\n\nclass FeaturePopover extends Component<FeaturePopoverProps, typeof enhance, { visible: null }> {\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: 'none',\n i18n: localizedMessages,\n locale: 'en',\n theme: 'accent',\n };\n\n static enhance = enhance;\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: boolean) => {\n this.handlers.visible(visible);\n };\n\n handleCloseClick = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n this.handlers.visible(false, e);\n };\n\n getPopperProps() {\n const { visible, getI18nText, theme } = this.asProps;\n return {\n visible,\n $onCloseClick: this.handleCloseClick,\n getI18nText,\n theme,\n };\n }\n\n getSpotProps() {\n const { visible, theme } = this.asProps;\n return { visible, theme };\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\nfunction Trigger({ Children, styles }: IRootComponentProps) {\n const STrigger = Root;\n return sstyled(styles)(\n <STrigger render={Popper.Trigger} tag={Box} aria-haspopup={false}>\n <Children />\n </STrigger>,\n );\n}\n\nclass FeaturePopoverPopper extends Component<FeaturePopoverPopperProps, [], {}, FeaturePopoverPopperInnerProps> {\n static defaultProps = {\n closeIcon: false,\n duration: 200,\n autoFocus: true,\n };\n\n popperRef = React.createRef<HTMLDivElement>();\n\n componentDidMount() {\n if (this.asProps.autoFocus) {\n setTimeout(() => {\n this.popperRef.current?.focus();\n }, 0);\n }\n }\n\n render() {\n const SFeaturePopover = Root;\n const SClose = Button;\n const {\n Children,\n styles,\n visible,\n closeIcon,\n duration,\n $onCloseClick,\n animationsDisabled,\n getI18nText,\n zIndex,\n 'aria-label': ariaLabel,\n 'aria-describedby': ariaDescribedBy,\n 'aria-labelledby': ariaLabelledby,\n title,\n theme,\n } = this.asProps;\n\n return sstyled(styles)(\n <Popper.Popper\n ref={this.popperRef}\n disableEnforceFocus\n zIndex={zIndex}\n tabIndex={0}\n role='dialog'\n aria-describedby={ariaDescribedBy}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n title={title}\n >\n <Animation\n visible={visible}\n duration={duration}\n keyframes={[stylePopper['@enter'], stylePopper['@exit']]}\n initialAnimation\n animationsDisabled={animationsDisabled}\n >\n <SFeaturePopover\n render={Box}\n __excludeProps={['aria-label', 'aria-describedBy', 'title']}\n >\n {closeIcon && (\n <SClose\n aria-label={getI18nText('close')}\n onClick={$onCloseClick}\n use='tertiary'\n theme={theme === 'accent' ? 'muted' : 'invert'}\n size='m'\n addonLeft={CloseIcon}\n type='button'\n />\n )}\n <Children />\n </SFeaturePopover>\n </Animation>\n </Popper.Popper>,\n );\n }\n}\n\nfunction Spot(props: IRootComponentProps & FeaturePopoverSpotProps) {\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: Trigger,\n Popper: FeaturePopoverPopper,\n Spot,\n },\n // @ts-ignore\n { parent: Popper },\n) as FeaturePopoverComponent;\n"],"mappings":";;;;;AAAA,SAASA,GAAG,EAAEC,MAAM,EAAEC,SAAS,QAAQ,0BAA0B;AACjE,OAAOC,MAAM,MAAM,iBAAiB;AAEpC,SAASC,eAAe,EAAEC,IAAI,EAAEC,SAAS,EAAEC,OAAO,QAAQ,eAAe;AACzE,SAASC,oBAAoB,QAAQ,qCAAqC;AAC1E,OAAOC,WAAW,MAAM,8CAA8C;AACtE,OAAOC,SAAS,MAAM,uBAAuB;AAC7C,OAAOC,KAAK,MAAM,OAAO;AAAC;AAAA,MAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAU1B,SAASC,iBAAiB,QAAQ,gDAAgD;AAElF,MAAMC,WAAW,8BAAGT,OAAO,CAAAO,MAAI;AAAA;AAAA;EAAA;EAAA;AAAA,EAsB9B;AAED,MAAMG,OAAO,GAAG,CACdR,WAAW,CAACM,iBAAiB,CAAC,CACtB;AAEV,MAAMG,cAAc,SAASZ,SAAS,CAAyD;EAAAa,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,2BAgB1E,CACjB;MACEC,IAAI,EAAE,MAAM;MACZC,OAAO,EAAE;IACX,CAAC,CACF;IAAAF,eAAA,8BAQsBG,OAAgB,IAAK;MAC1C,IAAI,CAACC,QAAQ,CAACD,OAAO,CAACA,OAAO,CAAC;IAChC,CAAC;IAAAH,eAAA,2BAEmBK,CAA0C,IAAK;MACjE,IAAI,CAACD,QAAQ,CAACD,OAAO,CAAC,KAAK,EAAEE,CAAC,CAAC;IACjC,CAAC;EAAA;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,eAAA,CA7EKuC,oBAAoB,kBACF;EACpBY,SAAS,EAAE,KAAK;EAChBC,QAAQ,EAAE,GAAG;EACbV,SAAS,EAAE;AACb,CAAC;AA0EH,SAASsB,IAAIA,CAACC,KAAoD,EAAE;EAAA,IAAAC,KAAA,GAAA/B,YAAA;IAAAgC,KAAA;EAClE,MAAMC,KAAK,GAM2BzF,GAAG;EAJzC,MAAM;IAAEqC,MAAM;IAAEb;EAAQ,CAAC,GAAG8D,KAAK;EAEjC,IAAI,CAAC9D,OAAO,EAAE,OAAO,IAAI;EAEzB,OAAAgE,KAAA,GAAOjF,OAAO,CAAC8B,MAAM,CAAC,eAAC1B,KAAA,CAAA+B,aAAA,CAAC+C,KAAK,EAAAD,KAAA,CAAA7C,EAAA;IAAA,GAAA+C,aAAA,KAAAH,KAAA;EAAA,EAAe,CAAC;AAC/C;AAEA,eAAenF,eAAe,CAC5Bc,cAAc,EACd;EACEmC,OAAO,EAAEA,OAAO;EAChBpD,MAAM,EAAE2D,oBAAoB;EAC5ByB;AACF,CAAC;AACD;AACA;EAAEM,MAAM,EAAE1F;AAAO,CACnB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FeaturePopover.js","names":["Box","Popper","Animation","Button","createComponent","Root","Component","sstyled","callAllEventHandlers","i18nEnhance","CloseIcon","React","style","_sstyled","insert","localizedMessages","stylePopper","enhance","FeaturePopover","constructor","args","_defineProperty","name","enabled","visible","handlers","e","uncontrolledProps","getPopperProps","getI18nText","theme","asProps","$onCloseClick","handleCloseClick","getSpotProps","render","_ref4","styles","forwardRef","onVisibleChange","modifiers","other","createElement","cn","handleVisibleChange","defaultModifiers","offset","placement","defaultVisible","onOutsideClick","interaction","i18n","locale","Trigger","Children","_ref","arguments[0]","_ref5","STrigger","_assignProps","FeaturePopoverPopper","createRef","componentDidMount","autoFocus","setTimeout","popperRef","current","focus","_ref2","_ref6","SFeaturePopover","SClose","closeIcon","duration","animationsDisabled","zIndex","ariaLabel","ariaDescribedBy","ariaLabelledby","title","ref","disableEnforceFocus","tabIndex","role","_assignProps2","Spot","props","_ref3","_ref7","SSpot","_assignProps3","parent"],"sources":["../../src/FeaturePopover.tsx"],"sourcesContent":["import type { PopperProps } from '@semcore/base-components';\nimport { Box, Popper, Animation } from '@semcore/base-components';\nimport Button from '@semcore/button';\nimport type { IRootComponentProps } from '@semcore/core';\nimport { createComponent, Root, Component, sstyled } from '@semcore/core';\nimport { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';\nimport type { WithI18nEnhanceProps } from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport CloseIcon from '@semcore/icon/Close/m';\nimport React from 'react';\n\nimport type {\n FeaturePopoverProps,\n FeaturePopoverComponent,\n FeaturePopoverSpotProps,\n FeaturePopoverPopperProps,\n FeaturePopoverPopperInnerProps,\n FeaturePopoverDefaultProps,\n} from './FeaturePopover.type';\nimport style from './style/feature-popover.shadow.css';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\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\nconst enhance = [\n i18nEnhance(localizedMessages),\n] as const;\n\ntype FeaturePopoverInternalProps = {\n interaction?: PopperProps['interaction'];\n};\n\nclass FeaturePopover extends Component<\n FeaturePopoverProps,\n typeof enhance,\n { visible: null },\n WithI18nEnhanceProps & FeaturePopoverInternalProps,\n {},\n FeaturePopoverDefaultProps\n> {\n static displayName = 'FeaturePopover';\n static style = style;\n static defaultProps: FeaturePopoverDefaultProps = {\n offset: [0, 12],\n placement: 'bottom-start',\n defaultVisible: false,\n onOutsideClick: () => {},\n interaction: 'none',\n i18n: localizedMessages,\n locale: 'en',\n theme: 'accent',\n };\n\n static enhance = enhance;\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: boolean) => {\n this.handlers.visible(visible);\n };\n\n handleCloseClick = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n this.handlers.visible(false, e);\n };\n\n getPopperProps() {\n const { visible, getI18nText, theme } = this.asProps;\n return {\n visible,\n $onCloseClick: this.handleCloseClick,\n getI18nText,\n theme,\n };\n }\n\n getSpotProps() {\n const { visible, theme } = this.asProps;\n return { visible, theme };\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\nfunction Trigger({ Children, styles }: IRootComponentProps) {\n const STrigger = Root;\n return sstyled(styles)(\n <STrigger render={Popper.Trigger} tag={Box} aria-haspopup={false}>\n <Children />\n </STrigger>,\n );\n}\n\nclass FeaturePopoverPopper extends Component<FeaturePopoverPopperProps, [], {}, FeaturePopoverPopperInnerProps> {\n static defaultProps = {\n closeIcon: false,\n duration: 200,\n autoFocus: true,\n };\n\n popperRef = React.createRef<HTMLDivElement>();\n\n componentDidMount() {\n if (this.asProps.autoFocus) {\n setTimeout(() => {\n this.popperRef.current?.focus();\n }, 0);\n }\n }\n\n render() {\n const SFeaturePopover = Root;\n const SClose = Button;\n const {\n Children,\n styles,\n visible,\n closeIcon,\n duration,\n $onCloseClick,\n animationsDisabled,\n getI18nText,\n zIndex,\n 'aria-label': ariaLabel,\n 'aria-describedby': ariaDescribedBy,\n 'aria-labelledby': ariaLabelledby,\n title,\n theme,\n } = this.asProps;\n\n return sstyled(styles)(\n <Popper.Popper\n ref={this.popperRef}\n disableEnforceFocus\n zIndex={zIndex}\n tabIndex={0}\n role='dialog'\n aria-describedby={ariaDescribedBy}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n title={title}\n >\n <Animation\n visible={visible}\n duration={duration}\n keyframes={[stylePopper['@enter'], stylePopper['@exit']]}\n initialAnimation\n animationsDisabled={animationsDisabled}\n >\n <SFeaturePopover\n render={Box}\n __excludeProps={['aria-label', 'aria-describedBy', 'title']}\n >\n {closeIcon && (\n <SClose\n aria-label={getI18nText('close')}\n onClick={$onCloseClick}\n use='tertiary'\n theme={theme === 'accent' ? 'muted' : 'invert'}\n size='m'\n addonLeft={CloseIcon}\n type='button'\n />\n )}\n <Children />\n </SFeaturePopover>\n </Animation>\n </Popper.Popper>,\n );\n }\n}\n\nfunction Spot(props: IRootComponentProps & FeaturePopoverSpotProps) {\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\n/**\n * FeaturePopover\n *\n * {@link https://developer.semrush.com/intergalactic/components/feature-popover/feature-popover-api/|API} | {@link https://developer.semrush.com/intergalactic/components/feature-popover/feature-popover-code/|Examples}\n */\nexport default createComponent<\n FeaturePopoverComponent,\n typeof FeaturePopover\n>(\n FeaturePopover,\n {\n Trigger: Trigger,\n Popper: FeaturePopoverPopper,\n Spot,\n },\n // @ts-ignore\n { parent: Popper },\n);\n"],"mappings":";;;;;AACA,SAASA,GAAG,EAAEC,MAAM,EAAEC,SAAS,QAAQ,0BAA0B;AACjE,OAAOC,MAAM,MAAM,iBAAiB;AAEpC,SAASC,eAAe,EAAEC,IAAI,EAAEC,SAAS,EAAEC,OAAO,QAAQ,eAAe;AACzE,SAASC,oBAAoB,QAAQ,qCAAqC;AAE1E,OAAOC,WAAW,MAAM,8CAA8C;AACtE,OAAOC,SAAS,MAAM,uBAAuB;AAC7C,OAAOC,KAAK,MAAM,OAAO;AAAC;AAAA,MAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;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AAO,EAAEA,OAAO;EAChBpD,MAAM,EAAE2D,oBAAoB;EAC5ByB;AACF,CAAC;AACD;AACA;EAAEM,MAAM,EAAE1F;AAAO,CACnB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeaturePopover.type.js","names":[],"sources":["../../src/FeaturePopover.type.ts"],"sourcesContent":["import type { Options as OptionsArrow } from '@popperjs/core/lib/modifiers/arrow';\nimport type { Options as OptionsComputeStyles } from '@popperjs/core/lib/modifiers/computeStyles';\nimport type { Options as OptionsEventListeners } from '@popperjs/core/lib/modifiers/eventListeners';\nimport type { Options as OptionsFlip } from '@popperjs/core/lib/modifiers/flip';\nimport type { Options as OptionsOffset } from '@popperjs/core/lib/modifiers/offset';\nimport type { Options as OptionsPreventOverflow } from '@popperjs/core/lib/modifiers/preventOverflow';\nimport type { Modifier, Options, PositioningStrategy } from '@popperjs/core/lib/types';\nimport type {\n AnimationProps,\n BoxProps,\n OutsideClickProps,\n PortalProps,\n Box, PopperContext, PopperPopperProps, Placement, Popper } from '@semcore/base-components';\nimport type { Intergalactic, PropGetterFn } from '@semcore/core';\nimport type { UniqueIDProps } from '@semcore/core/lib/utils/uniqueID';\nimport type React from 'react';\n\n/**\n * Popper must have an accessible names (aria-group-name).\n */\ntype AriaProps = Intergalactic.RequireAtLeastOne<{\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'title'?: string;\n}>;\n\nexport type FeaturePopoverPopperProps = PopperPopperProps & {\n /**\n * The property responsible for the visibility of the closing icon\n * @default false\n */\n closeIcon?: boolean;\n /** Animation display duration in `ms`\n * @default 200\n */\n duration?: number;\n /** Specifies the locale for i18n support */\n locale?: string;\n};\n\nexport type FeaturePopoverPopperInnerProps = {\n theme: FeaturePopoverProps['theme'];\n\n visible: boolean;\n\n $onCloseClick: (e: React.SyntheticEvent<HTMLButtonElement>) => void;\n animationsDisabled: boolean;\n getI18nText: (message: string, opts?: Record<string, unknown>) => string;\n autofocus: boolean;\n};\n\nexport type FeaturePopoverContext = PopperContext & {\n getSpotProps: PropGetterFn;\n};\n\nexport type FPPopperProps = OutsideClickProps &\n PortalProps &\n UniqueIDProps &\n AnimationProps & {\n /**\n * Popper can have different positioning options\n * @default absolute\n */\n strategy?: PositioningStrategy;\n /**\n * Modifiers for popper.js\n */\n modifiers?: Array<Partial<Modifier<any, any>>>;\n /** Timer to show and hide the popper */\n timeout?: number | [number, number];\n /** PopperJS modifier settings for popper indent */\n offset?: Partial<OptionsOffset> | number | [number, number];\n /** PopperJS modifier settings for finding borders */\n preventOverflow?: Partial<OptionsPreventOverflow>;\n /** PopperJS modifier settings responsible for the arrow */\n arrow?: Partial<OptionsArrow>;\n /** PopperJS modifier settings responsible for turning the popper when there is not enough space */\n flip?: Partial<OptionsFlip>;\n /** PopperJS modifier settings for applying styles */\n computeStyles?: Partial<OptionsComputeStyles>;\n /** PopperJS modifier settings responsible for subscribing to global events */\n eventListeners?: Partial<OptionsEventListeners>;\n /** @ignore */\n onFirstUpdate?: Options['onFirstUpdate'];\n /**\n * Flag for disable Popover (if true, it will close Popper and it will not respond to handlers)\n * @default false\n */\n disabled?: boolean;\n /**\n * If enabled, you will need to use setTrigger function from children rendering function to set popper trigger.\n */\n explicitTriggerSet?: boolean;\n\n popperMargin?: number;\n };\n\nexport type FeaturePopoverProps = FPPopperProps & {\n /** Popper visibility value */\n visible?: boolean;\n /** Function called when visibility changes */\n onVisibleChange?: (visible: boolean, e?: Event) => boolean | void;\n /**\n * The position of the popper relative to the trigger that called it.\n * @default auto\n */\n placement?: Placement;\n /**\n * The theme of FeaturePopover\n * @default accent\n */\n theme?: 'accent' | 'neutral';\n};\n\nexport type FeaturePopoverTriggerProps = BoxProps & {\n theme?: FeaturePopoverProps['theme'];\n};\n\nexport type FeaturePopoverSpotProps = {\n visible?: boolean;\n theme?: FeaturePopoverProps['theme'];\n};\n\nexport type FeaturePopoverComponent = Intergalactic.Component<'div', FeaturePopoverProps, FeaturePopoverContext> & {\n Trigger: Intergalactic.Component<typeof Popper.Trigger, FeaturePopoverTriggerProps>;\n Popper: Intergalactic.Component<'div', FeaturePopoverPopperProps & AriaProps>;\n Spot: Intergalactic.Component<typeof Box, FeaturePopoverSpotProps>;\n};\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FeaturePopover.type.js","names":[],"sources":["../../src/FeaturePopover.type.ts"],"sourcesContent":["import type { Options as OptionsArrow } from '@popperjs/core/lib/modifiers/arrow';\nimport type { Options as OptionsComputeStyles } from '@popperjs/core/lib/modifiers/computeStyles';\nimport type { Options as OptionsEventListeners } from '@popperjs/core/lib/modifiers/eventListeners';\nimport type { Options as OptionsFlip } from '@popperjs/core/lib/modifiers/flip';\nimport type { Options as OptionsOffset } from '@popperjs/core/lib/modifiers/offset';\nimport type { Options as OptionsPreventOverflow } from '@popperjs/core/lib/modifiers/preventOverflow';\nimport type { Modifier, Options, PositioningStrategy } from '@popperjs/core/lib/types';\nimport type {\n AnimationProps,\n BoxProps,\n OutsideClickProps,\n PortalProps,\n Box, PopperContext, PopperPopperProps, Placement, Popper } from '@semcore/base-components';\nimport type { Intergalactic, PropGetterFn } from '@semcore/core';\nimport type { UniqueIDProps } from '@semcore/core/lib/utils/uniqueID';\nimport type React from 'react';\n\nimport type { LocalizedMessages } from './translations/__intergalactic-dynamic-locales';\n\n/**\n * Popper must have an accessible names (aria-group-name).\n */\ntype AriaProps = Intergalactic.RequireAtLeastOne<{\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'title'?: string;\n}>;\n\nexport type FeaturePopoverPopperProps = PopperPopperProps & {\n /**\n * The property responsible for the visibility of the closing icon\n * @default false\n */\n closeIcon?: boolean;\n /** Animation display duration in `ms`\n * @default 200\n */\n duration?: number;\n /** Specifies the locale for i18n support */\n locale?: string;\n};\n\nexport type FeaturePopoverPopperInnerProps = {\n theme: FeaturePopoverProps['theme'];\n\n visible: boolean;\n\n $onCloseClick: (e: React.SyntheticEvent<HTMLButtonElement>) => void;\n animationsDisabled: boolean;\n getI18nText: (message: string, opts?: Record<string, unknown>) => string;\n autofocus: boolean;\n};\n\nexport type FeaturePopoverContext = PopperContext & {\n getSpotProps: PropGetterFn;\n};\n\nexport type FPPopperProps = OutsideClickProps &\n PortalProps &\n UniqueIDProps &\n AnimationProps & {\n /**\n * Popper can have different positioning options\n * @default absolute\n */\n strategy?: PositioningStrategy;\n /**\n * Modifiers for popper.js\n */\n modifiers?: Array<Partial<Modifier<any, any>>>;\n /** Timer to show and hide the popper */\n timeout?: number | [number, number];\n /** PopperJS modifier settings for popper indent */\n offset?: Partial<OptionsOffset> | number | [number, number];\n /** PopperJS modifier settings for finding borders */\n preventOverflow?: Partial<OptionsPreventOverflow>;\n /** PopperJS modifier settings responsible for the arrow */\n arrow?: Partial<OptionsArrow>;\n /** PopperJS modifier settings responsible for turning the popper when there is not enough space */\n flip?: Partial<OptionsFlip>;\n /** PopperJS modifier settings for applying styles */\n computeStyles?: Partial<OptionsComputeStyles>;\n /** PopperJS modifier settings responsible for subscribing to global events */\n eventListeners?: Partial<OptionsEventListeners>;\n /** @ignore */\n onFirstUpdate?: Options['onFirstUpdate'];\n /**\n * Flag for disable Popover (if true, it will close Popper and it will not respond to handlers)\n * @default false\n */\n disabled?: boolean;\n /**\n * If enabled, you will need to use setTrigger function from children rendering function to set popper trigger.\n */\n explicitTriggerSet?: boolean;\n\n popperMargin?: number;\n };\n\nexport type FeaturePopoverProps = FPPopperProps & {\n /** Popper visibility value */\n visible?: boolean;\n /** Function called when visibility changes */\n onVisibleChange?: (visible: boolean, e?: Event) => boolean | void;\n /**\n * The position of the popper relative to the trigger that called it.\n * @default auto\n */\n placement?: Placement;\n /**\n * The theme of FeaturePopover\n * @default accent\n */\n theme?: 'accent' | 'neutral';\n};\n\nexport type FeaturePopoverDefaultProps = {\n offset: FPPopperProps['offset'];\n placement: 'bottom-start';\n defaultVisible: false;\n onOutsideClick: () => void;\n interaction: 'none';\n i18n: LocalizedMessages;\n locale: 'en';\n theme: 'accent';\n};\n\nexport type FeaturePopoverTriggerProps = BoxProps & {\n theme?: FeaturePopoverProps['theme'];\n};\n\nexport type FeaturePopoverSpotProps = {\n visible?: boolean;\n theme?: FeaturePopoverProps['theme'];\n};\n\nexport type FeaturePopoverComponent = Intergalactic.Component<'div', FeaturePopoverProps, FeaturePopoverContext> & {\n Trigger: Intergalactic.Component<typeof Popper.Trigger, FeaturePopoverTriggerProps>;\n Popper: Intergalactic.Component<'div', FeaturePopoverPopperProps & AriaProps>;\n Spot: Intergalactic.Component<typeof Box, FeaturePopoverSpotProps>;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"__intergalactic-dynamic-locales.js","names":["de","en","es","fr","it","ja","ko","nl","pl","pt","sv","tr","vi","zh","localizedMessages"],"sources":["../../../src/translations/__intergalactic-dynamic-locales.ts"],"sourcesContent":["import de from './de.json';\nimport en from './en.json';\nimport es from './es.json';\nimport fr from './fr.json';\nimport it from './it.json';\nimport ja from './ja.json';\nimport ko from './ko.json';\nimport nl from './nl.json';\nimport pl from './pl.json';\nimport pt from './pt.json';\nimport sv from './sv.json';\nimport tr from './tr.json';\nimport vi from './vi.json';\nimport zh from './zh.json';\n\nexport const localizedMessages = {\n de,\n en,\n es,\n fr,\n it,\n ja,\n ko,\n nl,\n pt,\n tr,\n vi,\n zh,\n pl,\n sv,\n};\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAE1B,OAAO,MAAMC,iBAAiB,GAAG;EAC/Bd,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFE,EAAE;EACFE,EAAE;EACFC,EAAE;EACFC,EAAE;EACFL,EAAE;EACFE;AACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"__intergalactic-dynamic-locales.js","names":["de","en","es","fr","it","ja","ko","nl","pl","pt","sv","tr","vi","zh","localizedMessages"],"sources":["../../../src/translations/__intergalactic-dynamic-locales.ts"],"sourcesContent":["import de from './de.json';\nimport en from './en.json';\nimport es from './es.json';\nimport fr from './fr.json';\nimport it from './it.json';\nimport ja from './ja.json';\nimport ko from './ko.json';\nimport nl from './nl.json';\nimport pl from './pl.json';\nimport pt from './pt.json';\nimport sv from './sv.json';\nimport tr from './tr.json';\nimport vi from './vi.json';\nimport zh from './zh.json';\n\nexport const localizedMessages = {\n de,\n en,\n es,\n fr,\n it,\n ja,\n ko,\n nl,\n pt,\n tr,\n vi,\n zh,\n pl,\n sv,\n};\n\nexport type LocalizedMessages = typeof localizedMessages;\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAE1B,OAAO,MAAMC,iBAAiB,GAAG;EAC/Bd,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFE,EAAE;EACFE,EAAE;EACFC,EAAE;EACFC,EAAE;EACFL,EAAE;EACFE;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { sstyled, Component, assignProps, createComponent } from "@semcore/core";
|
|
3
3
|
import { Popper, Box, Animation } from "@semcore/base-components";
|
|
4
4
|
import Button from "@semcore/button";
|
|
@@ -12,33 +12,33 @@ const style = (
|
|
|
12
12
|
/*__reshadow_css_start__*/
|
|
13
13
|
(sstyled.insert(
|
|
14
14
|
/*__inner_css_start__*/
|
|
15
|
-
'
|
|
15
|
+
'.___SFeaturePopover_1dpi4_gg_{padding:var(--intergalactic-spacing-4x,16px) var(--intergalactic-spacing-10x,40px) var(--intergalactic-spacing-4x,16px) var(--intergalactic-spacing-4x,16px);border-radius:var(--intergalactic-popper-rounded,6px);box-sizing:border-box;box-shadow:var(--intergalactic-box-shadow-popper,1px 1px 10px 0 #00151012);position:relative}@supports (color:color(display-p3 0 0 0%)){.___SFeaturePopover_1dpi4_gg_{box-shadow:var(--intergalactic-box-shadow-popper,1px 1px 10px 0 #00151012)}@media (color-gamut:p3){.___SFeaturePopover_1dpi4_gg_{box-shadow:var(--intergalactic-box-shadow-popper,1px 1px 10px 0 color(display-p3 .01753 .08157 .06372/.07))}}}.___SFeaturePopover_1dpi4_gg_._theme_accent_1dpi4_gg_{background-color:var(--intergalactic-feature-popover-bg,#e1cdff);color:var(--intergalactic-text-primary,#010500e5)}@supports (color:color(display-p3 0 0 0%)){.___SFeaturePopover_1dpi4_gg_._theme_accent_1dpi4_gg_{background-color:var(--intergalactic-feature-popover-bg,#e1cdff)}@media (color-gamut:p3){.___SFeaturePopover_1dpi4_gg_._theme_accent_1dpi4_gg_{background-color:var(--intergalactic-feature-popover-bg,color(display-p3 .87005 .8017 .99841))}}}.___SFeaturePopover_1dpi4_gg_._theme_neutral_1dpi4_gg_{background-color:var(--intergalactic-feature-popover-bg-neutral,#1a1e1a);color:var(--intergalactic-text-primary-invert,#fefffff2)}.___STrigger_1dpi4_gg_{position:relative}.___SClose_1dpi4_gg_{position:absolute;z-index:1;right:var(--intergalactic-spacing-2x,8px);top:var(--intergalactic-spacing-2x,8px)}.___SClose_1dpi4_gg_ .___SAddon_1dpi4_gg_:only-child{margin-left:calc(var(--intergalactic-spacing-2x, 8px) - 1px);margin-right:calc(var(--intergalactic-spacing-2x, 8px) - 1px)}@keyframes showTrigger_1dpi4{0%{opacity:0}to{opacity:1}}@keyframes scaleSizeAndHide_1dpi4{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(2)}}.___SSpot_1dpi4_gg_{position:absolute;bottom:calc(var(--intergalactic-spacing-1x, 4px)*-1);right:calc(var(--intergalactic-spacing-1x, 4px)*-1);animation-name:showTrigger_1dpi4;animation-duration:.2s;animation-timing-function:ease-in;animation-delay:.4s;animation-fill-mode:forwards;width:12px;height:12px}.___SSpot_1dpi4_gg_:before{transform-origin:50%;animation-name:scaleSizeAndHide_1dpi4;animation-duration:1s;animation-iteration-count:infinite;animation-fill-mode:forwards;animation-delay:.5s}.___SSpot_1dpi4_gg_:after,.___SSpot_1dpi4_gg_:before{content:"";position:absolute;top:0;left:0;border-radius:50%;width:12px;height:12px}.___SSpot_1dpi4_gg_._theme_accent_1dpi4_gg_:before{background-color:var(--intergalactic-feature-popover-dot-outer-border,#e1cdff)}@supports (color:color(display-p3 0 0 0%)){.___SSpot_1dpi4_gg_._theme_accent_1dpi4_gg_:before{background-color:var(--intergalactic-feature-popover-dot-outer-border,#e1cdff)}@media (color-gamut:p3){.___SSpot_1dpi4_gg_._theme_accent_1dpi4_gg_:before{background-color:var(--intergalactic-feature-popover-dot-outer-border,color(display-p3 .87005 .8017 .99841))}}}.___SSpot_1dpi4_gg_._theme_accent_1dpi4_gg_:after{background-color:var(--intergalactic-feature-popover-bg,#e1cdff)}@supports (color:color(display-p3 0 0 0%)){.___SSpot_1dpi4_gg_._theme_accent_1dpi4_gg_:after{background-color:var(--intergalactic-feature-popover-bg,#e1cdff)}@media (color-gamut:p3){.___SSpot_1dpi4_gg_._theme_accent_1dpi4_gg_:after{background-color:var(--intergalactic-feature-popover-bg,color(display-p3 .87005 .8017 .99841))}}}.___SSpot_1dpi4_gg_._theme_neutral_1dpi4_gg_:before{background-color:var(--intergalactic-feature-popover-dot-neutral-outer-border,#e1cdff)}@supports (color:color(display-p3 0 0 0%)){.___SSpot_1dpi4_gg_._theme_neutral_1dpi4_gg_:before{background-color:var(--intergalactic-feature-popover-dot-neutral-outer-border,#e1cdff)}@media (color-gamut:p3){.___SSpot_1dpi4_gg_._theme_neutral_1dpi4_gg_:before{background-color:var(--intergalactic-feature-popover-dot-neutral-outer-border,color(display-p3 .87005 .8017 .99841))}}}.___SSpot_1dpi4_gg_._theme_neutral_1dpi4_gg_:after{background-color:var(--intergalactic-feature-popover-dot-neutral,#e1cdff)}@supports (color:color(display-p3 0 0 0%)){.___SSpot_1dpi4_gg_._theme_neutral_1dpi4_gg_:after{background-color:var(--intergalactic-feature-popover-dot-neutral,#e1cdff)}@media (color-gamut:p3){.___SSpot_1dpi4_gg_._theme_neutral_1dpi4_gg_:after{background-color:var(--intergalactic-feature-popover-dot-neutral,color(display-p3 .87005 .8017 .99841))}}}@media (prefers-reduced-motion){.___SSpot_1dpi4_gg_,.___SSpot_1dpi4_gg_:before{animation-name:none}}',
|
|
16
16
|
/*__inner_css_end__*/
|
|
17
|
-
"
|
|
17
|
+
"1dpi4_gg_"
|
|
18
18
|
), /*__reshadow_css_end__*/
|
|
19
19
|
{
|
|
20
|
-
"__STrigger": "
|
|
21
|
-
"@showTrigger": "
|
|
22
|
-
"@scaleSizeAndHide": "
|
|
23
|
-
"__SFeaturePopover": "
|
|
24
|
-
"_theme_accent": "
|
|
25
|
-
"_theme_neutral": "
|
|
26
|
-
"__SClose": "
|
|
27
|
-
"__SAddon": "
|
|
28
|
-
"__SSpot": "
|
|
20
|
+
"__STrigger": "___STrigger_1dpi4_gg_",
|
|
21
|
+
"@showTrigger": "showTrigger_1dpi4",
|
|
22
|
+
"@scaleSizeAndHide": "scaleSizeAndHide_1dpi4",
|
|
23
|
+
"__SFeaturePopover": "___SFeaturePopover_1dpi4_gg_",
|
|
24
|
+
"_theme_accent": "_theme_accent_1dpi4_gg_",
|
|
25
|
+
"_theme_neutral": "_theme_neutral_1dpi4_gg_",
|
|
26
|
+
"__SClose": "___SClose_1dpi4_gg_",
|
|
27
|
+
"__SAddon": "___SAddon_1dpi4_gg_",
|
|
28
|
+
"__SSpot": "___SSpot_1dpi4_gg_"
|
|
29
29
|
})
|
|
30
30
|
);
|
|
31
31
|
const stylePopper = (
|
|
32
32
|
/*__reshadow_css_start__*/
|
|
33
33
|
(sstyled.insert(
|
|
34
34
|
/*__inner_css_start__*/
|
|
35
|
-
"@keyframes
|
|
35
|
+
"@keyframes enter_5mxl8{0%{opacity:0;transform:translateX(-10px)}to{opacity:1;transform:translateX(0)}}@keyframes exit_5mxl8{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-10px)}}",
|
|
36
36
|
/*__inner_css_end__*/
|
|
37
|
-
"
|
|
37
|
+
"5mxl8_gg_"
|
|
38
38
|
), /*__reshadow_css_end__*/
|
|
39
39
|
{
|
|
40
|
-
"@enter": "
|
|
41
|
-
"@exit": "
|
|
40
|
+
"@enter": "enter_5mxl8",
|
|
41
|
+
"@exit": "exit_5mxl8"
|
|
42
42
|
})
|
|
43
43
|
);
|
|
44
44
|
const enhance = [i18nEnhance(localizedMessages)];
|
|
@@ -107,7 +107,8 @@ _defineProperty(FeaturePopover, "defaultProps", {
|
|
|
107
107
|
offset: [0, 12],
|
|
108
108
|
placement: "bottom-start",
|
|
109
109
|
defaultVisible: false,
|
|
110
|
-
onOutsideClick: () =>
|
|
110
|
+
onOutsideClick: () => {
|
|
111
|
+
},
|
|
111
112
|
interaction: "none",
|
|
112
113
|
i18n: localizedMessages,
|
|
113
114
|
locale: "en",
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import type { FeaturePopoverComponent } from './FeaturePopover.type';
|
|
2
|
+
/**
|
|
3
|
+
* FeaturePopover
|
|
4
|
+
*
|
|
5
|
+
* {@link https://developer.semrush.com/intergalactic/components/feature-popover/feature-popover-api/|API} | {@link https://developer.semrush.com/intergalactic/components/feature-popover/feature-popover-code/|Examples}
|
|
6
|
+
*/
|
|
2
7
|
declare const _default: FeaturePopoverComponent;
|
|
3
8
|
export default _default;
|
|
@@ -9,6 +9,7 @@ import type { AnimationProps, BoxProps, OutsideClickProps, PortalProps, Box, Pop
|
|
|
9
9
|
import type { Intergalactic, PropGetterFn } from '@semcore/core';
|
|
10
10
|
import type { UniqueIDProps } from '@semcore/core/lib/utils/uniqueID';
|
|
11
11
|
import type React from 'react';
|
|
12
|
+
import type { LocalizedMessages } from './translations/__intergalactic-dynamic-locales';
|
|
12
13
|
/**
|
|
13
14
|
* Popper must have an accessible names (aria-group-name).
|
|
14
15
|
*/
|
|
@@ -94,6 +95,16 @@ export type FeaturePopoverProps = FPPopperProps & {
|
|
|
94
95
|
*/
|
|
95
96
|
theme?: 'accent' | 'neutral';
|
|
96
97
|
};
|
|
98
|
+
export type FeaturePopoverDefaultProps = {
|
|
99
|
+
offset: FPPopperProps['offset'];
|
|
100
|
+
placement: 'bottom-start';
|
|
101
|
+
defaultVisible: false;
|
|
102
|
+
onOutsideClick: () => void;
|
|
103
|
+
interaction: 'none';
|
|
104
|
+
i18n: LocalizedMessages;
|
|
105
|
+
locale: 'en';
|
|
106
|
+
theme: 'accent';
|
|
107
|
+
};
|
|
97
108
|
export type FeaturePopoverTriggerProps = BoxProps & {
|
|
98
109
|
theme?: FeaturePopoverProps['theme'];
|
|
99
110
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/feature-popover",
|
|
3
3
|
"description": "Semrush FeaturePopover Component",
|
|
4
|
-
"version": "17.
|
|
4
|
+
"version": "17.2.0-prerelease.5",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"require": "./lib/cjs/index.js"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/button": "^17.
|
|
17
|
+
"@semcore/button": "^17.2.0-prerelease.5"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@semcore/base-components": "^17.0
|
|
20
|
+
"@semcore/base-components": "^17.2.0",
|
|
21
21
|
"@semcore/icon": "^17.0.1"
|
|
22
22
|
},
|
|
23
23
|
"repository": {
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@popperjs/core": "2.11.5",
|
|
30
|
-
"@semcore/
|
|
31
|
-
"@semcore/
|
|
32
|
-
"@semcore/
|
|
33
|
-
"@semcore/dropdown-menu": "17.
|
|
34
|
-
"@semcore/typography": "17.
|
|
30
|
+
"@semcore/base-components": "17.2.0-prerelease.5",
|
|
31
|
+
"@semcore/button": "17.2.0-prerelease.5",
|
|
32
|
+
"@semcore/core": "17.2.0-prerelease.5",
|
|
33
|
+
"@semcore/dropdown-menu": "17.2.0-prerelease.5",
|
|
34
|
+
"@semcore/typography": "17.2.0-prerelease.5",
|
|
35
35
|
"@semcore/testing-utils": "1.0.0",
|
|
36
36
|
"@semcore/icon": "17.1.0"
|
|
37
37
|
},
|