@semcore/side-panel 16.0.0-prerelease.6 → 16.0.0-prerelease.7
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/lib/esm/SidePanel.mjs +199 -169
- package/lib/esm/index.mjs +2 -2
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +30 -30
- package/lib/esm/translations/de.json.mjs +5 -4
- package/lib/esm/translations/en.json.mjs +5 -4
- package/lib/esm/translations/es.json.mjs +5 -4
- package/lib/esm/translations/fr.json.mjs +5 -4
- package/lib/esm/translations/it.json.mjs +5 -4
- package/lib/esm/translations/ja.json.mjs +5 -4
- package/lib/esm/translations/ko.json.mjs +5 -4
- package/lib/esm/translations/nl.json.mjs +5 -4
- package/lib/esm/translations/pl.json.mjs +5 -4
- package/lib/esm/translations/pt.json.mjs +5 -4
- package/lib/esm/translations/sv.json.mjs +5 -4
- package/lib/esm/translations/tr.json.mjs +5 -4
- package/lib/esm/translations/vi.json.mjs +5 -4
- package/lib/esm/translations/zh.json.mjs +5 -4
- package/package.json +9 -9
package/lib/esm/SidePanel.mjs
CHANGED
|
@@ -1,111 +1,121 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { sstyled
|
|
9
|
-
import
|
|
10
|
-
import { Flex
|
|
11
|
-
import { FadeInOut
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { isAdvanceMode
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import { Text
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import { cssVariableEnhance
|
|
23
|
-
import { useFocusLock
|
|
24
|
-
import { useContextTheme
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import { localizedMessages
|
|
28
|
-
import { useZIndexStacking
|
|
29
|
-
var
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
+
import { sstyled, createComponent, assignProps, Component } from "@semcore/core";
|
|
9
|
+
import React from "react";
|
|
10
|
+
import { Flex, Box } from "@semcore/flex-box";
|
|
11
|
+
import { FadeInOut, Slide } from "@semcore/animation";
|
|
12
|
+
import Portal, { PortalProvider } from "@semcore/portal";
|
|
13
|
+
import OutsideClick from "@semcore/outside-click";
|
|
14
|
+
import CloseIcon from "@semcore/icon/Close/l";
|
|
15
|
+
import fire from "@semcore/core/lib/utils/fire";
|
|
16
|
+
import { isAdvanceMode } from "@semcore/core/lib/utils/findComponent";
|
|
17
|
+
import keyboardFocusEnhance from "@semcore/core/lib/utils/enhances/keyboardFocusEnhance";
|
|
18
|
+
import usePreventScroll from "@semcore/core/lib/utils/use/usePreventScroll";
|
|
19
|
+
import { Text } from "@semcore/typography";
|
|
20
|
+
import ArrowLeft from "@semcore/icon/ArrowLeft/m";
|
|
21
|
+
import Button, { ButtonLink } from "@semcore/button";
|
|
22
|
+
import { cssVariableEnhance } from "@semcore/core/lib/utils/useCssVariable";
|
|
23
|
+
import { useFocusLock } from "@semcore/core/lib/utils/use/useFocusLock";
|
|
24
|
+
import { useContextTheme } from "@semcore/core/lib/utils/ThemeProvider";
|
|
25
|
+
import logger from "@semcore/core/lib/utils/logger";
|
|
26
|
+
import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
|
|
27
|
+
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
28
|
+
import { useZIndexStacking, ZIndexStackingContextProvider } from "@semcore/core/lib/utils/zIndexStacking";
|
|
29
|
+
var style = (
|
|
30
30
|
/*__reshadow_css_start__*/
|
|
31
|
-
(
|
|
31
|
+
(sstyled.insert(
|
|
32
32
|
/*__inner_css_start__*/
|
|
33
33
|
".___SOverlay_vg6wl_gg_{position:fixed;top:0;bottom:0;left:0;right:0;margin:0;display:flex;overflow:hidden;background:var(--intergalactic-overlay-primary, rgba(25, 27, 35, 0.7));-webkit-overflow-scrolling:touch;color:var(--intergalactic-text-primary, #191b23)}.___SPanel_vg6wl_gg_{display:flex;flex-direction:column;width:260px;outline:0;font-family:inherit;position:fixed;box-sizing:border-box;will-change:transform;background:var(--intergalactic-bg-primary-neutral, #ffffff);z-index:1}.___SPanel_vg6wl_gg_._placement_right_vg6wl_gg_,.___SPanel_vg6wl_gg_._placement_top_vg6wl_gg_{box-shadow:var(--intergalactic-box-shadow-popper, 0px 1px 12px 0px rgba(25, 27, 35, 0.15));top:0}.___SPanel_vg6wl_gg_._placement_top_vg6wl_gg_{width:100%;margin-bottom:auto;left:0}.___SPanel_vg6wl_gg_._placement_right_vg6wl_gg_{height:100vh;margin-left:auto;right:0}.___SPanel_vg6wl_gg_._placement_bottom_vg6wl_gg_,.___SPanel_vg6wl_gg_._placement_left_vg6wl_gg_{box-shadow:var(--intergalactic-box-shadow-popper, 0px 1px 12px 0px rgba(25, 27, 35, 0.15));left:0}.___SPanel_vg6wl_gg_._placement_bottom_vg6wl_gg_{width:100%;margin-top:auto;bottom:0}.___SPanel_vg6wl_gg_._placement_left_vg6wl_gg_{height:100vh;margin-right:auto;top:0}.___SClose_vg6wl_gg_{position:absolute;z-index:1;right:var(--intergalactic-spacing-2x, 8px);top:var(--intergalactic-spacing-2x, 8px)}.___SClose_vg6wl_gg_ .___SAddon_vg6wl_gg_:only-child{margin-left:calc(var(--intergalactic-spacing-2x, 8px) - 1px);margin-right:calc(var(--intergalactic-spacing-2x, 8px) - 1px)}.___SBack_vg6wl_gg_{max-width:100%}.___SBack_vg6wl_gg_ .___SInner_vg6wl_gg_{display:flex}.___SBack_vg6wl_gg_ .___SBackText_vg6wl_gg_,.___STitle_vg6wl_gg_{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.___STitle_vg6wl_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%);font-weight:var(--intergalactic-bold, 700);color:var(--intergalactic-text-primary, #191b23)}.___SHeader_vg6wl_gg_{padding-left:var(--intergalactic-spacing-6x, 24px);margin-bottom:var(--intergalactic-spacing-1x, 4px);padding-right:calc(var(--intergalactic-spacing-10x, 40px) + var(--intergalactic-spacing-4x, 16px));margin-top:var(--intergalactic-spacing-1x, 4px);min-height:calc(var(--intergalactic-spacing-10x, 40px) + var(--intergalactic-spacing-3x, 12px));box-shadow:inset 0-1px 0 var(--intergalactic-border-primary, #c4c7cf);box-sizing:border-box}.___SFooter_vg6wl_gg_{min-height:44px;box-shadow:inset 0 1px 0 var(--intergalactic-border-primary, #c4c7cf);box-sizing:border-box}.___SBody_vg6wl_gg_{height:100%;overflow:auto;padding-left:var(--intergalactic-spacing-6x, 24px);padding-bottom:var(--intergalactic-spacing-4x, 16px);padding-right:var(--intergalactic-spacing-6x, 24px);padding-top:var(--intergalactic-spacing-4x, 16px)}",
|
|
34
34
|
"vg6wl_gg_"
|
|
35
35
|
), {
|
|
36
|
-
__SOverlay: "___SOverlay_vg6wl_gg_",
|
|
37
|
-
__SPanel: "___SPanel_vg6wl_gg_",
|
|
38
|
-
_placement_top: "_placement_top_vg6wl_gg_",
|
|
39
|
-
_placement_right: "_placement_right_vg6wl_gg_",
|
|
40
|
-
_placement_bottom: "_placement_bottom_vg6wl_gg_",
|
|
41
|
-
_placement_left: "_placement_left_vg6wl_gg_",
|
|
42
|
-
__STitle: "___STitle_vg6wl_gg_",
|
|
43
|
-
__SHeader: "___SHeader_vg6wl_gg_",
|
|
44
|
-
__SFooter: "___SFooter_vg6wl_gg_",
|
|
45
|
-
__SBody: "___SBody_vg6wl_gg_",
|
|
46
|
-
__SClose: "___SClose_vg6wl_gg_",
|
|
47
|
-
__SAddon: "___SAddon_vg6wl_gg_",
|
|
48
|
-
__SBack: "___SBack_vg6wl_gg_",
|
|
49
|
-
__SInner: "___SInner_vg6wl_gg_",
|
|
50
|
-
__SBackText: "___SBackText_vg6wl_gg_"
|
|
36
|
+
"__SOverlay": "___SOverlay_vg6wl_gg_",
|
|
37
|
+
"__SPanel": "___SPanel_vg6wl_gg_",
|
|
38
|
+
"_placement_top": "_placement_top_vg6wl_gg_",
|
|
39
|
+
"_placement_right": "_placement_right_vg6wl_gg_",
|
|
40
|
+
"_placement_bottom": "_placement_bottom_vg6wl_gg_",
|
|
41
|
+
"_placement_left": "_placement_left_vg6wl_gg_",
|
|
42
|
+
"__STitle": "___STitle_vg6wl_gg_",
|
|
43
|
+
"__SHeader": "___SHeader_vg6wl_gg_",
|
|
44
|
+
"__SFooter": "___SFooter_vg6wl_gg_",
|
|
45
|
+
"__SBody": "___SBody_vg6wl_gg_",
|
|
46
|
+
"__SClose": "___SClose_vg6wl_gg_",
|
|
47
|
+
"__SAddon": "___SAddon_vg6wl_gg_",
|
|
48
|
+
"__SBack": "___SBack_vg6wl_gg_",
|
|
49
|
+
"__SInner": "___SInner_vg6wl_gg_",
|
|
50
|
+
"__SBackText": "___SBackText_vg6wl_gg_"
|
|
51
51
|
})
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
52
|
+
);
|
|
53
|
+
var RootSidePanel = /* @__PURE__ */ function(_Component) {
|
|
54
|
+
_inherits(RootSidePanel2, _Component);
|
|
55
|
+
var _super = _createSuper(RootSidePanel2);
|
|
56
|
+
function RootSidePanel2() {
|
|
57
|
+
var _this;
|
|
58
|
+
_classCallCheck(this, RootSidePanel2);
|
|
59
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
60
|
+
args[_key] = arguments[_key];
|
|
61
|
+
}
|
|
62
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
63
|
+
_defineProperty(_assertThisInitialized(_this), "sidebarRef", /* @__PURE__ */ React.createRef());
|
|
64
|
+
_defineProperty(_assertThisInitialized(_this), "handleSidebarKeyDown", function(e) {
|
|
65
|
+
if (e.key === "Escape") {
|
|
66
|
+
e.stopPropagation();
|
|
67
|
+
fire(_assertThisInitialized(_this), "onClose", "onEscape", e);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
_defineProperty(_assertThisInitialized(_this), "handleIconCloseClick", function(e) {
|
|
71
|
+
fire(_assertThisInitialized(_this), "onClose", "onCloseClick", e);
|
|
72
|
+
});
|
|
73
|
+
_defineProperty(_assertThisInitialized(_this), "handleOutsideClick", function(e) {
|
|
74
|
+
fire(_assertThisInitialized(_this), "onClose", "onOutsideClick", e);
|
|
75
|
+
});
|
|
76
|
+
return _this;
|
|
67
77
|
}
|
|
68
|
-
|
|
78
|
+
_createClass(RootSidePanel2, [{
|
|
69
79
|
key: "isAdvanceMode",
|
|
70
|
-
value: function() {
|
|
71
|
-
return
|
|
80
|
+
value: function isAdvanceMode$1() {
|
|
81
|
+
return isAdvanceMode(this.asProps.Children, [SidePanel.Overlay.displayName, SidePanel.Panel.displayName]);
|
|
72
82
|
}
|
|
73
83
|
}, {
|
|
74
84
|
key: "isUsedOverlay",
|
|
75
|
-
value: function() {
|
|
76
|
-
return !this.isAdvanceMode() ||
|
|
85
|
+
value: function isUsedOverlay() {
|
|
86
|
+
return !this.isAdvanceMode() || isAdvanceMode(this.asProps.Children, [SidePanel.Overlay.displayName]);
|
|
77
87
|
}
|
|
78
88
|
}, {
|
|
79
89
|
key: "getOverlayProps",
|
|
80
|
-
value: function() {
|
|
81
|
-
var
|
|
90
|
+
value: function getOverlayProps() {
|
|
91
|
+
var _this$asProps = this.asProps, visible = _this$asProps.visible, duration = _this$asProps.duration, animationsDisabled = _this$asProps.animationsDisabled, disablePreventScroll = _this$asProps.disablePreventScroll;
|
|
82
92
|
return {
|
|
83
|
-
visible
|
|
84
|
-
duration
|
|
85
|
-
animationsDisabled
|
|
86
|
-
disablePreventScroll
|
|
93
|
+
visible,
|
|
94
|
+
duration,
|
|
95
|
+
animationsDisabled,
|
|
96
|
+
disablePreventScroll
|
|
87
97
|
};
|
|
88
98
|
}
|
|
89
99
|
}, {
|
|
90
100
|
key: "getPanelProps",
|
|
91
|
-
value: function() {
|
|
92
|
-
var
|
|
101
|
+
value: function getPanelProps() {
|
|
102
|
+
var _this$asProps2 = this.asProps, placement = _this$asProps2.placement, visible = _this$asProps2.visible, closable = _this$asProps2.closable, duration = _this$asProps2.duration, animationsDisabled = _this$asProps2.animationsDisabled, ariaLabel = _this$asProps2["aria-label"], ariaLabelledBy = _this$asProps2["aria-labelledby"];
|
|
93
103
|
return {
|
|
94
|
-
visible
|
|
95
|
-
placement
|
|
96
|
-
closable
|
|
97
|
-
duration:
|
|
104
|
+
visible,
|
|
105
|
+
placement,
|
|
106
|
+
closable,
|
|
107
|
+
duration: duration + duration / 2,
|
|
98
108
|
disableEnforceFocus: !this.isUsedOverlay(),
|
|
99
109
|
onOutsideClick: this.handleOutsideClick,
|
|
100
110
|
onKeyDown: this.handleSidebarKeyDown,
|
|
101
|
-
animationsDisabled
|
|
102
|
-
"aria-label":
|
|
103
|
-
"aria-labelledby":
|
|
111
|
+
animationsDisabled,
|
|
112
|
+
"aria-label": ariaLabel,
|
|
113
|
+
"aria-labelledby": ariaLabelledBy
|
|
104
114
|
};
|
|
105
115
|
}
|
|
106
116
|
}, {
|
|
107
117
|
key: "getCloseProps",
|
|
108
|
-
value: function() {
|
|
118
|
+
value: function getCloseProps() {
|
|
109
119
|
return {
|
|
110
120
|
onClick: this.handleIconCloseClick,
|
|
111
121
|
getI18nText: this.asProps.getI18nText
|
|
@@ -113,110 +123,130 @@ var ee = (
|
|
|
113
123
|
}
|
|
114
124
|
}, {
|
|
115
125
|
key: "render",
|
|
116
|
-
value: function() {
|
|
117
|
-
var
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
126
|
+
value: function render() {
|
|
127
|
+
var _ref = this.asProps;
|
|
128
|
+
var _this$asProps3 = this.asProps, Children = _this$asProps3.Children, disablePortal = _this$asProps3.disablePortal, ignorePortalsStacking = _this$asProps3.ignorePortalsStacking;
|
|
129
|
+
return /* @__PURE__ */ React.createElement(Portal, {
|
|
130
|
+
disablePortal,
|
|
131
|
+
ignorePortalsStacking
|
|
132
|
+
}, this.isAdvanceMode() ? /* @__PURE__ */ React.createElement(Children, null) : /* @__PURE__ */ React.createElement(SidePanel.Overlay, null, /* @__PURE__ */ React.createElement(SidePanel.Panel, assignProps({}, _ref))));
|
|
122
133
|
}
|
|
123
|
-
}])
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
134
|
+
}]);
|
|
135
|
+
return RootSidePanel2;
|
|
136
|
+
}(Component);
|
|
137
|
+
_defineProperty(RootSidePanel, "displayName", "SidePanel");
|
|
138
|
+
_defineProperty(RootSidePanel, "style", style);
|
|
139
|
+
_defineProperty(RootSidePanel, "enhance", [cssVariableEnhance({
|
|
128
140
|
variable: "--intergalactic-duration-modal",
|
|
129
141
|
fallback: "200",
|
|
130
142
|
map: Number.parseInt,
|
|
131
143
|
prop: "duration"
|
|
132
|
-
}),
|
|
133
|
-
|
|
144
|
+
}), i18nEnhance(localizedMessages)]);
|
|
145
|
+
_defineProperty(RootSidePanel, "defaultProps", {
|
|
134
146
|
placement: "right",
|
|
135
|
-
closable:
|
|
136
|
-
disablePreventScroll:
|
|
147
|
+
closable: true,
|
|
148
|
+
disablePreventScroll: false
|
|
137
149
|
});
|
|
138
|
-
function
|
|
139
|
-
var
|
|
140
|
-
|
|
141
|
-
var
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
},
|
|
150
|
+
function Overlay(props) {
|
|
151
|
+
var _ref2 = arguments[0], _ref10;
|
|
152
|
+
var SOverlay = FadeInOut;
|
|
153
|
+
var overlayRef = React.useRef(null);
|
|
154
|
+
usePreventScroll(props.visible, props.disablePreventScroll);
|
|
155
|
+
useContextTheme(overlayRef, props.visible);
|
|
156
|
+
var zIndex = useZIndexStacking("z-index-modal");
|
|
157
|
+
return _ref10 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SOverlay, _ref10.cn("SOverlay", _objectSpread({}, assignProps({
|
|
158
|
+
"ref": overlayRef,
|
|
159
|
+
"zIndex": zIndex
|
|
160
|
+
}, _ref2))));
|
|
146
161
|
}
|
|
147
|
-
function
|
|
148
|
-
var
|
|
149
|
-
|
|
150
|
-
var
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
162
|
+
function Panel(props) {
|
|
163
|
+
var _ref3 = arguments[0], _ref11;
|
|
164
|
+
var SPanel = Slide;
|
|
165
|
+
var Children = props.Children, styles = props.styles, visible = props.visible, closable = props.closable, placement = props.placement, onOutsideClick = props.onOutsideClick, forcedAdvancedMode = props.forcedAdvancedMode;
|
|
166
|
+
var advancedMode = forcedAdvancedMode || isAdvanceMode(Children, [SidePanel.Header.displayName, SidePanel.Body.displayName, SidePanel.Footer.displayName]);
|
|
167
|
+
var sidebarRef = React.useRef(null);
|
|
168
|
+
useFocusLock(sidebarRef, true, "auto", !visible, true);
|
|
169
|
+
var hasLabel = Boolean(props["aria-label"] || props["aria-labelledby"]);
|
|
170
|
+
logger.warn(!hasLabel, "'aria-label' or 'aria-labelledby' are required for SidePanel component", props["data-ui-name"] || Panel.displayName);
|
|
171
|
+
return _ref11 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, visible && /* @__PURE__ */ React.createElement(OutsideClick, _ref11.cn("OutsideClick", {
|
|
172
|
+
"onOutsideClick": onOutsideClick,
|
|
173
|
+
"excludeRefs": [sidebarRef]
|
|
174
|
+
})), /* @__PURE__ */ React.createElement(SPanel, _ref11.cn("SPanel", _objectSpread({}, assignProps({
|
|
175
|
+
"visible": visible,
|
|
176
|
+
"initialAnimation": true,
|
|
177
|
+
"slideOrigin": placement,
|
|
178
|
+
"ref": sidebarRef,
|
|
179
|
+
"role": "dialog",
|
|
160
180
|
"aria-modal": "true"
|
|
161
|
-
},
|
|
162
|
-
designToken: "z-index-modal"
|
|
163
|
-
}), /* @__PURE__ */
|
|
164
|
-
value:
|
|
165
|
-
}),
|
|
181
|
+
}, _ref3))), /* @__PURE__ */ React.createElement(ZIndexStackingContextProvider, _ref11.cn("ZIndexStackingContextProvider", {
|
|
182
|
+
"designToken": "z-index-modal"
|
|
183
|
+
}), /* @__PURE__ */ React.createElement(PortalProvider, _ref11.cn("PortalProvider", {
|
|
184
|
+
"value": sidebarRef
|
|
185
|
+
}), closable && /* @__PURE__ */ React.createElement(SidePanel.Close, null), advancedMode ? /* @__PURE__ */ React.createElement(Children, _ref11.cn("Children", {})) : /* @__PURE__ */ React.createElement(SidePanel.Body, null, /* @__PURE__ */ React.createElement(Children, _ref11.cn("Children", {})))))));
|
|
166
186
|
}
|
|
167
|
-
function
|
|
168
|
-
var
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
187
|
+
function Footer(props) {
|
|
188
|
+
var _ref4 = arguments[0], _ref12;
|
|
189
|
+
var SFooter = Flex;
|
|
190
|
+
return _ref12 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SFooter, _ref12.cn("SFooter", _objectSpread({}, assignProps({
|
|
191
|
+
"tag": "footer"
|
|
192
|
+
}, _ref4))));
|
|
172
193
|
}
|
|
173
|
-
function
|
|
174
|
-
var
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
194
|
+
function Close(_ref18) {
|
|
195
|
+
var _ref5 = arguments[0], _ref13;
|
|
196
|
+
var styles = _ref18.styles, hasChildren = _ref18.children, Children = _ref18.Children, getI18nText = _ref18.getI18nText;
|
|
197
|
+
var SClose = Button;
|
|
198
|
+
return _ref13 = sstyled(styles), /* @__PURE__ */ React.createElement(SClose, _ref13.cn("SClose", _objectSpread({}, assignProps({
|
|
199
|
+
"aria-label": getI18nText("close"),
|
|
200
|
+
"use": "tertiary",
|
|
201
|
+
"theme": "muted",
|
|
202
|
+
"size": "l",
|
|
203
|
+
"addonLeft": hasChildren ? void 0 : CloseIcon
|
|
204
|
+
}, _ref5))), hasChildren ? /* @__PURE__ */ React.createElement(Children, _ref13.cn("Children", {})) : void 0);
|
|
182
205
|
}
|
|
183
|
-
|
|
184
|
-
function
|
|
185
|
-
var
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
206
|
+
Close.enhance = [keyboardFocusEnhance()];
|
|
207
|
+
function Title(props) {
|
|
208
|
+
var _ref6 = arguments[0], _ref14;
|
|
209
|
+
var STitle = Text;
|
|
210
|
+
return _ref14 = sstyled(props.styles), /* @__PURE__ */ React.createElement(STitle, _ref14.cn("STitle", _objectSpread({}, assignProps({
|
|
211
|
+
"tag": "h6"
|
|
212
|
+
}, _ref6))));
|
|
189
213
|
}
|
|
190
|
-
function
|
|
191
|
-
var
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
214
|
+
function Back(props) {
|
|
215
|
+
var _ref7 = arguments[0], _ref15;
|
|
216
|
+
var SBack = ButtonLink;
|
|
217
|
+
var SBackText = ButtonLink.Text;
|
|
218
|
+
var Children = props.Children, styles = props.styles;
|
|
219
|
+
return _ref15 = sstyled(styles), /* @__PURE__ */ React.createElement(SBack, _ref15.cn("SBack", _objectSpread({}, assignProps({
|
|
220
|
+
"color": "text-hint",
|
|
221
|
+
"size": 100,
|
|
222
|
+
"addonLeft": ArrowLeft
|
|
223
|
+
}, _ref7))), /* @__PURE__ */ React.createElement(SBackText, _ref15.cn("SBackText", {}), /* @__PURE__ */ React.createElement(Children, _ref15.cn("Children", {}))));
|
|
197
224
|
}
|
|
198
|
-
function
|
|
199
|
-
var
|
|
200
|
-
|
|
225
|
+
function Body(props) {
|
|
226
|
+
var _ref8 = arguments[0], _ref16;
|
|
227
|
+
var SBody = Box;
|
|
228
|
+
return _ref16 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SBody, _ref16.cn("SBody", _objectSpread({}, assignProps({}, _ref8))));
|
|
201
229
|
}
|
|
202
|
-
function
|
|
203
|
-
var
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}), /* @__PURE__ */
|
|
230
|
+
function Header(props) {
|
|
231
|
+
var _ref9 = arguments[0], _ref17;
|
|
232
|
+
var SHeader = Box;
|
|
233
|
+
var Children = props.Children, styles = props.styles, title = props.title;
|
|
234
|
+
return _ref17 = sstyled(styles), /* @__PURE__ */ React.createElement(SHeader, _ref17.cn("SHeader", _objectSpread({}, assignProps({
|
|
235
|
+
"tag": "header"
|
|
236
|
+
}, _ref9))), title && /* @__PURE__ */ React.createElement(SidePanel.Title, {
|
|
237
|
+
children: title
|
|
238
|
+
}), /* @__PURE__ */ React.createElement(Children, _ref17.cn("Children", {})));
|
|
209
239
|
}
|
|
210
|
-
var
|
|
211
|
-
Overlay
|
|
212
|
-
Panel
|
|
213
|
-
Close
|
|
214
|
-
Header
|
|
215
|
-
Footer
|
|
216
|
-
Body
|
|
217
|
-
Back
|
|
218
|
-
Title
|
|
240
|
+
var SidePanel = createComponent(RootSidePanel, {
|
|
241
|
+
Overlay,
|
|
242
|
+
Panel,
|
|
243
|
+
Close,
|
|
244
|
+
Header,
|
|
245
|
+
Footer,
|
|
246
|
+
Body,
|
|
247
|
+
Back,
|
|
248
|
+
Title
|
|
219
249
|
});
|
|
220
250
|
export {
|
|
221
|
-
|
|
251
|
+
SidePanel as default
|
|
222
252
|
};
|
package/lib/esm/index.mjs
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
var
|
|
16
|
-
de
|
|
17
|
-
en
|
|
18
|
-
es
|
|
19
|
-
fr
|
|
20
|
-
it
|
|
21
|
-
ja
|
|
22
|
-
ko
|
|
23
|
-
nl
|
|
24
|
-
pt
|
|
25
|
-
tr
|
|
26
|
-
vi
|
|
27
|
-
zh
|
|
28
|
-
pl
|
|
29
|
-
sv
|
|
1
|
+
import de from "./de.json.mjs";
|
|
2
|
+
import en from "./en.json.mjs";
|
|
3
|
+
import es from "./es.json.mjs";
|
|
4
|
+
import fr from "./fr.json.mjs";
|
|
5
|
+
import it from "./it.json.mjs";
|
|
6
|
+
import ja from "./ja.json.mjs";
|
|
7
|
+
import ko from "./ko.json.mjs";
|
|
8
|
+
import nl from "./nl.json.mjs";
|
|
9
|
+
import pt from "./pt.json.mjs";
|
|
10
|
+
import tr from "./tr.json.mjs";
|
|
11
|
+
import vi from "./vi.json.mjs";
|
|
12
|
+
import zh from "./zh.json.mjs";
|
|
13
|
+
import pl from "./pl.json.mjs";
|
|
14
|
+
import sv from "./sv.json.mjs";
|
|
15
|
+
var localizedMessages = {
|
|
16
|
+
de,
|
|
17
|
+
en,
|
|
18
|
+
es,
|
|
19
|
+
fr,
|
|
20
|
+
it,
|
|
21
|
+
ja,
|
|
22
|
+
ko,
|
|
23
|
+
nl,
|
|
24
|
+
pt,
|
|
25
|
+
tr,
|
|
26
|
+
vi,
|
|
27
|
+
zh,
|
|
28
|
+
pl,
|
|
29
|
+
sv
|
|
30
30
|
};
|
|
31
31
|
export {
|
|
32
|
-
|
|
32
|
+
localizedMessages
|
|
33
33
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/side-panel",
|
|
3
3
|
"description": "Semrush SidePanel Component",
|
|
4
|
-
"version": "16.0.0-prerelease.
|
|
4
|
+
"version": "16.0.0-prerelease.7",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,16 +14,16 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/animation": "16.0.0-prerelease.
|
|
18
|
-
"@semcore/button": "16.0.0-prerelease.
|
|
19
|
-
"@semcore/flex-box": "16.0.0-prerelease.
|
|
20
|
-
"@semcore/portal": "16.0.0-prerelease.
|
|
21
|
-
"@semcore/outside-click": "16.0.0-prerelease.
|
|
22
|
-
"@semcore/typography": "16.0.0-prerelease.
|
|
23
|
-
"@semcore/icon": "16.0.0-prerelease.
|
|
17
|
+
"@semcore/animation": "16.0.0-prerelease.7",
|
|
18
|
+
"@semcore/button": "16.0.0-prerelease.7",
|
|
19
|
+
"@semcore/flex-box": "16.0.0-prerelease.7",
|
|
20
|
+
"@semcore/portal": "16.0.0-prerelease.7",
|
|
21
|
+
"@semcore/outside-click": "16.0.0-prerelease.7",
|
|
22
|
+
"@semcore/typography": "16.0.0-prerelease.7",
|
|
23
|
+
"@semcore/icon": "16.0.0-prerelease.7"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@semcore/base-components": "^16.0.0-prerelease.
|
|
26
|
+
"@semcore/base-components": "^16.0.0-prerelease.7"
|
|
27
27
|
},
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|