@salutejs/plasma-new-hope 0.88.0-canary.1223.9302553119.0 → 0.88.0-canary.1225.9346550240.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Sheet/Sheet.css +5 -0
- package/cjs/components/Sheet/Sheet.js +91 -0
- package/cjs/components/Sheet/Sheet.js.map +1 -0
- package/cjs/components/Sheet/Sheet.styles.js +62 -0
- package/cjs/components/Sheet/Sheet.styles.js.map +1 -0
- package/cjs/components/Sheet/Sheet.styles_1bm46e7.css +5 -0
- package/cjs/components/Sheet/Sheet.tokens.js +16 -0
- package/cjs/components/Sheet/Sheet.tokens.js.map +1 -0
- package/cjs/components/Sheet/hooks/useSheet.js +26 -0
- package/cjs/components/Sheet/hooks/useSheet.js.map +1 -0
- package/cjs/components/Sheet/hooks/useSheetSwipe.js +98 -0
- package/cjs/components/Sheet/hooks/useSheetSwipe.js.map +1 -0
- package/cjs/components/Sheet/hooks/useThemeContext.js +17 -0
- package/cjs/components/Sheet/hooks/useThemeContext.js.map +1 -0
- package/cjs/components/Sheet/utils/handleTransition.js +14 -0
- package/cjs/components/Sheet/utils/handleTransition.js.map +1 -0
- package/cjs/components/Sheet/variations/_view/base.js +9 -0
- package/cjs/components/Sheet/variations/_view/base.js.map +1 -0
- package/cjs/components/Sheet/variations/_view/base_x642ct.css +1 -0
- package/cjs/index.css +6 -0
- package/cjs/index.js +6 -0
- package/cjs/index.js.map +1 -1
- package/es/components/Sheet/Sheet.css +5 -0
- package/es/components/Sheet/Sheet.js +86 -0
- package/es/components/Sheet/Sheet.js.map +1 -0
- package/es/components/Sheet/Sheet.styles.js +54 -0
- package/es/components/Sheet/Sheet.styles.js.map +1 -0
- package/es/components/Sheet/Sheet.styles_1bm46e7.css +5 -0
- package/es/components/Sheet/Sheet.tokens.js +11 -0
- package/es/components/Sheet/Sheet.tokens.js.map +1 -0
- package/es/components/Sheet/hooks/useSheet.js +22 -0
- package/es/components/Sheet/hooks/useSheet.js.map +1 -0
- package/es/components/Sheet/hooks/useSheetSwipe.js +94 -0
- package/es/components/Sheet/hooks/useSheetSwipe.js.map +1 -0
- package/es/components/Sheet/hooks/useThemeContext.js +13 -0
- package/es/components/Sheet/hooks/useThemeContext.js.map +1 -0
- package/es/components/Sheet/utils/handleTransition.js +10 -0
- package/es/components/Sheet/utils/handleTransition.js.map +1 -0
- package/es/components/Sheet/variations/_view/base.js +5 -0
- package/es/components/Sheet/variations/_view/base.js.map +1 -0
- package/es/components/Sheet/variations/_view/base_x642ct.css +1 -0
- package/es/index.css +6 -0
- package/es/index.js +2 -0
- package/es/index.js.map +1 -1
- package/package.json +4 -2
- package/styled-components/cjs/components/Sheet/Sheet.js +90 -0
- package/styled-components/cjs/components/Sheet/Sheet.styles.js +28 -0
- package/styled-components/cjs/components/Sheet/Sheet.tokens.js +14 -0
- package/styled-components/cjs/components/Sheet/hooks/index.js +26 -0
- package/styled-components/cjs/components/Sheet/hooks/useSheet.js +24 -0
- package/styled-components/cjs/components/Sheet/hooks/useSheetSwipe.js +102 -0
- package/styled-components/cjs/components/Sheet/hooks/useThemeContext.js +15 -0
- package/styled-components/cjs/components/Sheet/index.js +31 -0
- package/styled-components/cjs/components/Sheet/utils/handleTransition.js +13 -0
- package/styled-components/cjs/components/Sheet/utils/index.js +12 -0
- package/styled-components/cjs/components/Sheet/variations/_view/tokens.json +3 -0
- package/styled-components/cjs/components/_Icon/index.js +1 -15
- package/styled-components/cjs/examples/plasma_b2c/components/Sheet/Sheet.config.js +18 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Sheet/Sheet.js +17 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Sheet/Sheet.stories.tsx +239 -0
- package/styled-components/cjs/examples/plasma_web/components/Sheet/Sheet.config.js +18 -0
- package/styled-components/cjs/examples/plasma_web/components/Sheet/Sheet.js +17 -0
- package/styled-components/cjs/examples/plasma_web/components/Sheet/Sheet.stories.tsx +239 -0
- package/styled-components/cjs/index.js +11 -0
- package/styled-components/es/components/Sheet/Sheet.js +82 -0
- package/styled-components/es/components/Sheet/Sheet.styles.js +21 -0
- package/styled-components/es/components/Sheet/Sheet.tokens.js +8 -0
- package/styled-components/es/components/Sheet/hooks/index.js +3 -0
- package/styled-components/es/components/Sheet/hooks/useSheet.js +18 -0
- package/styled-components/es/components/Sheet/hooks/useSheetSwipe.js +95 -0
- package/styled-components/es/components/Sheet/hooks/useThemeContext.js +9 -0
- package/styled-components/es/components/Sheet/index.js +2 -0
- package/styled-components/es/components/Sheet/utils/handleTransition.js +7 -0
- package/styled-components/es/components/Sheet/utils/index.js +1 -0
- package/styled-components/es/components/Sheet/variations/_view/tokens.json +3 -0
- package/styled-components/es/components/_Icon/index.js +1 -3
- package/styled-components/es/examples/plasma_b2c/components/Sheet/Sheet.config.js +12 -0
- package/styled-components/es/examples/plasma_b2c/components/Sheet/Sheet.js +6 -0
- package/styled-components/es/examples/plasma_b2c/components/Sheet/Sheet.stories.tsx +239 -0
- package/styled-components/es/examples/plasma_web/components/Sheet/Sheet.config.js +12 -0
- package/styled-components/es/examples/plasma_web/components/Sheet/Sheet.js +6 -0
- package/styled-components/es/examples/plasma_web/components/Sheet/Sheet.stories.tsx +239 -0
- package/styled-components/es/index.js +1 -0
- package/types/components/Sheet/Sheet.d.ts +22 -0
- package/types/components/Sheet/Sheet.d.ts.map +1 -0
- package/types/components/Sheet/Sheet.styles.d.ts +13 -0
- package/types/components/Sheet/Sheet.styles.d.ts.map +1 -0
- package/types/components/Sheet/Sheet.tokens.d.ts +9 -0
- package/types/components/Sheet/Sheet.tokens.d.ts.map +1 -0
- package/types/components/Sheet/Sheet.types.d.ts +35 -0
- package/types/components/Sheet/Sheet.types.d.ts.map +1 -0
- package/types/components/Sheet/hooks/index.d.ts +4 -0
- package/types/components/Sheet/hooks/index.d.ts.map +1 -0
- package/types/components/Sheet/hooks/useSheet.d.ts +3 -0
- package/types/components/Sheet/hooks/useSheet.d.ts.map +1 -0
- package/types/components/Sheet/hooks/useSheetSwipe.d.ts +9 -0
- package/types/components/Sheet/hooks/useSheetSwipe.d.ts.map +1 -0
- package/types/components/Sheet/hooks/useThemeContext.d.ts +7 -0
- package/types/components/Sheet/hooks/useThemeContext.d.ts.map +1 -0
- package/types/components/Sheet/index.d.ts +4 -0
- package/types/components/Sheet/index.d.ts.map +1 -0
- package/types/components/Sheet/utils/handleTransition.d.ts +5 -0
- package/types/components/Sheet/utils/handleTransition.d.ts.map +1 -0
- package/types/components/Sheet/utils/index.d.ts +2 -0
- package/types/components/Sheet/utils/index.d.ts.map +1 -0
- package/types/components/Sheet/variations/_view/base.d.ts.map +1 -0
- package/types/components/_Icon/index.d.ts +0 -2
- package/types/components/_Icon/index.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Sheet/Sheet.config.d.ts +11 -0
- package/types/examples/plasma_b2c/components/Sheet/Sheet.config.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/Sheet/Sheet.d.ts +8 -0
- package/types/examples/plasma_b2c/components/Sheet/Sheet.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Sheet/Sheet.config.d.ts +11 -0
- package/types/examples/plasma_web/components/Sheet/Sheet.config.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Sheet/Sheet.d.ts +8 -0
- package/types/examples/plasma_web/components/Sheet/Sheet.d.ts.map +1 -0
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/styled-components/cjs/components/Accordion/Accordion.js +0 -50
- package/styled-components/cjs/components/Accordion/Accordion.styles.js +0 -9
- package/styled-components/cjs/components/Accordion/Accordion.tokens.js +0 -42
- package/styled-components/cjs/components/Accordion/index.js +0 -38
- package/styled-components/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js +0 -96
- package/styled-components/cjs/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +0 -49
- package/styled-components/cjs/components/Accordion/ui/AccordionItem/AccordionItem.types.js +0 -5
- package/styled-components/cjs/components/Accordion/variations/_size/tokens.json +0 -6
- package/styled-components/cjs/components/Accordion/variations/_stretching/base.js +0 -8
- package/styled-components/cjs/components/Accordion/variations/_stretching/tokens.json +0 -1
- package/styled-components/cjs/components/Accordion/variations/_view/base.js +0 -8
- package/styled-components/cjs/components/Accordion/variations/_view/tokens.json +0 -8
- package/styled-components/cjs/components/_Icon/Icon.assets/ChevronDownFill.js +0 -32
- package/styled-components/cjs/components/_Icon/Icon.assets/Minus.js +0 -21
- package/styled-components/cjs/components/_Icon/Icons/IconChevronDownFill.js +0 -22
- package/styled-components/cjs/components/_Icon/Icons/IconMinus.js +0 -22
- package/styled-components/cjs/examples/plasma_b2c/components/Accordion/Accordion.config.js +0 -30
- package/styled-components/cjs/examples/plasma_b2c/components/Accordion/Accordion.js +0 -17
- package/styled-components/cjs/examples/plasma_b2c/components/Accordion/Accordion.stories.tsx +0 -75
- package/styled-components/cjs/examples/plasma_web/components/Accordion/Accordion.config.js +0 -30
- package/styled-components/cjs/examples/plasma_web/components/Accordion/Accordion.js +0 -17
- package/styled-components/cjs/examples/plasma_web/components/Accordion/Accordion.stories.tsx +0 -75
- package/styled-components/es/components/Accordion/Accordion.js +0 -41
- package/styled-components/es/components/Accordion/Accordion.styles.js +0 -3
- package/styled-components/es/components/Accordion/Accordion.tokens.js +0 -36
- package/styled-components/es/components/Accordion/index.js +0 -3
- package/styled-components/es/components/Accordion/ui/AccordionItem/AccordionItem.js +0 -87
- package/styled-components/es/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +0 -42
- package/styled-components/es/components/Accordion/ui/AccordionItem/AccordionItem.types.js +0 -1
- package/styled-components/es/components/Accordion/variations/_size/tokens.json +0 -6
- package/styled-components/es/components/Accordion/variations/_stretching/base.js +0 -2
- package/styled-components/es/components/Accordion/variations/_stretching/tokens.json +0 -1
- package/styled-components/es/components/Accordion/variations/_view/base.js +0 -2
- package/styled-components/es/components/Accordion/variations/_view/tokens.json +0 -8
- package/styled-components/es/components/_Icon/Icon.assets/ChevronDownFill.js +0 -25
- package/styled-components/es/components/_Icon/Icon.assets/Minus.js +0 -14
- package/styled-components/es/components/_Icon/Icons/IconChevronDownFill.js +0 -15
- package/styled-components/es/components/_Icon/Icons/IconMinus.js +0 -15
- package/styled-components/es/examples/plasma_b2c/components/Accordion/Accordion.config.js +0 -24
- package/styled-components/es/examples/plasma_b2c/components/Accordion/Accordion.js +0 -6
- package/styled-components/es/examples/plasma_b2c/components/Accordion/Accordion.stories.tsx +0 -75
- package/styled-components/es/examples/plasma_web/components/Accordion/Accordion.config.js +0 -24
- package/styled-components/es/examples/plasma_web/components/Accordion/Accordion.js +0 -6
- package/styled-components/es/examples/plasma_web/components/Accordion/Accordion.stories.tsx +0 -75
- package/types/components/Accordion/Accordion.d.ts +0 -35
- package/types/components/Accordion/Accordion.d.ts.map +0 -1
- package/types/components/Accordion/Accordion.styles.d.ts +0 -2
- package/types/components/Accordion/Accordion.styles.d.ts.map +0 -1
- package/types/components/Accordion/Accordion.tokens.d.ts +0 -37
- package/types/components/Accordion/Accordion.tokens.d.ts.map +0 -1
- package/types/components/Accordion/Accordion.types.d.ts +0 -24
- package/types/components/Accordion/Accordion.types.d.ts.map +0 -1
- package/types/components/Accordion/index.d.ts +0 -5
- package/types/components/Accordion/index.d.ts.map +0 -1
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.d.ts +0 -4
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.d.ts.map +0 -1
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.styles.d.ts +0 -13
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.styles.d.ts.map +0 -1
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.types.d.ts +0 -39
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.types.d.ts.map +0 -1
- package/types/components/Accordion/variations/_size/base.d.ts.map +0 -1
- package/types/components/Accordion/variations/_stretching/base.d.ts +0 -2
- package/types/components/Accordion/variations/_stretching/base.d.ts.map +0 -1
- package/types/components/Accordion/variations/_view/base.d.ts +0 -2
- package/types/components/Accordion/variations/_view/base.d.ts.map +0 -1
- package/types/components/_Icon/Icon.assets/ChevronDownFill.d.ts +0 -4
- package/types/components/_Icon/Icon.assets/ChevronDownFill.d.ts.map +0 -1
- package/types/components/_Icon/Icon.assets/Minus.d.ts +0 -4
- package/types/components/_Icon/Icon.assets/Minus.d.ts.map +0 -1
- package/types/components/_Icon/Icons/IconChevronDownFill.d.ts +0 -4
- package/types/components/_Icon/Icons/IconChevronDownFill.d.ts.map +0 -1
- package/types/components/_Icon/Icons/IconMinus.d.ts +0 -4
- package/types/components/_Icon/Icons/IconMinus.d.ts.map +0 -1
- package/types/examples/plasma_b2c/components/Accordion/Accordion.config.d.ts +0 -23
- package/types/examples/plasma_b2c/components/Accordion/Accordion.config.d.ts.map +0 -1
- package/types/examples/plasma_b2c/components/Accordion/Accordion.d.ts +0 -26
- package/types/examples/plasma_b2c/components/Accordion/Accordion.d.ts.map +0 -1
- package/types/examples/plasma_web/components/Accordion/Accordion.config.d.ts +0 -23
- package/types/examples/plasma_web/components/Accordion/Accordion.config.d.ts.map +0 -1
- package/types/examples/plasma_web/components/Accordion/Accordion.d.ts +0 -26
- package/types/examples/plasma_web/components/Accordion/Accordion.d.ts.map +0 -1
- /package/styled-components/cjs/components/{Accordion/Accordion.types.js → Sheet/Sheet.types.js} +0 -0
- /package/styled-components/cjs/components/{Accordion/variations/_size → Sheet/variations/_view}/base.js +0 -0
- /package/styled-components/es/components/{Accordion/Accordion.types.js → Sheet/Sheet.types.js} +0 -0
- /package/styled-components/es/components/{Accordion/variations/_size → Sheet/variations/_view}/base.js +0 -0
- /package/types/components/{Accordion/variations/_size → Sheet/variations/_view}/base.d.ts +0 -0
@@ -0,0 +1,5 @@
|
|
1
|
+
.Sheet_styles_1bm46e7_sah7qw3__a2bd4ee6{position:fixed;top:0;bottom:0;left:0;right:0;opacity:1;-webkit-transition:var(--sah7qw3-0);transition:var(--sah7qw3-0);z-index:1000;}.Sheet_styles_1bm46e7_sah7qw3__a2bd4ee6.Sheet_styles_1bm46e7_isClosed__a2bd4ee6{opacity:0;visibility:hidden;}
|
2
|
+
.Sheet_styles_1bm46e7_shg69gz__a2bd4ee6{position:absolute;left:0;bottom:0;width:100%;max-height:100%;z-index:1;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:end;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end;-webkit-transition:var(--shg69gz-0);transition:var(--shg69gz-0);}.Sheet_styles_1bm46e7_shg69gz__a2bd4ee6.Sheet_styles_1bm46e7_isClosed__a2bd4ee6{-webkit-transform:translateY(100%);-ms-transform:translateY(100%);transform:translateY(100%);}
|
3
|
+
.Sheet_styles_1bm46e7_s1cdpbaw__a2bd4ee6{position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--s1cdpbaw-0);}
|
4
|
+
.Sheet_styles_1bm46e7_sjx120m__a2bd4ee6{border-radius:1.5rem 1.5rem 0 0;background-color:var(--plasma-sheet-content-background-color);padding:1rem;max-height:100%;overflow:auto;overscroll-behavior:contain;}.Sheet_styles_1bm46e7_sjx120m__a2bd4ee6::-webkit-scrollbar{display:none;}
|
5
|
+
.Sheet_styles_1bm46e7_s1f8rwx6__a2bd4ee6{width:4rem;padding:1.75rem 0;margin:-1.5rem 0;opacity:0.65;-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}.Sheet_styles_1bm46e7_s1f8rwx6__a2bd4ee6::before{content:'';display:block;border-radius:0.625rem;background-color:var(--plasma-sheet-handle-background-color);height:0.25rem;}
|
@@ -0,0 +1,91 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
6
|
+
var React = require('react');
|
7
|
+
var index = require('../../utils/index.js');
|
8
|
+
var useThemeContext = require('./hooks/useThemeContext.js');
|
9
|
+
var useSheetSwipe = require('./hooks/useSheetSwipe.js');
|
10
|
+
var useSheet = require('./hooks/useSheet.js');
|
11
|
+
var Sheet_tokens = require('./Sheet.tokens.js');
|
12
|
+
var Sheet_styles = require('./Sheet.styles.js');
|
13
|
+
var base = require('./variations/_view/base.js');
|
14
|
+
|
15
|
+
var _excluded = ["isOpen", "children", "onClose", "withOverlay", "withTransition", "throttleMs", "className", "view"];
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Открывает окно-шторку поверх основного экрана.
|
19
|
+
*/
|
20
|
+
|
21
|
+
var sheetRoot = function sheetRoot(Root) {
|
22
|
+
return /*#__PURE__*/React.forwardRef(function (_ref, rootRef) {
|
23
|
+
var isOpen = _ref.isOpen,
|
24
|
+
children = _ref.children,
|
25
|
+
onClose = _ref.onClose,
|
26
|
+
_ref$withOverlay = _ref.withOverlay,
|
27
|
+
withOverlay = _ref$withOverlay === void 0 ? true : _ref$withOverlay,
|
28
|
+
_ref$withTransition = _ref.withTransition,
|
29
|
+
withTransition = _ref$withTransition === void 0 ? true : _ref$withTransition,
|
30
|
+
throttleMs = _ref.throttleMs,
|
31
|
+
className = _ref.className,
|
32
|
+
view = _ref.view,
|
33
|
+
restProps = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
34
|
+
var contentWrapperRef = React.useRef(null);
|
35
|
+
var contentRef = React.useRef(null);
|
36
|
+
var handleRef = React.useRef(null);
|
37
|
+
var theme = useThemeContext.useThemeContext();
|
38
|
+
useSheet.useSheet({
|
39
|
+
isOpen: isOpen
|
40
|
+
});
|
41
|
+
useSheetSwipe.useSheetSwipe({
|
42
|
+
contentWrapperRef: contentWrapperRef,
|
43
|
+
contentRef: contentRef,
|
44
|
+
handleRef: handleRef,
|
45
|
+
throttleMs: throttleMs,
|
46
|
+
onClose: onClose
|
47
|
+
});
|
48
|
+
var isClosedClass = isOpen ? undefined : "".concat(Sheet_tokens.classes.isClosed);
|
49
|
+
return /*#__PURE__*/React.createElement(Sheet_styles.StyledWrapper, _rollupPluginBabelHelpers.extends({
|
50
|
+
theme: theme,
|
51
|
+
isOpen: isOpen,
|
52
|
+
withTransition: withTransition,
|
53
|
+
className: index.cx(isClosedClass, className)
|
54
|
+
}, restProps), /*#__PURE__*/React.createElement(Root, {
|
55
|
+
isOpen: isOpen,
|
56
|
+
onClose: onClose,
|
57
|
+
view: view,
|
58
|
+
ref: rootRef
|
59
|
+
}, /*#__PURE__*/React.createElement(Sheet_styles.StyledContentWrapper, {
|
60
|
+
theme: theme,
|
61
|
+
isOpen: isOpen,
|
62
|
+
withTransition: withTransition,
|
63
|
+
ref: contentWrapperRef
|
64
|
+
}, /*#__PURE__*/React.createElement(Sheet_styles.StyledSheetHandle, {
|
65
|
+
ref: handleRef
|
66
|
+
}), /*#__PURE__*/React.createElement(Sheet_styles.StyledSheetContent, {
|
67
|
+
ref: contentRef
|
68
|
+
}, children)), /*#__PURE__*/React.createElement(Sheet_styles.StyledOverlay, {
|
69
|
+
withOverlay: withOverlay,
|
70
|
+
onClick: onClose
|
71
|
+
})));
|
72
|
+
});
|
73
|
+
};
|
74
|
+
var sheetConfig = {
|
75
|
+
name: 'Sheet',
|
76
|
+
tag: 'div',
|
77
|
+
layout: sheetRoot,
|
78
|
+
base: '',
|
79
|
+
variations: {
|
80
|
+
view: {
|
81
|
+
css: base.base
|
82
|
+
}
|
83
|
+
},
|
84
|
+
defaults: {
|
85
|
+
view: 'default'
|
86
|
+
}
|
87
|
+
};
|
88
|
+
|
89
|
+
exports.sheetConfig = sheetConfig;
|
90
|
+
exports.sheetRoot = sheetRoot;
|
91
|
+
//# sourceMappingURL=Sheet.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Sheet.js","sources":["../../../src/components/Sheet/Sheet.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { cx } from '../../utils';\nimport { RootProps } from '../../engines';\n\nimport { SheetProps } from './Sheet.types';\nimport { useSheet, useSheetSwipe, useThemeContext } from './hooks';\nimport { classes } from './Sheet.tokens';\nimport {\n StyledContentWrapper,\n StyledOverlay,\n StyledSheetContent,\n StyledSheetHandle,\n StyledWrapper,\n} from './Sheet.styles';\nimport { base as viewCSS } from './variations/_view/base';\n\n/**\n * Открывает окно-шторку поверх основного экрана.\n */\n\nexport const sheetRoot = (Root: RootProps<HTMLDivElement, SheetProps>) =>\n forwardRef<HTMLDivElement, SheetProps>(\n (\n {\n isOpen,\n children,\n onClose,\n withOverlay = true,\n withTransition = true,\n throttleMs,\n className,\n view,\n ...restProps\n },\n rootRef,\n ) => {\n const contentWrapperRef = React.useRef<HTMLDivElement>(null);\n const contentRef = React.useRef<HTMLDivElement>(null);\n const handleRef = React.useRef<HTMLDivElement>(null);\n\n const theme = useThemeContext();\n\n useSheet({ isOpen });\n useSheetSwipe({ contentWrapperRef, contentRef, handleRef, throttleMs, onClose });\n\n const isClosedClass = isOpen ? undefined : `${classes.isClosed}`;\n\n return (\n <StyledWrapper\n theme={theme}\n isOpen={isOpen}\n withTransition={withTransition}\n className={cx(isClosedClass, className)}\n {...restProps}\n >\n <Root isOpen={isOpen} onClose={onClose} view={view} ref={rootRef}>\n <StyledContentWrapper\n theme={theme}\n isOpen={isOpen}\n withTransition={withTransition}\n ref={contentWrapperRef}\n >\n <StyledSheetHandle ref={handleRef} />\n <StyledSheetContent ref={contentRef}>{children}</StyledSheetContent>\n </StyledContentWrapper>\n <StyledOverlay withOverlay={withOverlay} onClick={onClose} />\n </Root>\n </StyledWrapper>\n );\n },\n );\n\nexport const sheetConfig = {\n name: 'Sheet',\n tag: 'div',\n layout: sheetRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n },\n defaults: {\n view: 'default',\n },\n};\n"],"names":["sheetRoot","Root","forwardRef","_ref","rootRef","isOpen","children","onClose","_ref$withOverlay","withOverlay","_ref$withTransition","withTransition","throttleMs","className","view","restProps","_objectWithoutProperties","_excluded","contentWrapperRef","React","useRef","contentRef","handleRef","theme","useThemeContext","useSheet","useSheetSwipe","isClosedClass","undefined","concat","classes","isClosed","createElement","StyledWrapper","_extends","cx","ref","StyledContentWrapper","StyledSheetHandle","StyledSheetContent","StyledOverlay","onClick","sheetConfig","name","tag","layout","base","variations","css","viewCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;AAiBA;AACA;AACA;;IAEaA,SAAS,GAAG,SAAZA,SAASA,CAAIC,IAA2C,EAAA;AAAA,EAAA,oBACjEC,gBAAU,CACN,UAAAC,IAAA,EAYIC,OAAO,EACN;AAAA,IAAA,IAXGC,MAAM,GAAAF,IAAA,CAANE,MAAM;MACNC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;MACRC,OAAO,GAAAJ,IAAA,CAAPI,OAAO;MAAAC,gBAAA,GAAAL,IAAA,CACPM,WAAW;AAAXA,MAAAA,WAAW,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,gBAAA;MAAAE,mBAAA,GAAAP,IAAA,CAClBQ,cAAc;AAAdA,MAAAA,cAAc,GAAAD,mBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,mBAAA;MACrBE,UAAU,GAAAT,IAAA,CAAVS,UAAU;MACVC,SAAS,GAAAV,IAAA,CAATU,SAAS;MACTC,IAAI,GAAAX,IAAA,CAAJW,IAAI;AACDC,MAAAA,SAAS,GAAAC,iDAAA,CAAAb,IAAA,EAAAc,SAAA,CAAA,CAAA;AAIhB,IAAA,IAAMC,iBAAiB,GAAGC,KAAK,CAACC,MAAM,CAAiB,IAAI,CAAC,CAAA;AAC5D,IAAA,IAAMC,UAAU,GAAGF,KAAK,CAACC,MAAM,CAAiB,IAAI,CAAC,CAAA;AACrD,IAAA,IAAME,SAAS,GAAGH,KAAK,CAACC,MAAM,CAAiB,IAAI,CAAC,CAAA;AAEpD,IAAA,IAAMG,KAAK,GAAGC,+BAAe,EAAE,CAAA;AAE/BC,IAAAA,iBAAQ,CAAC;AAAEpB,MAAAA,MAAM,EAANA,MAAAA;AAAO,KAAC,CAAC,CAAA;AACpBqB,IAAAA,2BAAa,CAAC;AAAER,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AA;AAAC/B,MAAAA,WAAW,EAAEA,WAAY;AAACgC,MAAAA,OAAO,EAAElC,OAAAA;KAAU,CAC1D,CACK,CAAC,CAAA;AAExB,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMmC,WAAW,GAAG;AACvBC,EAAAA,IAAI,EAAE,OAAO;AACbC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE7C,SAAS;AACjB8C,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,UAAU,EAAE;AACRjC,IAAAA,IAAI,EAAE;AACFkC,MAAAA,GAAG,EAAEC,SAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNpC,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;;"}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import './Sheet.styles_1bm46e7.css';
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
5
|
+
|
6
|
+
var react = require('@linaria/react');
|
7
|
+
var Sheet_tokens = require('./Sheet.tokens.js');
|
8
|
+
var handleTransition = require('./utils/handleTransition.js');
|
9
|
+
|
10
|
+
var _exp = function _exp() {
|
11
|
+
return handleTransition.handleTransition('all 0.5s 0.1s');
|
12
|
+
};
|
13
|
+
var StyledWrapper = /*#__PURE__*/react.styled('div')({
|
14
|
+
name: "StyledWrapper",
|
15
|
+
"class": "sah7qw3",
|
16
|
+
propsAsIs: false,
|
17
|
+
vars: {
|
18
|
+
"sah7qw3-0": [/*#__PURE__*/_exp()]
|
19
|
+
}
|
20
|
+
});
|
21
|
+
var _exp3 = function _exp3() {
|
22
|
+
return handleTransition.handleTransition('transform 0.5s');
|
23
|
+
};
|
24
|
+
var StyledContentWrapper = /*#__PURE__*/react.styled('div')({
|
25
|
+
name: "StyledContentWrapper",
|
26
|
+
"class": "shg69gz",
|
27
|
+
propsAsIs: false,
|
28
|
+
vars: {
|
29
|
+
"shg69gz-0": [/*#__PURE__*/_exp3()]
|
30
|
+
}
|
31
|
+
});
|
32
|
+
var _exp5 = function _exp5() {
|
33
|
+
return function (_ref) {
|
34
|
+
var withOverlay = _ref.withOverlay;
|
35
|
+
return withOverlay ? "var(".concat(Sheet_tokens.tokens.overlayBackgroundColor, ")") : 'transparent';
|
36
|
+
};
|
37
|
+
};
|
38
|
+
var StyledOverlay = /*#__PURE__*/react.styled('div')({
|
39
|
+
name: "StyledOverlay",
|
40
|
+
"class": "s1cdpbaw",
|
41
|
+
propsAsIs: false,
|
42
|
+
vars: {
|
43
|
+
"s1cdpbaw-0": [/*#__PURE__*/_exp5()]
|
44
|
+
}
|
45
|
+
});
|
46
|
+
var StyledSheetContent = /*#__PURE__*/react.styled('div')({
|
47
|
+
name: "StyledSheetContent",
|
48
|
+
"class": "sjx120m",
|
49
|
+
propsAsIs: false
|
50
|
+
});
|
51
|
+
var StyledSheetHandle = /*#__PURE__*/react.styled('div')({
|
52
|
+
name: "StyledSheetHandle",
|
53
|
+
"class": "s1f8rwx6",
|
54
|
+
propsAsIs: false
|
55
|
+
});
|
56
|
+
|
57
|
+
exports.StyledContentWrapper = StyledContentWrapper;
|
58
|
+
exports.StyledOverlay = StyledOverlay;
|
59
|
+
exports.StyledSheetContent = StyledSheetContent;
|
60
|
+
exports.StyledSheetHandle = StyledSheetHandle;
|
61
|
+
exports.StyledWrapper = StyledWrapper;
|
62
|
+
//# sourceMappingURL=Sheet.styles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Sheet.styles.js","sources":["../../../src/components/Sheet/Sheet.styles.ts"],"sourcesContent":["import { styled } from '@linaria/react';\n\nimport { tokens, classes } from './Sheet.tokens';\nimport { CommonProps } from './Sheet.types';\nimport { handleTransition } from './utils/handleTransition';\n\nexport const StyledWrapper = styled.div<CommonProps>`\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n opacity: 1;\n transition: ${handleTransition('all 0.5s 0.1s')};\n z-index: 1000;\n\n &.${String(classes.isClosed)} {\n opacity: 0;\n visibility: hidden;\n }\n`;\n\nexport const StyledContentWrapper = styled.div<CommonProps>`\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n max-height: 100%;\n z-index: 1;\n\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n\n transition: ${handleTransition('transform 0.5s')};\n\n &.${String(classes.isClosed)} {\n transform: translateY(100%);\n }\n`;\n\nexport const StyledOverlay = styled.div<{ withOverlay: boolean }>`\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n\n background-color: ${({ withOverlay }) => (withOverlay ? `var(${tokens.overlayBackgroundColor})` : 'transparent')};\n`;\n\nexport const StyledSheetContent = styled.div`\n border-radius: 1.5rem 1.5rem 0 0;\n background-color: var(${tokens.contentBackgroundColor});\n padding: 1rem;\n\n max-height: 100%;\n overflow: auto;\n overscroll-behavior: contain;\n\n &::-webkit-scrollbar {\n display: none;\n }\n`;\n\nexport const StyledSheetHandle = styled.div`\n width: 4rem;\n padding: 1.75rem 0;\n margin: -1.5rem 0;\n opacity: 0.65;\n align-self: center;\n\n &::before {\n content: '';\n display: block;\n border-radius: 0.625rem;\n background-color: var(${tokens.handleColor});\n height: 0.25rem;\n }\n`;\n"],"names":["_exp","handleTransition","StyledWrapper","styled","name","class","propsAsIs","vars","_exp3","StyledContentWrapper","_exp5","_ref","withOverlay","concat","tokens","overlayBackgroundColor","StyledOverlay","StyledSheetContent","StyledSheetHandle"],"mappings":";;;;;;;;AAI4D,IAAAA,IAAA,GAH1CA,SAG0CA,IAAAA,GAAA;EAAA,OAS1CC,iCAAgB,CAAC,eAAe,CAAC,CAAA;AAAA,CAAA,CAAA;AAP5C,IAAMC,aAAa,gBAAGC,YAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,eAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAAC,EAAAA,IAAA,EAAA;AAAA,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AAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,mBAAA;AAAAC,EAAAA,OAAAA,EAAA,UAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CActC;;;;;;;;"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
.sah7qw3{position:fixed;top:0;bottom:0;left:0;right:0;opacity:1;-webkit-transition:var(--sah7qw3-0);transition:var(--sah7qw3-0);z-index:1000;}.sah7qw3.is-closed{opacity:0;visibility:hidden;}
|
2
|
+
.shg69gz{position:absolute;left:0;bottom:0;width:100%;max-height:100%;z-index:1;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:end;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end;-webkit-transition:var(--shg69gz-0);transition:var(--shg69gz-0);}.shg69gz.is-closed{-webkit-transform:translateY(100%);-ms-transform:translateY(100%);transform:translateY(100%);}
|
3
|
+
.s1cdpbaw{position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--s1cdpbaw-0);}
|
4
|
+
.sjx120m{border-radius:1.5rem 1.5rem 0 0;background-color:var(--plasma-sheet-content-background-color);padding:1rem;max-height:100%;overflow:auto;overscroll-behavior:contain;}.sjx120m::-webkit-scrollbar{display:none;}
|
5
|
+
.s1f8rwx6{width:4rem;padding:1.75rem 0;margin:-1.5rem 0;opacity:0.65;-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}.s1f8rwx6::before{content:'';display:block;border-radius:0.625rem;background-color:var(--plasma-sheet-handle-background-color);height:0.25rem;}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var classes = {
|
6
|
+
isClosed: 'is-closed'
|
7
|
+
};
|
8
|
+
var tokens = {
|
9
|
+
overlayBackgroundColor: '--plasma-sheet-overlay-background-color',
|
10
|
+
contentBackgroundColor: '--plasma-sheet-content-background-color',
|
11
|
+
handleColor: '--plasma-sheet-handle-background-color'
|
12
|
+
};
|
13
|
+
|
14
|
+
exports.classes = classes;
|
15
|
+
exports.tokens = tokens;
|
16
|
+
//# sourceMappingURL=Sheet.tokens.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Sheet.tokens.js","sources":["../../../src/components/Sheet/Sheet.tokens.ts"],"sourcesContent":["export const classes = {\n isClosed: 'is-closed',\n};\n\nexport const tokens = {\n overlayBackgroundColor: '--plasma-sheet-overlay-background-color',\n\n contentBackgroundColor: '--plasma-sheet-content-background-color',\n\n handleColor: '--plasma-sheet-handle-background-color',\n};\n"],"names":["classes","isClosed","tokens","overlayBackgroundColor","contentBackgroundColor","handleColor"],"mappings":";;;;AAAO,IAAMA,OAAO,GAAG;AACnBC,EAAAA,QAAQ,EAAE,WAAA;AACd,EAAC;AAEM,IAAMC,MAAM,GAAG;AAClBC,EAAAA,sBAAsB,EAAE,yCAAyC;AAEjEC,EAAAA,sBAAsB,EAAE,yCAAyC;AAEjEC,EAAAA,WAAW,EAAE,wCAAA;AACjB;;;;;"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var React = require('react');
|
6
|
+
|
7
|
+
var useSheet = function useSheet(_ref) {
|
8
|
+
var isOpen = _ref.isOpen;
|
9
|
+
var overflow = React.useRef(document.body.style.overflowY);
|
10
|
+
|
11
|
+
// linaria не поддерживает динамический global
|
12
|
+
React.useEffect(function () {
|
13
|
+
if (isOpen) {
|
14
|
+
overflow.current = document.body.style.overflowY;
|
15
|
+
document.body.style.overflowY = 'hidden';
|
16
|
+
}
|
17
|
+
}, [isOpen]);
|
18
|
+
React.useEffect(function () {
|
19
|
+
if (!isOpen) {
|
20
|
+
document.body.style.overflowY = overflow.current;
|
21
|
+
}
|
22
|
+
}, [isOpen, overflow.current]);
|
23
|
+
};
|
24
|
+
|
25
|
+
exports.useSheet = useSheet;
|
26
|
+
//# sourceMappingURL=useSheet.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useSheet.js","sources":["../../../../src/components/Sheet/hooks/useSheet.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\nimport { SheetHookArgs } from '../Sheet.types';\n\nexport const useSheet = ({ isOpen }: SheetHookArgs) => {\n const overflow = useRef<string>(document.body.style.overflowY);\n\n // linaria не поддерживает динамический global\n useEffect(() => {\n if (isOpen) {\n overflow.current = document.body.style.overflowY;\n document.body.style.overflowY = 'hidden';\n }\n }, [isOpen]);\n\n useEffect(() => {\n if (!isOpen) {\n document.body.style.overflowY = overflow.current;\n }\n }, [isOpen, overflow.current]);\n};\n"],"names":["useSheet","_ref","isOpen","overflow","useRef","document","body","style","overflowY","useEffect","current"],"mappings":";;;;;;IAIaA,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAAkC;AAAA,EAAA,IAA5BC,MAAM,GAAAD,IAAA,CAANC,MAAM,CAAA;EAC7B,IAAMC,QAAQ,GAAGC,YAAM,CAASC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAACC,SAAS,CAAC,CAAA;;AAE9D;AACAC,EAAAA,eAAS,CAAC,YAAM;AACZ,IAAA,IAAIP,MAAM,EAAE;MACRC,QAAQ,CAACO,OAAO,GAAGL,QAAQ,CAACC,IAAI,CAACC,KAAK,CAACC,SAAS,CAAA;AAChDH,MAAAA,QAAQ,CAACC,IAAI,CAACC,KAAK,CAACC,SAAS,GAAG,QAAQ,CAAA;AAC5C,KAAA;AACJ,GAAC,EAAE,CAACN,MAAM,CAAC,CAAC,CAAA;AAEZO,EAAAA,eAAS,CAAC,YAAM;IACZ,IAAI,CAACP,MAAM,EAAE;MACTG,QAAQ,CAACC,IAAI,CAACC,KAAK,CAACC,SAAS,GAAGL,QAAQ,CAACO,OAAO,CAAA;AACpD,KAAA;GACH,EAAE,CAACR,MAAM,EAAEC,QAAQ,CAACO,OAAO,CAAC,CAAC,CAAA;AAClC;;;;"}
|
@@ -0,0 +1,98 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
6
|
+
var throttle = require('lodash.throttle');
|
7
|
+
var React = require('react');
|
8
|
+
|
9
|
+
var SWIPE_THRESHOLD = 0.2;
|
10
|
+
var THROTTLE_DEFAULT_MS = 0;
|
11
|
+
var isScrollable = function isScrollable(element) {
|
12
|
+
if (!element) {
|
13
|
+
return false;
|
14
|
+
}
|
15
|
+
var style = getComputedStyle(element);
|
16
|
+
return style.overflow === 'scroll' || style.overflow === 'auto' || style.overflowY === 'scroll' || style.overflowY === 'auto';
|
17
|
+
};
|
18
|
+
var useSheetSwipe = function useSheetSwipe(args) {
|
19
|
+
var contentWrapperRef = args.contentWrapperRef,
|
20
|
+
contentRef = args.contentRef,
|
21
|
+
handleRef = args.handleRef,
|
22
|
+
onClose = args.onClose,
|
23
|
+
_args$throttleMs = args.throttleMs,
|
24
|
+
throttleMs = _args$throttleMs === void 0 ? THROTTLE_DEFAULT_MS : _args$throttleMs;
|
25
|
+
var _useState = React.useState(true),
|
26
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
27
|
+
isTopScroll = _useState2[0],
|
28
|
+
setIsTopScroll = _useState2[1];
|
29
|
+
var isOverscroll = React.useRef(false);
|
30
|
+
var startY = React.useRef(0);
|
31
|
+
var currentY = React.useRef(0);
|
32
|
+
React.useEffect(function () {
|
33
|
+
var contentWrapperEl = contentWrapperRef.current;
|
34
|
+
var handleEl = handleRef.current;
|
35
|
+
var contentEl = contentRef.current;
|
36
|
+
var triggerElement = !isTopScroll ? handleEl : contentWrapperEl;
|
37
|
+
if (!triggerElement || !contentEl || !contentWrapperEl) {
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
var nodes = Array.from(contentWrapperEl.querySelectorAll('*'));
|
41
|
+
var scrollableElements = nodes.filter(isScrollable);
|
42
|
+
contentWrapperEl.style.willChange = 'transform';
|
43
|
+
var onTouchStart = function onTouchStart(event) {
|
44
|
+
isOverscroll.current = false;
|
45
|
+
startY.current = event.changedTouches[0].clientY;
|
46
|
+
currentY.current = startY.current;
|
47
|
+
contentWrapperEl.style.transition = 'none';
|
48
|
+
};
|
49
|
+
var onTouchMove = function onTouchMove(event) {
|
50
|
+
var clientY = event.changedTouches[0].clientY;
|
51
|
+
currentY.current = Math.max(startY.current, clientY);
|
52
|
+
var offsetY = currentY.current - startY.current;
|
53
|
+
if (isOverscroll.current) {
|
54
|
+
startY.current = Infinity;
|
55
|
+
return;
|
56
|
+
}
|
57
|
+
if (offsetY !== 0 && event.cancelable) {
|
58
|
+
event.preventDefault();
|
59
|
+
}
|
60
|
+
contentWrapperEl.style.transform = "translateY(".concat(offsetY, "px)");
|
61
|
+
};
|
62
|
+
var onTouchEnd = function onTouchEnd(event) {
|
63
|
+
isOverscroll.current = false;
|
64
|
+
var curtainHeight = contentWrapperEl.offsetHeight;
|
65
|
+
var endY = event.changedTouches[0].clientY;
|
66
|
+
var offsetY = endY - startY.current;
|
67
|
+
contentWrapperEl.style.transform = '';
|
68
|
+
contentWrapperEl.style.transition = '';
|
69
|
+
if (offsetY / curtainHeight > SWIPE_THRESHOLD) {
|
70
|
+
onClose();
|
71
|
+
}
|
72
|
+
};
|
73
|
+
var onScroll = throttle(function (event) {
|
74
|
+
var onTop = event.target.scrollTop <= 0;
|
75
|
+
if (!onTop) {
|
76
|
+
isOverscroll.current = true;
|
77
|
+
}
|
78
|
+
setIsTopScroll(onTop);
|
79
|
+
}, throttleMs);
|
80
|
+
triggerElement.addEventListener('touchstart', onTouchStart);
|
81
|
+
triggerElement.addEventListener('touchmove', onTouchMove);
|
82
|
+
triggerElement.addEventListener('touchend', onTouchEnd);
|
83
|
+
scrollableElements.forEach(function (element) {
|
84
|
+
element.addEventListener('scroll', onScroll);
|
85
|
+
});
|
86
|
+
return function () {
|
87
|
+
triggerElement.removeEventListener('touchstart', onTouchStart);
|
88
|
+
triggerElement.removeEventListener('touchmove', onTouchMove);
|
89
|
+
triggerElement.removeEventListener('touchend', onTouchEnd);
|
90
|
+
scrollableElements.forEach(function (element) {
|
91
|
+
element.removeEventListener('scroll', onScroll);
|
92
|
+
});
|
93
|
+
};
|
94
|
+
}, [isTopScroll]);
|
95
|
+
};
|
96
|
+
|
97
|
+
exports.useSheetSwipe = useSheetSwipe;
|
98
|
+
//# sourceMappingURL=useSheetSwipe.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useSheetSwipe.js","sources":["../../../../src/components/Sheet/hooks/useSheetSwipe.ts"],"sourcesContent":["import throttle from 'lodash.throttle';\nimport React, { useEffect, useRef, useState } from 'react';\n\nconst SWIPE_THRESHOLD = 0.2;\nconst THROTTLE_DEFAULT_MS = 0;\n\nconst isScrollable = (element: HTMLElement | null) => {\n if (!element) {\n return false;\n }\n\n const style = getComputedStyle(element);\n\n return (\n style.overflow === 'scroll' ||\n style.overflow === 'auto' ||\n style.overflowY === 'scroll' ||\n style.overflowY === 'auto'\n );\n};\n\nexport const useSheetSwipe = (args: {\n contentWrapperRef: React.RefObject<HTMLDivElement>;\n contentRef: React.RefObject<HTMLDivElement>;\n handleRef: React.RefObject<HTMLDivElement>;\n throttleMs?: number;\n onClose: () => void;\n}) => {\n const { contentWrapperRef, contentRef, handleRef, onClose, throttleMs = THROTTLE_DEFAULT_MS } = args;\n const [isTopScroll, setIsTopScroll] = useState(true);\n const isOverscroll = useRef(false);\n const startY = useRef(0);\n const currentY = useRef(0);\n\n useEffect(() => {\n const contentWrapperEl = contentWrapperRef.current;\n const handleEl = handleRef.current;\n const contentEl = contentRef.current;\n\n const triggerElement = !isTopScroll ? handleEl : contentWrapperEl;\n\n if (!triggerElement || !contentEl || !contentWrapperEl) {\n return;\n }\n\n const nodes = Array.from<HTMLElement>(contentWrapperEl.querySelectorAll('*'));\n const scrollableElements = nodes.filter(isScrollable);\n\n contentWrapperEl.style.willChange = 'transform';\n\n const onTouchStart = (event: TouchEvent) => {\n isOverscroll.current = false;\n\n startY.current = event.changedTouches[0].clientY;\n currentY.current = startY.current;\n\n contentWrapperEl.style.transition = 'none';\n };\n\n const onTouchMove = (event: TouchEvent) => {\n const { clientY } = event.changedTouches[0];\n currentY.current = Math.max(startY.current, clientY);\n const offsetY = currentY.current - startY.current;\n\n if (isOverscroll.current) {\n startY.current = Infinity;\n return;\n }\n\n if (offsetY !== 0 && event.cancelable) {\n event.preventDefault();\n }\n\n contentWrapperEl.style.transform = `translateY(${offsetY}px)`;\n };\n\n const onTouchEnd = (event: TouchEvent) => {\n isOverscroll.current = false;\n\n const curtainHeight = contentWrapperEl.offsetHeight;\n const endY = event.changedTouches[0].clientY;\n const offsetY = endY - startY.current;\n\n contentWrapperEl.style.transform = '';\n contentWrapperEl.style.transition = '';\n\n if (offsetY / curtainHeight > SWIPE_THRESHOLD) {\n onClose();\n }\n };\n\n const onScroll = throttle((event: Event) => {\n const onTop = (event.target as HTMLElement).scrollTop <= 0;\n\n if (!onTop) {\n isOverscroll.current = true;\n }\n\n setIsTopScroll(onTop);\n }, throttleMs);\n\n triggerElement.addEventListener('touchstart', onTouchStart);\n triggerElement.addEventListener('touchmove', onTouchMove);\n triggerElement.addEventListener('touchend', onTouchEnd);\n\n scrollableElements.forEach((element) => {\n element.addEventListener('scroll', onScroll);\n });\n\n return () => {\n triggerElement.removeEventListener('touchstart', onTouchStart);\n triggerElement.removeEventListener('touchmove', onTouchMove);\n triggerElement.removeEventListener('touchend', onTouchEnd);\n\n scrollableElements.forEach((element) => {\n element.removeEventListener('scroll', onScroll);\n });\n };\n }, [isTopScroll]);\n};\n"],"names":["SWIPE_THRESHOLD","THROTTLE_DEFAULT_MS","isScrollable","element","style","getComputedStyle","overflow","overflowY","useSheetSwipe","args","contentWrapperRef","contentRef","handleRef","onClose","_args$throttleMs","throttleMs","_useState","useState","_useState2","_slicedToArray","isTopScroll","setIsTopScroll","isOverscroll","useRef","startY","currentY","useEffect","contentWrapperEl","current","handleEl","contentEl","triggerElement","nodes","Array","from","querySelectorAll","scrollableElements","filter","willChange","onTouchStart","event","changedTouches","clientY","transition","onTouchMove","Math","max","offsetY","Infinity","cancelable","preventDefault","transform","concat","onTouchEnd","curtainHeight","offsetHeight","endY","onScroll","throttle","onTop","target","scrollTop","addEventListener","forEach","removeEventListener"],"mappings":";;;;;;;;AAGA,IAAMA,eAAe,GAAG,GAAG,CAAA;AAC3B,IAAMC,mBAAmB,GAAG,CAAC,CAAA;AAE7B,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAIC,OAA2B,EAAK;EAClD,IAAI,CAACA,OAAO,EAAE;AACV,IAAA,OAAO,KAAK,CAAA;AAChB,GAAA;AAEA,EAAA,IAAMC,KAAK,GAAGC,gBAAgB,CAACF,OAAO,CAAC,CAAA;EAEvC,OACIC,KAAK,CAACE,QAAQ,KAAK,QAAQ,IAC3BF,KAAK,CAACE,QAAQ,KAAK,MAAM,IACzBF,KAAK,CAACG,SAAS,KAAK,QAAQ,IAC5BH,KAAK,CAACG,SAAS,KAAK,MAAM,CAAA;AAElC,CAAC,CAAA;IAEYC,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,IAM7B,EAAK;AACF,EAAA,IAAQC,iBAAiB,GAAuED,IAAI,CAA5FC,iBAAiB;IAAEC,UAAU,GAA2DF,IAAI,CAAzEE,UAAU;IAAEC,SAAS,GAAgDH,IAAI,CAA7DG,SAAS;IAAEC,OAAO,GAAuCJ,IAAI,CAAlDI,OAAO;IAAAC,gBAAA,GAAuCL,IAAI,CAAzCM,UAAU;AAAVA,IAAAA,UAAU,GAAAD,gBAAA,KAAGb,KAAAA,CAAAA,GAAAA,mBAAmB,GAAAa,gBAAA,CAAA;AAC3F,EAAA,IAAAE,SAAA,GAAsCC,cAAQ,CAAC,IAAI,CAAC;IAAAC,U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CAAC,CAAA;AACnD,OAAC,CAAC,CAAA;KACL,CAAA;AACL,GAAC,EAAE,CAACrC,WAAW,CAAC,CAAC,CAAA;AACrB;;;;"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var React = require('react');
|
6
|
+
var styled = require('styled-components');
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Возвращает контекст темы.
|
10
|
+
* @return {ThemeProviderContext}
|
11
|
+
*/
|
12
|
+
var useThemeContext = function useThemeContext() {
|
13
|
+
return React.useContext(styled.ThemeContext) || {};
|
14
|
+
};
|
15
|
+
|
16
|
+
exports.useThemeContext = useThemeContext;
|
17
|
+
//# sourceMappingURL=useThemeContext.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useThemeContext.js","sources":["../../../../src/components/Sheet/hooks/useThemeContext.ts"],"sourcesContent":["import { useContext } from 'react';\nimport { ThemeContext } from 'styled-components';\n\nimport { ThemeProviderContext } from '../Sheet.types';\n\n/**\n * Возвращает контекст темы.\n * @return {ThemeProviderContext}\n */\nexport const useThemeContext = (): ThemeProviderContext => {\n return useContext<ThemeProviderContext>(ThemeContext) || {};\n};\n"],"names":["useThemeContext","useContext","ThemeContext"],"mappings":";;;;;;;AAKA;AACA;AACA;AACA;IACaA,eAAe,GAAG,SAAlBA,eAAeA,GAA+B;AACvD,EAAA,OAAOC,gBAAU,CAAuBC,mBAAY,CAAC,IAAI,EAAE,CAAA;AAC/D;;;;"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var handleTransition = function handleTransition(transition) {
|
6
|
+
return function (props) {
|
7
|
+
var lowPerformance = props.theme.lowPerformance,
|
8
|
+
withTransition = props.withTransition;
|
9
|
+
return !withTransition || lowPerformance ? 'unset' : transition;
|
10
|
+
};
|
11
|
+
};
|
12
|
+
|
13
|
+
exports.handleTransition = handleTransition;
|
14
|
+
//# sourceMappingURL=handleTransition.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"handleTransition.js","sources":["../../../../src/components/Sheet/utils/handleTransition.ts"],"sourcesContent":["import { CommonProps } from '../Sheet.types';\n\ntype HandleTransitionProps = Omit<CommonProps, 'isOpen'>;\n\nexport const handleTransition = (transition: string) => (props: HandleTransitionProps): string => {\n const {\n theme: { lowPerformance },\n withTransition,\n } = props;\n\n return !withTransition || lowPerformance ? 'unset' : transition;\n};\n"],"names":["handleTransition","transition","props","lowPerformance","theme","withTransition"],"mappings":";;;;IAIaA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,UAAkB,EAAA;EAAA,OAAK,UAACC,KAA4B,EAAa;AAC9F,IAAA,IACaC,cAAc,GAEvBD,KAAK,CAFLE,KAAK,CAAID,cAAc;MACvBE,cAAc,GACdH,KAAK,CADLG,cAAc,CAAA;AAGlB,IAAA,OAAO,CAACA,cAAc,IAAIF,cAAc,GAAG,OAAO,GAAGF,UAAU,CAAA;GAClE,CAAA;AAAA;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base.js","sources":["../../../../../src/components/Sheet/variations/_view/base.ts"],"sourcesContent":["import { css } from '@linaria/core';\n\nexport const base = css``;\n"],"names":["base"],"mappings":";;;;AAEO,IAAMA,IAAI,GAAQ;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
|
package/cjs/index.css
CHANGED
@@ -538,6 +538,12 @@
|
|
538
538
|
|
539
539
|
.ToolbarDivider_styles_1ypqhb1_mcdkovg__81732880{-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;--plasma-divider-background:var(--plasma-toolbar-divider-color);--plasma-divider-border-radius:var(--plasma-toolbar-divider-border-radius);}
|
540
540
|
|
541
|
+
.Sheet_styles_1bm46e7_sah7qw3__a2bd4ee6{position:fixed;top:0;bottom:0;left:0;right:0;opacity:1;-webkit-transition:var(--sah7qw3-0);transition:var(--sah7qw3-0);z-index:1000;}.Sheet_styles_1bm46e7_sah7qw3__a2bd4ee6.Sheet_styles_1bm46e7_isClosed__a2bd4ee6{opacity:0;visibility:hidden;}
|
542
|
+
.Sheet_styles_1bm46e7_shg69gz__a2bd4ee6{position:absolute;left:0;bottom:0;width:100%;max-height:100%;z-index:1;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:end;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end;-webkit-transition:var(--shg69gz-0);transition:var(--shg69gz-0);}.Sheet_styles_1bm46e7_shg69gz__a2bd4ee6.Sheet_styles_1bm46e7_isClosed__a2bd4ee6{-webkit-transform:translateY(100%);-ms-transform:translateY(100%);transform:translateY(100%);}
|
543
|
+
.Sheet_styles_1bm46e7_s1cdpbaw__a2bd4ee6{position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--s1cdpbaw-0);}
|
544
|
+
.Sheet_styles_1bm46e7_sjx120m__a2bd4ee6{border-radius:1.5rem 1.5rem 0 0;background-color:var(--plasma-sheet-content-background-color);padding:1rem;max-height:100%;overflow:auto;overscroll-behavior:contain;}.Sheet_styles_1bm46e7_sjx120m__a2bd4ee6::-webkit-scrollbar{display:none;}
|
545
|
+
.Sheet_styles_1bm46e7_s1f8rwx6__a2bd4ee6{width:4rem;padding:1.75rem 0;margin:-1.5rem 0;opacity:0.65;-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}.Sheet_styles_1bm46e7_s1f8rwx6__a2bd4ee6::before{content:'';display:block;border-radius:0.625rem;background-color:var(--plasma-sheet-handle-background-color);height:0.25rem;}
|
546
|
+
|
541
547
|
.SliderBase_styles_7is2ll_s33crq1__0c0959e2{-webkit-flex:1;-ms-flex:1;flex:1;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;height:var(--plasma-slider-height);}
|
542
548
|
.SliderBase_styles_7is2ll_rnaoqfb__0c0959e2{height:100%;}
|
543
549
|
.SliderBase_styles_7is2ll_r1bro5xo__0c0959e2{position:relative;top:50%;height:var(--plasma-slider-rail-height);border-radius:var(--plasma-slider-rail-border-radius);background-color:var(--plasma-slider-rail-background-color);overflow:hidden;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);}
|
package/cjs/index.js
CHANGED
@@ -171,6 +171,8 @@ var Divider_tokens = require('./components/Divider/Divider.tokens.js');
|
|
171
171
|
var Toolbar = require('./components/Toolbar/Toolbar.js');
|
172
172
|
var Toolbar_tokens = require('./components/Toolbar/Toolbar.tokens.js');
|
173
173
|
var ToolbarDivider = require('./components/Toolbar/ui/ToolbarDivider/ToolbarDivider.js');
|
174
|
+
var Sheet = require('./components/Sheet/Sheet.js');
|
175
|
+
var Sheet_tokens = require('./components/Sheet/Sheet.tokens.js');
|
174
176
|
var Slider = require('./components/Slider/Slider.js');
|
175
177
|
var Slider_tokens = require('./components/Slider/Slider.tokens.js');
|
176
178
|
require('react');
|
@@ -519,6 +521,10 @@ exports.toolbarRoot = Toolbar.toolbarRoot;
|
|
519
521
|
exports.toolbarTokens = Toolbar_tokens.tokens;
|
520
522
|
exports.toolbarDividerConfig = ToolbarDivider.toolbarDividerConfig;
|
521
523
|
exports.toolbarDividerRoot = ToolbarDivider.toolbarDividerRoot;
|
524
|
+
exports.sheetConfig = Sheet.sheetConfig;
|
525
|
+
exports.sheetRoot = Sheet.sheetRoot;
|
526
|
+
exports.sheetClasses = Sheet_tokens.classes;
|
527
|
+
exports.sheetTokens = Sheet_tokens.tokens;
|
522
528
|
exports.sliderConfig = Slider.sliderConfig;
|
523
529
|
exports.sliderRoot = Slider.sliderRoot;
|
524
530
|
exports.sliderTokens = Slider_tokens.tokens;
|
package/cjs/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
.Sheet_styles_1bm46e7_sah7qw3__a2bd4ee6{position:fixed;top:0;bottom:0;left:0;right:0;opacity:1;-webkit-transition:var(--sah7qw3-0);transition:var(--sah7qw3-0);z-index:1000;}.Sheet_styles_1bm46e7_sah7qw3__a2bd4ee6.Sheet_styles_1bm46e7_isClosed__a2bd4ee6{opacity:0;visibility:hidden;}
|
2
|
+
.Sheet_styles_1bm46e7_shg69gz__a2bd4ee6{position:absolute;left:0;bottom:0;width:100%;max-height:100%;z-index:1;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:end;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end;-webkit-transition:var(--shg69gz-0);transition:var(--shg69gz-0);}.Sheet_styles_1bm46e7_shg69gz__a2bd4ee6.Sheet_styles_1bm46e7_isClosed__a2bd4ee6{-webkit-transform:translateY(100%);-ms-transform:translateY(100%);transform:translateY(100%);}
|
3
|
+
.Sheet_styles_1bm46e7_s1cdpbaw__a2bd4ee6{position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--s1cdpbaw-0);}
|
4
|
+
.Sheet_styles_1bm46e7_sjx120m__a2bd4ee6{border-radius:1.5rem 1.5rem 0 0;background-color:var(--plasma-sheet-content-background-color);padding:1rem;max-height:100%;overflow:auto;overscroll-behavior:contain;}.Sheet_styles_1bm46e7_sjx120m__a2bd4ee6::-webkit-scrollbar{display:none;}
|
5
|
+
.Sheet_styles_1bm46e7_s1f8rwx6__a2bd4ee6{width:4rem;padding:1.75rem 0;margin:-1.5rem 0;opacity:0.65;-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}.Sheet_styles_1bm46e7_s1f8rwx6__a2bd4ee6::before{content:'';display:block;border-radius:0.625rem;background-color:var(--plasma-sheet-handle-background-color);height:0.25rem;}
|
@@ -0,0 +1,86 @@
|
|
1
|
+
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
2
|
+
import React, { forwardRef } from 'react';
|
3
|
+
import { cx } from '../../utils/index.js';
|
4
|
+
import { useThemeContext } from './hooks/useThemeContext.js';
|
5
|
+
import { useSheetSwipe } from './hooks/useSheetSwipe.js';
|
6
|
+
import { useSheet } from './hooks/useSheet.js';
|
7
|
+
import { classes } from './Sheet.tokens.js';
|
8
|
+
import { StyledWrapper, StyledContentWrapper, StyledSheetHandle, StyledSheetContent, StyledOverlay } from './Sheet.styles.js';
|
9
|
+
import { base } from './variations/_view/base.js';
|
10
|
+
|
11
|
+
var _excluded = ["isOpen", "children", "onClose", "withOverlay", "withTransition", "throttleMs", "className", "view"];
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Открывает окно-шторку поверх основного экрана.
|
15
|
+
*/
|
16
|
+
|
17
|
+
var sheetRoot = function sheetRoot(Root) {
|
18
|
+
return /*#__PURE__*/forwardRef(function (_ref, rootRef) {
|
19
|
+
var isOpen = _ref.isOpen,
|
20
|
+
children = _ref.children,
|
21
|
+
onClose = _ref.onClose,
|
22
|
+
_ref$withOverlay = _ref.withOverlay,
|
23
|
+
withOverlay = _ref$withOverlay === void 0 ? true : _ref$withOverlay,
|
24
|
+
_ref$withTransition = _ref.withTransition,
|
25
|
+
withTransition = _ref$withTransition === void 0 ? true : _ref$withTransition,
|
26
|
+
throttleMs = _ref.throttleMs,
|
27
|
+
className = _ref.className,
|
28
|
+
view = _ref.view,
|
29
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
30
|
+
var contentWrapperRef = React.useRef(null);
|
31
|
+
var contentRef = React.useRef(null);
|
32
|
+
var handleRef = React.useRef(null);
|
33
|
+
var theme = useThemeContext();
|
34
|
+
useSheet({
|
35
|
+
isOpen: isOpen
|
36
|
+
});
|
37
|
+
useSheetSwipe({
|
38
|
+
contentWrapperRef: contentWrapperRef,
|
39
|
+
contentRef: contentRef,
|
40
|
+
handleRef: handleRef,
|
41
|
+
throttleMs: throttleMs,
|
42
|
+
onClose: onClose
|
43
|
+
});
|
44
|
+
var isClosedClass = isOpen ? undefined : "".concat(classes.isClosed);
|
45
|
+
return /*#__PURE__*/React.createElement(StyledWrapper, _extends({
|
46
|
+
theme: theme,
|
47
|
+
isOpen: isOpen,
|
48
|
+
withTransition: withTransition,
|
49
|
+
className: cx(isClosedClass, className)
|
50
|
+
}, restProps), /*#__PURE__*/React.createElement(Root, {
|
51
|
+
isOpen: isOpen,
|
52
|
+
onClose: onClose,
|
53
|
+
view: view,
|
54
|
+
ref: rootRef
|
55
|
+
}, /*#__PURE__*/React.createElement(StyledContentWrapper, {
|
56
|
+
theme: theme,
|
57
|
+
isOpen: isOpen,
|
58
|
+
withTransition: withTransition,
|
59
|
+
ref: contentWrapperRef
|
60
|
+
}, /*#__PURE__*/React.createElement(StyledSheetHandle, {
|
61
|
+
ref: handleRef
|
62
|
+
}), /*#__PURE__*/React.createElement(StyledSheetContent, {
|
63
|
+
ref: contentRef
|
64
|
+
}, children)), /*#__PURE__*/React.createElement(StyledOverlay, {
|
65
|
+
withOverlay: withOverlay,
|
66
|
+
onClick: onClose
|
67
|
+
})));
|
68
|
+
});
|
69
|
+
};
|
70
|
+
var sheetConfig = {
|
71
|
+
name: 'Sheet',
|
72
|
+
tag: 'div',
|
73
|
+
layout: sheetRoot,
|
74
|
+
base: '',
|
75
|
+
variations: {
|
76
|
+
view: {
|
77
|
+
css: base
|
78
|
+
}
|
79
|
+
},
|
80
|
+
defaults: {
|
81
|
+
view: 'default'
|
82
|
+
}
|
83
|
+
};
|
84
|
+
|
85
|
+
export { sheetConfig, sheetRoot };
|
86
|
+
//# sourceMappingURL=Sheet.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Sheet.js","sources":["../../../src/components/Sheet/Sheet.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { cx } from '../../utils';\nimport { RootProps } from '../../engines';\n\nimport { SheetProps } from './Sheet.types';\nimport { useSheet, useSheetSwipe, useThemeContext } from './hooks';\nimport { classes } from './Sheet.tokens';\nimport {\n StyledContentWrapper,\n StyledOverlay,\n StyledSheetContent,\n StyledSheetHandle,\n StyledWrapper,\n} from './Sheet.styles';\nimport { base as viewCSS } from './variations/_view/base';\n\n/**\n * Открывает окно-шторку поверх основного экрана.\n */\n\nexport const sheetRoot = (Root: RootProps<HTMLDivElement, SheetProps>) =>\n forwardRef<HTMLDivElement, SheetProps>(\n (\n {\n isOpen,\n children,\n onClose,\n withOverlay = true,\n withTransition = true,\n throttleMs,\n className,\n view,\n ...restProps\n },\n rootRef,\n ) => {\n const contentWrapperRef = React.useRef<HTMLDivElement>(null);\n const contentRef = React.useRef<HTMLDivElement>(null);\n const handleRef = React.useRef<HTMLDivElement>(null);\n\n const theme = useThemeContext();\n\n useSheet({ isOpen });\n useSheetSwipe({ contentWrapperRef, contentRef, handleRef, throttleMs, onClose });\n\n const isClosedClass = isOpen ? undefined : `${classes.isClosed}`;\n\n return (\n <StyledWrapper\n theme={theme}\n isOpen={isOpen}\n withTransition={withTransition}\n className={cx(isClosedClass, className)}\n {...restProps}\n >\n <Root isOpen={isOpen} onClose={onClose} view={view} ref={rootRef}>\n <StyledContentWrapper\n theme={theme}\n isOpen={isOpen}\n withTransition={withTransition}\n ref={contentWrapperRef}\n >\n <StyledSheetHandle ref={handleRef} />\n <StyledSheetContent ref={contentRef}>{children}</StyledSheetContent>\n </StyledContentWrapper>\n <StyledOverlay withOverlay={withOverlay} onClick={onClose} />\n </Root>\n </StyledWrapper>\n );\n },\n );\n\nexport const sheetConfig = {\n name: 'Sheet',\n tag: 'div',\n layout: sheetRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n },\n defaults: {\n view: 'default',\n },\n};\n"],"names":["sheetRoot","Root","forwardRef","_ref","rootRef","isOpen","children","onClose","_ref$withOverlay","withOverlay","_ref$withTransition","withTransition","throttleMs","className","view","restProps","_objectWithoutProperties","_excluded","contentWrapperRef","React","useRef","contentRef","handleRef","theme","useThemeContext","useSheet","useSheetSwipe","isClosedClass","undefined","concat","classes","isClosed","createElement","StyledWrapper","_extends","cx","ref","StyledContentWrapper","StyledSheetHandle","StyledSheetContent","StyledOverlay","onClick","sheetConfig","name","tag","layout","base","variations","css","viewCSS","defaults"],"mappings":";;;;;;;;;;;;AAiBA;AACA;AACA;;IAEaA,SAAS,GAAG,SAAZA,SAASA,CAAIC,IAA2C,EAAA;AAAA,EAAA,oBACjEC,UAAU,CACN,UAAAC,IAAA,EAYIC,OAAO,EACN;AAAA,IAAA,IAXGC,MAAM,GAAAF,IAAA,CAANE,MAAM;MACNC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;MACRC,OAAO,GAAAJ,IAAA,CAAPI,OAAO;MAAAC,gBAAA,GAAAL,IAAA,CACPM,WAAW;AAAXA,MAAAA,WA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