@salutejs/plasma-new-hope 0.231.0-canary.1647.12467637991.0 → 0.231.0-canary.1673.12468530749.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Autocomplete/Autocomplete.css +4 -4
- package/cjs/components/Combobox/ComboboxNew/Combobox.css +4 -4
- package/cjs/components/Combobox/ComboboxOld/Combobox.css +4 -4
- package/cjs/components/Combobox/ComboboxOld/ui/ComboboxDivider/ComboboxDivider.css +4 -4
- package/cjs/components/Combobox/ComboboxOld/ui/ComboboxFooter/ComboboxFooter.css +4 -4
- package/cjs/components/Combobox/ComboboxOld/ui/ComboboxGroup/ComboboxGroup.css +4 -4
- package/cjs/components/Combobox/ComboboxOld/ui/ComboboxHeader/ComboboxHeader.css +4 -4
- package/cjs/components/DatePicker/RangeDate/RangeDate.css +4 -4
- package/cjs/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.css +4 -4
- package/cjs/components/DatePicker/SingleDate/SingleDate.css +4 -4
- package/cjs/components/Dropdown/Dropdown.css +4 -4
- package/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.css +4 -4
- package/cjs/components/Pagination/Pagination.css +4 -4
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +4 -4
- package/cjs/components/Popover/Popover.css +4 -4
- package/cjs/components/Popover/Popover.js +5 -9
- package/cjs/components/Popover/Popover.js.map +1 -1
- package/cjs/components/Popover/Popover.styles.js +7 -7
- package/cjs/components/Popover/Popover.styles.js.map +1 -1
- package/cjs/components/Popover/{Popover.styles_gh4xvw.css → Popover.styles_mzmbre.css} +2 -2
- package/cjs/components/Popover/Popover.tokens.js +1 -2
- package/cjs/components/Popover/Popover.tokens.js.map +1 -1
- package/cjs/components/Portal/Portal.js +1 -1
- package/cjs/components/Portal/Portal.js.map +1 -1
- package/cjs/components/Range/Range.css +4 -4
- package/cjs/components/Select/Select.css +4 -4
- package/cjs/components/Select/ui/Target/Target.css +4 -4
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.css +4 -4
- package/cjs/components/Slider/Slider.css +4 -4
- package/cjs/components/Slider/components/DoubleUncontrolled/DoubleUncontrolled.css +4 -4
- package/cjs/components/TextArea/ui/Hint/Hint.css +4 -4
- package/cjs/components/TextField/ui/Hint/Hint.css +4 -4
- package/cjs/index.css +4 -4
- package/emotion/cjs/components/Popover/Popover.js +6 -10
- package/emotion/cjs/components/Popover/Popover.styles.js +16 -8
- package/emotion/cjs/components/Popover/Popover.template-doc.mdx +43 -128
- package/emotion/cjs/components/Popover/Popover.tokens.js +1 -2
- package/emotion/cjs/components/Portal/Portal.js +1 -1
- package/emotion/es/components/Popover/Popover.js +7 -11
- package/emotion/es/components/Popover/Popover.styles.js +16 -8
- package/emotion/es/components/Popover/Popover.template-doc.mdx +43 -128
- package/emotion/es/components/Popover/Popover.tokens.js +1 -2
- package/emotion/es/components/Portal/Portal.js +1 -1
- package/es/components/Autocomplete/Autocomplete.css +4 -4
- package/es/components/Combobox/ComboboxNew/Combobox.css +4 -4
- package/es/components/Combobox/ComboboxOld/Combobox.css +4 -4
- package/es/components/Combobox/ComboboxOld/ui/ComboboxDivider/ComboboxDivider.css +4 -4
- package/es/components/Combobox/ComboboxOld/ui/ComboboxFooter/ComboboxFooter.css +4 -4
- package/es/components/Combobox/ComboboxOld/ui/ComboboxGroup/ComboboxGroup.css +4 -4
- package/es/components/Combobox/ComboboxOld/ui/ComboboxHeader/ComboboxHeader.css +4 -4
- package/es/components/DatePicker/RangeDate/RangeDate.css +4 -4
- package/es/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.css +4 -4
- package/es/components/DatePicker/SingleDate/SingleDate.css +4 -4
- package/es/components/Dropdown/Dropdown.css +4 -4
- package/es/components/Dropdown/ui/DropdownOld/DropdownOld.css +4 -4
- package/es/components/Pagination/Pagination.css +4 -4
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +4 -4
- package/es/components/Popover/Popover.css +4 -4
- package/es/components/Popover/Popover.js +7 -11
- package/es/components/Popover/Popover.js.map +1 -1
- package/es/components/Popover/Popover.styles.js +7 -7
- package/es/components/Popover/Popover.styles.js.map +1 -1
- package/es/components/Popover/{Popover.styles_gh4xvw.css → Popover.styles_mzmbre.css} +2 -2
- package/es/components/Popover/Popover.tokens.js +1 -2
- package/es/components/Popover/Popover.tokens.js.map +1 -1
- package/es/components/Portal/Portal.js +1 -1
- package/es/components/Portal/Portal.js.map +1 -1
- package/es/components/Range/Range.css +4 -4
- package/es/components/Select/Select.css +4 -4
- package/es/components/Select/ui/Target/Target.css +4 -4
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.css +4 -4
- package/es/components/Slider/Slider.css +4 -4
- package/es/components/Slider/components/DoubleUncontrolled/DoubleUncontrolled.css +4 -4
- package/es/components/TextArea/ui/Hint/Hint.css +4 -4
- package/es/components/TextField/ui/Hint/Hint.css +4 -4
- package/es/index.css +4 -4
- package/package.json +4 -4
- package/styled-components/cjs/components/Popover/Popover.js +6 -10
- package/styled-components/cjs/components/Popover/Popover.styles.js +4 -4
- package/styled-components/cjs/components/Popover/Popover.template-doc.mdx +43 -128
- package/styled-components/cjs/components/Popover/Popover.tokens.js +1 -2
- package/styled-components/cjs/components/Portal/Portal.js +1 -1
- package/styled-components/es/components/Popover/Popover.js +7 -11
- package/styled-components/es/components/Popover/Popover.styles.js +4 -4
- package/styled-components/es/components/Popover/Popover.template-doc.mdx +43 -128
- package/styled-components/es/components/Popover/Popover.tokens.js +1 -2
- package/styled-components/es/components/Portal/Portal.js +1 -1
- package/types/components/Popover/Popover.d.ts.map +1 -1
- package/types/components/Popover/Popover.styles.d.ts +1 -1
- package/types/components/Popover/Popover.styles.d.ts.map +1 -1
- package/types/components/Popover/Popover.tokens.d.ts +0 -1
- package/types/components/Popover/Popover.tokens.d.ts.map +1 -1
- package/types/components/Popover/Popover.types.d.ts +4 -4
- package/types/components/Popover/Popover.types.d.ts.map +1 -1
- package/types/components/Portal/Portal.types.d.ts +1 -1
- package/types/components/Portal/Portal.types.d.ts.map +1 -1
@@ -8,8 +8,7 @@ var classes = exports.classes = {
|
|
8
8
|
wrapper: 'popover-wrapper',
|
9
9
|
root: 'popover-root',
|
10
10
|
target: 'popover-target',
|
11
|
-
arrow: 'popover-arrow'
|
12
|
-
targetAsRef: 'popover-target-as-ref'
|
11
|
+
arrow: 'popover-arrow'
|
13
12
|
};
|
14
13
|
var tokens = exports.tokens = {
|
15
14
|
arrowMaskWidth: '--plasma-popover-arrow-mask-width',
|
@@ -21,5 +21,5 @@ var Portal = exports.Portal = function Portal(_ref) {
|
|
21
21
|
return null;
|
22
22
|
}
|
23
23
|
var portalContainer = typeof container === 'function' ? container() : container;
|
24
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null,
|
24
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, disabled && children, !disabled && /*#__PURE__*/_reactDom["default"].createPortal(children, portalContainer));
|
25
25
|
};
|
@@ -1,3 +1,4 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
1
2
|
var _excluded = ["target", "children", "isOpen", "opened", "trigger", "hasArrow", "frame", "className", "placement", "offset", "zIndex", "isFocusTrapped", "closeOnEsc", "preventOverflow", "usePortal", "view", "onToggle", "closeOnOverlayClick"];
|
2
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
3
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
@@ -5,7 +6,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
5
6
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
6
7
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
7
8
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
8
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
9
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
10
10
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
11
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
@@ -14,7 +14,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
14
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
15
15
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
16
16
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
17
|
-
import React, { useRef, useCallback, useEffect, useState, forwardRef
|
17
|
+
import React, { useRef, useCallback, useEffect, useState, forwardRef } from 'react';
|
18
18
|
import { usePopper } from 'react-popper';
|
19
19
|
import { useForkRef } from '@salutejs/plasma-core';
|
20
20
|
import { useFocusTrap } from '../../hooks';
|
@@ -74,7 +74,6 @@ export var popoverRoot = function popoverRoot(Root) {
|
|
74
74
|
var _useState3 = useState(false),
|
75
75
|
_useState4 = _slicedToArray(_useState3, 2),
|
76
76
|
forceRender = _useState4[1];
|
77
|
-
var portalContainer = _typeof(target) === 'object' && target !== null && 'current' in target && target.current || undefined;
|
78
77
|
var isAutoArray = Array.isArray(placement);
|
79
78
|
var isAuto = isAutoArray || placement.startsWith('auto');
|
80
79
|
var initialStyles = {
|
@@ -174,7 +173,7 @@ export var popoverRoot = function popoverRoot(Root) {
|
|
174
173
|
if (typeof frame !== 'string' && frame && frame.current) {
|
175
174
|
portal = frame.current;
|
176
175
|
}
|
177
|
-
if (!usePortal
|
176
|
+
if (!usePortal) {
|
178
177
|
portal = rootRef.current;
|
179
178
|
}
|
180
179
|
if (!portal) {
|
@@ -208,11 +207,8 @@ export var popoverRoot = function popoverRoot(Root) {
|
|
208
207
|
*/
|
209
208
|
Promise.resolve().then(forceUpdate);
|
210
209
|
}, [innerIsOpen, children, forceUpdate]);
|
211
|
-
return /*#__PURE__*/React.createElement(
|
212
|
-
|
213
|
-
disabled: /*#__PURE__*/isValidElement(target)
|
214
|
-
}, /*#__PURE__*/React.createElement(StyledWrapper, {
|
215
|
-
className: cx(classes.wrapper, ! /*#__PURE__*/isValidElement(target) && classes.targetAsRef),
|
210
|
+
return /*#__PURE__*/React.createElement(StyledWrapper, {
|
211
|
+
className: classes.wrapper,
|
216
212
|
onMouseEnter: onMouseEnter,
|
217
213
|
onMouseLeave: onMouseLeave
|
218
214
|
}, /*#__PURE__*/React.createElement(StyledRoot, {
|
@@ -221,7 +217,7 @@ export var popoverRoot = function popoverRoot(Root) {
|
|
221
217
|
onFocus: onFocus,
|
222
218
|
onBlur: onBlur,
|
223
219
|
className: cx(className, classes.target)
|
224
|
-
},
|
220
|
+
}, target), children && portalRef.current && /*#__PURE__*/React.createElement(Portal, {
|
225
221
|
container: portalRef.current
|
226
222
|
}, /*#__PURE__*/React.createElement(Root, _extends({
|
227
223
|
view: view,
|
@@ -237,7 +233,7 @@ export var popoverRoot = function popoverRoot(Root) {
|
|
237
233
|
className: classes.arrow,
|
238
234
|
ref: setArrowElement,
|
239
235
|
style: styles.arrow
|
240
|
-
}, attributes.arrow)), children))))
|
236
|
+
}, attributes.arrow)), children))));
|
241
237
|
});
|
242
238
|
};
|
243
239
|
export var popoverConfig = {
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import styled from 'styled-components';
|
2
2
|
import { DEFAULT_Z_INDEX } from '../Popup/utils';
|
3
3
|
import { classes, tokens } from './Popover.tokens';
|
4
|
-
export var StyledRoot = /*#__PURE__*/styled.div.withConfig({
|
5
|
-
componentId: "plasma-new-hope__sc-tnpyex-0"
|
6
|
-
})(["display:inline-flex;box-sizing:border-box;position:relative;"]);
|
7
4
|
export var StyledWrapper = /*#__PURE__*/styled.div.withConfig({
|
5
|
+
componentId: "plasma-new-hope__sc-tnpyex-0"
|
6
|
+
})(["display:inline-block;"]);
|
7
|
+
export var StyledRoot = /*#__PURE__*/styled.div.withConfig({
|
8
8
|
componentId: "plasma-new-hope__sc-tnpyex-1"
|
9
|
-
})(["display:inline-
|
9
|
+
})(["display:inline-flex;box-sizing:border-box;position:relative;"]);
|
10
10
|
export var StyledArrow = /*#__PURE__*/styled.div.withConfig({
|
11
11
|
componentId: "plasma-new-hope__sc-tnpyex-2"
|
12
12
|
})(["width:var(", ");height:var(", ");&::before{position:absolute;width:var(", ");height:var(", ");mask-image:var(", ");background:var(", ");content:'';transform:rotate(0deg);}"], /*#__PURE__*/String(tokens.arrowMaskWidth), /*#__PURE__*/String(tokens.arrowMaskHeight), /*#__PURE__*/String(tokens.arrowMaskWidth), /*#__PURE__*/String(tokens.arrowMaskHeight), /*#__PURE__*/String(tokens.arrowMaskImage), /*#__PURE__*/String(tokens.arrowBackground));
|
@@ -4,136 +4,51 @@ title: Popover
|
|
4
4
|
---
|
5
5
|
|
6
6
|
import { PropsTable, Description } from '@site/src/components';
|
7
|
-
import Tabs from '@theme/Tabs';
|
8
|
-
import TabItem from '@theme/TabItem';
|
9
7
|
|
10
8
|
# Popover
|
11
9
|
<Description name="Popover" />
|
12
10
|
<PropsTable name="Popover" />
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
<
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
</StyledContent>
|
58
|
-
</Popover>
|
59
|
-
</section>
|
60
|
-
);
|
61
|
-
}
|
62
|
-
```
|
63
|
-
</TabItem>
|
64
|
-
<TabItem value="refObject" label="RefObject">
|
65
|
-
```tsx live
|
66
|
-
import React, { useRef, useState } from 'react';
|
67
|
-
import styled from "styled-components";
|
68
|
-
import { surfaceSolidTertiary } from "@salutejs/{{ vertical }}/tokens";
|
69
|
-
import { Popover, Button } from '@salutejs/{{ package }}';
|
70
|
-
|
71
|
-
export function App() {
|
72
|
-
const [isOpen, setIsOpen] = useState(false);
|
73
|
-
|
74
|
-
const targetRef = useRef<HTMLButtonElement | null>(null);
|
75
|
-
const targetRef2 = useRef<HTMLButtonElement | null>(null);
|
76
|
-
const targetRef3 = useRef<HTMLButtonElement | null>(null);
|
77
|
-
|
78
|
-
const refs = [targetRef, targetRef2, targetRef3];
|
79
|
-
|
80
|
-
const [currRefIndex, setCurrentRefIndex] = useState(0);
|
81
|
-
const [currentRef, setCurrentRef] = useState(targetRef);
|
82
|
-
|
83
|
-
const changeRef = () => {
|
84
|
-
let ind = currRefIndex + 1;
|
85
|
-
|
86
|
-
if (ind > refs.length - 1) {
|
87
|
-
setCurrentRefIndex(0);
|
88
|
-
ind = 0;
|
89
|
-
}
|
90
|
-
|
91
|
-
setCurrentRefIndex(ind);
|
92
|
-
setCurrentRef(refs[ind]);
|
93
|
-
};
|
94
|
-
|
95
|
-
const StyledContent = styled.div`
|
96
|
-
background: ${surfaceSolidTertiary};
|
97
|
-
padding: 1rem;
|
98
|
-
|
99
|
-
display: flex;
|
100
|
-
flex-direction: column;
|
101
|
-
align-items: center;
|
102
|
-
`;
|
103
|
-
|
104
|
-
return (
|
105
|
-
<>
|
106
|
-
<Button ref={targetRef}>Target 0</Button>
|
107
|
-
<Button style=\{{ margin: '0 5rem' }} onClick={changeRef}>
|
108
|
-
Change targetAsRef to Target {currRefIndex + 1 > refs.length - 1 ? 0 : currRefIndex + 1}
|
109
|
-
</Button>
|
110
|
-
<Button ref={targetRef2}>Target 1</Button>
|
111
|
-
<Popover
|
112
|
-
opened={isOpen}
|
113
|
-
onToggle={(is) => setIsOpen(is)}
|
114
|
-
role="presentation"
|
115
|
-
id="popover"
|
116
|
-
target={currentRef}
|
117
|
-
offset={[0, 6]}
|
118
|
-
placement='bottom'
|
119
|
-
trigger='click'
|
120
|
-
hasArrow
|
121
|
-
closeOnOverlayClick
|
122
|
-
closeOnEsc
|
123
|
-
isFocusTrapped
|
124
|
-
>
|
125
|
-
<StyledContent>
|
126
|
-
<>Content</>
|
127
|
-
<Button onClick={() => setIsOpen(false)}>Close</Button>
|
128
|
-
</StyledContent>
|
129
|
-
</Popover>
|
130
|
-
|
131
|
-
<div style=\{{ padding: '5rem' }}>Current Target: {currRefIndex}</div>
|
132
|
-
<Button ref={targetRef3}>Target 2</Button>
|
133
|
-
</>
|
134
|
-
);
|
135
|
-
}
|
136
|
-
```
|
137
|
-
</TabItem>
|
138
|
-
</Tabs>
|
139
|
-
|
12
|
+
```tsx live
|
13
|
+
import React from 'react';
|
14
|
+
import styled from "styled-components";
|
15
|
+
import { surfaceSolidTertiary } from "@salutejs/{{ vertical }}/tokens";
|
16
|
+
import { Popover, Button } from '@salutejs/{{ package }}';
|
17
|
+
|
18
|
+
export function App() {
|
19
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
20
|
+
|
21
|
+
const StyledContent = styled.div`
|
22
|
+
background: ${surfaceSolidTertiary};
|
23
|
+
padding: 1rem;
|
24
|
+
|
25
|
+
display: flex;
|
26
|
+
flex-direction: column;
|
27
|
+
align-items: center;
|
28
|
+
`;
|
29
|
+
|
30
|
+
return (
|
31
|
+
<section style=\{{width: '20rem', height: '15rem'}}>
|
32
|
+
<Popover
|
33
|
+
opened={isOpen}
|
34
|
+
onToggle={(is) => setIsOpen(is)}
|
35
|
+
role="presentation"
|
36
|
+
id="popover"
|
37
|
+
target={<Button>Target</Button>}
|
38
|
+
offset={[0, 6]}
|
39
|
+
hasArrow
|
40
|
+
placement='bottom'
|
41
|
+
trigger='click'
|
42
|
+
closeOnOverlayClick
|
43
|
+
closeOnEsc
|
44
|
+
isFocusTrapped
|
45
|
+
>
|
46
|
+
<StyledContent>
|
47
|
+
<>Content</>
|
48
|
+
<Button onClick={() => setIsOpen(false)}>close</Button>
|
49
|
+
</StyledContent>
|
50
|
+
</Popover>
|
51
|
+
</section>
|
52
|
+
);
|
53
|
+
}
|
54
|
+
```
|
@@ -2,8 +2,7 @@ export var classes = {
|
|
2
2
|
wrapper: 'popover-wrapper',
|
3
3
|
root: 'popover-root',
|
4
4
|
target: 'popover-target',
|
5
|
-
arrow: 'popover-arrow'
|
6
|
-
targetAsRef: 'popover-target-as-ref'
|
5
|
+
arrow: 'popover-arrow'
|
7
6
|
};
|
8
7
|
export var tokens = {
|
9
8
|
arrowMaskWidth: '--plasma-popover-arrow-mask-width',
|
@@ -14,5 +14,5 @@ export var Portal = function Portal(_ref) {
|
|
14
14
|
return null;
|
15
15
|
}
|
16
16
|
var portalContainer = typeof container === 'function' ? container() : container;
|
17
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
17
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, disabled && children, !disabled && /*#__PURE__*/ReactDOM.createPortal(children, portalContainer));
|
18
18
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+
|
1
|
+
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+D,MAAM,OAAO,CAAC;AAKpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAMrD,OAAO,KAAK,EAAoB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAItE,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,WAAW,SAAU,UAAU,cAAc,EAAE,YAAY,CAAC,+JA2PpE,CAAC;AAEN,eAAO,MAAM,aAAa;;;mBA7PQ,UAAU,cAAc,EAAE,YAAY,CAAC;;;;;;;;;;CA0QxE,CAAC"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { PopoverProps } from './Popover.types';
|
3
|
-
export declare const StyledRoot: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
4
3
|
export declare const StyledWrapper: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
4
|
+
export declare const StyledRoot: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
5
5
|
export declare const StyledArrow: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
6
6
|
export declare const StyledPopover: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Pick<PopoverProps, "zIndex">>;
|
7
7
|
//# sourceMappingURL=Popover.styles.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Popover.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.styles.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,eAAO,MAAM,
|
1
|
+
{"version":3,"file":"Popover.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.styles.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,eAAO,MAAM,aAAa,qKAEzB,CAAC;AAEF,eAAO,MAAM,UAAU,qKAItB,CAAC;AAEF,eAAO,MAAM,WAAW,qKAcvB,CAAC;AAEF,eAAO,MAAM,aAAa,2KAuIzB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Popover.tokens.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tokens.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO
|
1
|
+
{"version":3,"file":"Popover.tokens.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tokens.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO;;;;;CAKnB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;CAOlB,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { HTMLAttributes, ReactNode,
|
1
|
+
import type { HTMLAttributes, ReactNode, SyntheticEvent } from 'react';
|
2
2
|
import { Placement as PopoverPlacement, ComputedPlacement as PopoverPlacementBasic } from '@popperjs/core';
|
3
3
|
export type { Placement as PopoverPlacement, ComputedPlacement as PopoverPlacementBasic } from '@popperjs/core';
|
4
4
|
export declare type PopoverTrigger = 'hover' | 'click';
|
@@ -32,11 +32,11 @@ export declare type CustomPopoverProps = {
|
|
32
32
|
/**
|
33
33
|
* В каком контейнере позиционируется(по умолчанию document), можно также указать id элемента или ref для него.
|
34
34
|
*/
|
35
|
-
frame?: 'document' | string | RefObject<HTMLElement>;
|
35
|
+
frame?: 'document' | string | React.RefObject<HTMLElement>;
|
36
36
|
/**
|
37
|
-
*
|
37
|
+
* Элемент, рядом с которым произойдет вызов всплывающего окна.
|
38
38
|
*/
|
39
|
-
target?: ReactNode
|
39
|
+
target?: ReactNode;
|
40
40
|
/**
|
41
41
|
* Есть ли стрелка над элементом.
|
42
42
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Popover.types.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,
|
1
|
+
{"version":3,"file":"Popover.types.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE3G,YAAY,EAAE,SAAS,IAAI,gBAAgB,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAChH,oBAAY,cAAc,GAAG,OAAO,GAAG,OAAO,CAAC;AAE/C,oBAAY,kBAAkB,GAAG;IAC7B;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB;;;;OAIG;IACH,SAAS,CAAC,EAAE,gBAAgB,GAAG,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAC5D;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC3D;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,GAAG,KAAK,KAAK,IAAI,CAAC;IACpE;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oBAAY,YAAY,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Portal.types.d.ts","sourceRoot":"","sources":["../../../src/components/Portal/Portal.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,oBAAY,WAAW,GAAG;IACtB;;OAEG;IACH,SAAS,
|
1
|
+
{"version":3,"file":"Portal.types.d.ts","sourceRoot":"","sources":["../../../src/components/Portal/Portal.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,oBAAY,WAAW,GAAG;IACtB;;OAEG;IACH,SAAS,EAAE,WAAW,GAAG,CAAC,MAAM,WAAW,CAAC,CAAC;IAC7C;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC"}
|