@salutejs/plasma-new-hope 0.88.1-dev.0 → 0.89.0-canary.1225.9560665253.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Sheet/Sheet.css +8 -0
- package/cjs/components/Sheet/Sheet.js +108 -0
- package/cjs/components/Sheet/Sheet.js.map +1 -0
- package/cjs/components/Sheet/Sheet.styles.js +115 -0
- package/cjs/components/Sheet/Sheet.styles.js.map +1 -0
- package/cjs/components/Sheet/Sheet.styles_o73i75.css +6 -0
- package/cjs/components/Sheet/Sheet.tokens.js +17 -0
- package/cjs/components/Sheet/Sheet.tokens.js.map +1 -0
- package/cjs/components/Sheet/hooks/useOverflow.js +23 -0
- package/cjs/components/Sheet/hooks/useOverflow.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/utils/handleTransition.js +13 -0
- package/cjs/components/Sheet/utils/handleTransition.js.map +1 -0
- package/cjs/components/Sheet/utils/index.js +8 -0
- package/cjs/components/Sheet/utils/index.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 +7 -0
- package/cjs/index.js +6 -0
- package/cjs/index.js.map +1 -1
- package/es/components/Sheet/Sheet.css +8 -0
- package/es/components/Sheet/Sheet.js +103 -0
- package/es/components/Sheet/Sheet.js.map +1 -0
- package/es/components/Sheet/Sheet.styles.js +106 -0
- package/es/components/Sheet/Sheet.styles.js.map +1 -0
- package/es/components/Sheet/Sheet.styles_o73i75.css +6 -0
- package/es/components/Sheet/Sheet.tokens.js +12 -0
- package/es/components/Sheet/Sheet.tokens.js.map +1 -0
- package/es/components/Sheet/hooks/useOverflow.js +19 -0
- package/es/components/Sheet/hooks/useOverflow.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/utils/handleTransition.js +9 -0
- package/es/components/Sheet/utils/handleTransition.js.map +1 -0
- package/es/components/Sheet/utils/index.js +4 -0
- package/es/components/Sheet/utils/index.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 +7 -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 +108 -0
- package/styled-components/cjs/components/Sheet/Sheet.styles.js +52 -0
- package/styled-components/cjs/components/Sheet/Sheet.template-doc.mdx +143 -0
- package/styled-components/cjs/components/Sheet/Sheet.tokens.js +15 -0
- package/styled-components/cjs/components/Sheet/Sheet.types.js +5 -0
- package/styled-components/cjs/components/Sheet/hooks/index.js +19 -0
- package/styled-components/cjs/components/Sheet/hooks/useOverflow.js +21 -0
- package/styled-components/cjs/components/Sheet/hooks/useSheetSwipe.js +102 -0
- package/styled-components/cjs/components/Sheet/index.js +31 -0
- package/styled-components/cjs/components/Sheet/utils/handleTransition.js +12 -0
- package/styled-components/cjs/components/Sheet/utils/index.js +14 -0
- package/styled-components/cjs/components/Sheet/variations/_view/base.js +8 -0
- package/styled-components/cjs/components/Sheet/variations/_view/tokens.json +6 -0
- 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 +341 -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 +341 -0
- package/styled-components/cjs/index.js +11 -0
- package/styled-components/es/components/Sheet/Sheet.js +100 -0
- package/styled-components/es/components/Sheet/Sheet.styles.js +45 -0
- package/styled-components/es/components/Sheet/Sheet.template-doc.mdx +143 -0
- package/styled-components/es/components/Sheet/Sheet.tokens.js +9 -0
- package/styled-components/es/components/Sheet/Sheet.types.js +1 -0
- package/styled-components/es/components/Sheet/hooks/index.js +2 -0
- package/styled-components/es/components/Sheet/hooks/useOverflow.js +15 -0
- package/styled-components/es/components/Sheet/hooks/useSheetSwipe.js +95 -0
- package/styled-components/es/components/Sheet/index.js +2 -0
- package/styled-components/es/components/Sheet/utils/handleTransition.js +6 -0
- package/styled-components/es/components/Sheet/utils/index.js +2 -0
- package/styled-components/es/components/Sheet/variations/_view/base.js +2 -0
- package/styled-components/es/components/Sheet/variations/_view/tokens.json +6 -0
- 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 +341 -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 +341 -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 +16 -0
- package/types/components/Sheet/Sheet.styles.d.ts.map +1 -0
- package/types/components/Sheet/Sheet.tokens.d.ts +10 -0
- package/types/components/Sheet/Sheet.tokens.d.ts.map +1 -0
- package/types/components/Sheet/Sheet.types.d.ts +65 -0
- package/types/components/Sheet/Sheet.types.d.ts.map +1 -0
- package/types/components/Sheet/hooks/index.d.ts +3 -0
- package/types/components/Sheet/hooks/index.d.ts.map +1 -0
- package/types/components/Sheet/hooks/useOverflow.d.ts +3 -0
- package/types/components/Sheet/hooks/useOverflow.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/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 +3 -0
- package/types/components/Sheet/utils/index.d.ts.map +1 -0
- package/types/components/Sheet/variations/_view/base.d.ts +2 -0
- package/types/components/Sheet/variations/_view/base.d.ts.map +1 -0
- 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
@@ -0,0 +1,103 @@
|
|
1
|
+
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
2
|
+
import React, { forwardRef } from 'react';
|
3
|
+
import { Overlay } from '../Overlay/Overlay.js';
|
4
|
+
import { cx } from '../../utils/index.js';
|
5
|
+
import { useSheetSwipe } from './hooks/useSheetSwipe.js';
|
6
|
+
import { useOverflow } from './hooks/useOverflow.js';
|
7
|
+
import { classes, tokens } from './Sheet.tokens.js';
|
8
|
+
import { StyledContentWrapper, StyledSheetHandle, StyledSheetContent, StyledSheetHeader, StyledSheetBody, StyledSheetFooter } from './Sheet.styles.js';
|
9
|
+
import { base } from './variations/_view/base.js';
|
10
|
+
import { DEFAULT_Z_INDEX } from './utils/index.js';
|
11
|
+
|
12
|
+
var _excluded = ["opened", "children", "onClose", "hasHandle", "contentHeader", "isHeaderFixed", "contentFooter", "isFooterFixed", "withOverlay", "withBlur", "withTransition", "throttleMs", "className", "view"];
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Открывает окно-шторку поверх основного экрана.
|
16
|
+
*/
|
17
|
+
|
18
|
+
var sheetRoot = function sheetRoot(Root) {
|
19
|
+
return /*#__PURE__*/forwardRef(function (_ref, rootRef) {
|
20
|
+
var opened = _ref.opened,
|
21
|
+
children = _ref.children,
|
22
|
+
onClose = _ref.onClose,
|
23
|
+
_ref$hasHandle = _ref.hasHandle,
|
24
|
+
hasHandle = _ref$hasHandle === void 0 ? true : _ref$hasHandle,
|
25
|
+
contentHeader = _ref.contentHeader,
|
26
|
+
_ref$isHeaderFixed = _ref.isHeaderFixed,
|
27
|
+
isHeaderFixed = _ref$isHeaderFixed === void 0 ? false : _ref$isHeaderFixed,
|
28
|
+
contentFooter = _ref.contentFooter,
|
29
|
+
_ref$isFooterFixed = _ref.isFooterFixed,
|
30
|
+
isFooterFixed = _ref$isFooterFixed === void 0 ? false : _ref$isFooterFixed,
|
31
|
+
_ref$withOverlay = _ref.withOverlay,
|
32
|
+
withOverlay = _ref$withOverlay === void 0 ? true : _ref$withOverlay,
|
33
|
+
_ref$withBlur = _ref.withBlur,
|
34
|
+
withBlur = _ref$withBlur === void 0 ? false : _ref$withBlur,
|
35
|
+
_ref$withTransition = _ref.withTransition,
|
36
|
+
withTransition = _ref$withTransition === void 0 ? true : _ref$withTransition,
|
37
|
+
throttleMs = _ref.throttleMs,
|
38
|
+
className = _ref.className,
|
39
|
+
view = _ref.view,
|
40
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
41
|
+
var contentWrapperRef = React.useRef(null);
|
42
|
+
var contentRef = React.useRef(null);
|
43
|
+
var handleRef = React.useRef(null);
|
44
|
+
useOverflow({
|
45
|
+
opened: opened
|
46
|
+
});
|
47
|
+
useSheetSwipe({
|
48
|
+
contentWrapperRef: contentWrapperRef,
|
49
|
+
contentRef: contentRef,
|
50
|
+
handleRef: handleRef,
|
51
|
+
throttleMs: throttleMs,
|
52
|
+
onClose: onClose
|
53
|
+
});
|
54
|
+
var hasHeader = Boolean(contentHeader);
|
55
|
+
var hasFooter = Boolean(contentFooter);
|
56
|
+
var closedClass = opened ? undefined : "".concat(classes.closed);
|
57
|
+
var overlayBackgroundToken = withBlur ? "var(".concat(tokens.sheetOverlayWithBlurColor, ")") : "var(".concat(tokens.sheetOverlayColor, ")");
|
58
|
+
return /*#__PURE__*/React.createElement(Root, {
|
59
|
+
opened: opened,
|
60
|
+
onClose: onClose,
|
61
|
+
view: view,
|
62
|
+
ref: rootRef
|
63
|
+
}, /*#__PURE__*/React.createElement(StyledContentWrapper, _extends({
|
64
|
+
opened: opened,
|
65
|
+
withTransition: withTransition,
|
66
|
+
className: cx(closedClass, className),
|
67
|
+
ref: contentWrapperRef
|
68
|
+
}, restProps), hasHandle && /*#__PURE__*/React.createElement(StyledSheetHandle, {
|
69
|
+
ref: handleRef
|
70
|
+
}), /*#__PURE__*/React.createElement(StyledSheetContent, {
|
71
|
+
hasHeader: hasHeader,
|
72
|
+
hasFooter: hasFooter,
|
73
|
+
ref: contentRef
|
74
|
+
}, hasHeader && /*#__PURE__*/React.createElement(StyledSheetHeader, {
|
75
|
+
isHeaderFixed: isHeaderFixed
|
76
|
+
}, contentHeader), /*#__PURE__*/React.createElement(StyledSheetBody, null, children), hasFooter && /*#__PURE__*/React.createElement(StyledSheetFooter, {
|
77
|
+
isFooterFixed: isFooterFixed
|
78
|
+
}, contentFooter))), withOverlay && opened && /*#__PURE__*/React.createElement(Overlay, {
|
79
|
+
zIndex: DEFAULT_Z_INDEX,
|
80
|
+
backgroundColorProperty: overlayBackgroundToken,
|
81
|
+
withBlur: withBlur,
|
82
|
+
isClickable: true,
|
83
|
+
onOverlayClick: onClose
|
84
|
+
}));
|
85
|
+
});
|
86
|
+
};
|
87
|
+
var sheetConfig = {
|
88
|
+
name: 'Sheet',
|
89
|
+
tag: 'div',
|
90
|
+
layout: sheetRoot,
|
91
|
+
base: '',
|
92
|
+
variations: {
|
93
|
+
view: {
|
94
|
+
css: base
|
95
|
+
}
|
96
|
+
},
|
97
|
+
defaults: {
|
98
|
+
view: 'default'
|
99
|
+
}
|
100
|
+
};
|
101
|
+
|
102
|
+
export { sheetConfig, sheetRoot };
|
103
|
+
//# 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 { RootProps } from '../../engines';\nimport { Overlay } from '../Overlay';\nimport { cx } from '../../utils';\n\nimport { SheetProps } from './Sheet.types';\nimport { useOverflow, useSheetSwipe } from './hooks';\nimport { classes, tokens } from './Sheet.tokens';\nimport {\n StyledContentWrapper,\n StyledSheetBody,\n StyledSheetContent,\n StyledSheetFooter,\n StyledSheetHandle,\n StyledSheetHeader,\n} from './Sheet.styles';\nimport { base as viewCSS } from './variations/_view/base';\nimport { DEFAULT_Z_INDEX } from './utils';\n\n/**\n * Открывает окно-шторку поверх основного экрана.\n */\n\nexport const sheetRoot = (Root: RootProps<HTMLDivElement, SheetProps>) =>\n forwardRef<HTMLDivElement, SheetProps>(\n (\n {\n opened,\n children,\n onClose,\n hasHandle = true,\n contentHeader,\n isHeaderFixed = false,\n contentFooter,\n isFooterFixed = false,\n withOverlay = true,\n withBlur = false,\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 useOverflow({ opened });\n useSheetSwipe({ contentWrapperRef, contentRef, handleRef, throttleMs, onClose });\n\n const hasHeader = Boolean(contentHeader);\n const hasFooter = Boolean(contentFooter);\n\n const closedClass = opened ? undefined : `${classes.closed}`;\n\n const overlayBackgroundToken = withBlur\n ? `var(${tokens.sheetOverlayWithBlurColor})`\n : `var(${tokens.sheetOverlayColor})`;\n\n return (\n <Root opened={opened} onClose={onClose} view={view} ref={rootRef}>\n <StyledContentWrapper\n opened={opened}\n withTransition={withTransition}\n className={cx(closedClass, className)}\n ref={contentWrapperRef}\n {...restProps}\n >\n {hasHandle && <StyledSheetHandle ref={handleRef} />}\n <StyledSheetContent hasHeader={hasHeader} hasFooter={hasFooter} ref={contentRef}>\n {hasHeader && (\n <StyledSheetHeader isHeaderFixed={isHeaderFixed}>{contentHeader}</StyledSheetHeader>\n )}\n <StyledSheetBody>{children}</StyledSheetBody>\n {hasFooter && (\n <StyledSheetFooter isFooterFixed={isFooterFixed}>{contentFooter}</StyledSheetFooter>\n )}\n </StyledSheetContent>\n </StyledContentWrapper>\n {withOverlay && opened && (\n <Overlay\n zIndex={DEFAULT_Z_INDEX}\n backgroundColorProperty={overlayBackgroundToken}\n withBlur={withBlur}\n isClickable\n onOverlayClick={onClose}\n />\n )}\n </Root>\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","opened","children","onClose","_ref$hasHandle","hasHandle","contentHeader","_ref$isHeaderFixed","isHeaderFixed","contentFooter","_ref$isFooterFixed","isFooterFixed","_ref$withOverlay","withOverlay","_ref$withBlur","withBlur","_ref$withTransition","withTransition","throttleMs","className","view","restProps","_objectWithoutProperties","_excluded","contentWrapperRef","React","useRef","contentRef","handleRef","useOverflow","useSheetSwipe","hasHeader","Boolean","hasFooter","closedClass","undefined","concat","classes","closed","overlayBackgroundToken","tokens","sheetOverlayWithBlurColor","sheetOverlayColor","createElement","ref","StyledContentWrapper","_extends","cx","StyledSheetHandle","StyledSheetContent","StyledSheetHeader","StyledSheetBody","StyledSheetFooter","Overlay","zIndex","DEFAULT_Z_INDEX","backgroundColorProperty","isClickable","onOverlayClick","sheetConfig","name","tag","layout","base","variations","css","viewCSS","defaults"],"mappings":";;;;;;;;;;;;;AAoBA;AACA;AACA;;IAEaA,SAAS,GAAG,SAAZA,SAASA,CAAIC,IAA2C,EAAA;AAAA,EAAA,oBACjEC,UAAU,CACN,UAAAC,IAAA,EAkBIC,OAAO,EACN;AAAA,IAAA,IAjBGC,MAAM,GAAAF,IAAA,CAANE,MAAM;MACNC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;MACRC,OAAO,GAAAJ,IAAA,CAAPI,OAAO;MAAAC,cAAA,GAAAL,IAAA,CACPM,SAAS;AAATA,MAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,cAAA;MAChBE,aAAa,GAAAP,IAAA,CAAbO,aAAa;MAAAC,kBAAA,GAAAR,IAAA,CACbS,aAAa;AAAbA,MAAAA,aAAa,GAAAD,kBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,kBAAA;MACrBE,aAAa,GAAAV,IAAA,CAAbU,aAAa;MAAAC,kBAAA,GAAAX,IAAA,CACbY,aAAa;AAAbA,MAAAA,aAAa,GAAAD,kBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,kBAAA;MAAAE,gBAAA,GAAAb,IAAA,CACrBc,WAAW;AAAXA,MAAAA,WAAW,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,gBAAA;MAAAE,aAAA,GAAAf,IAAA,CAClBgB,QAAQ;AAARA,MAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,aAAA;MAAAE,mBAAA,GAAAjB,IAAA,CAChBkB,cAAc;AAAdA,MAAAA,cAAc,GAAAD,mBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,mBAAA;MACrBE,UAAU,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Ac,EAAEvD,OAAAA;AAAQ,KAC3B,CAEH,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMwD,WAAW,GAAG;AACvBC,EAAAA,IAAI,EAAE,OAAO;AACbC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAElE,SAAS;AACjBmE,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,UAAU,EAAE;AACR5C,IAAAA,IAAI,EAAE;AACF6C,MAAAA,GAAG,EAAEC,IAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN/C,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;"}
|
@@ -0,0 +1,106 @@
|
|
1
|
+
import './Sheet.styles_o73i75.css';
|
2
|
+
import { styled } from '@linaria/react';
|
3
|
+
import { tokens } from './Sheet.tokens.js';
|
4
|
+
import { handleTransition } from './utils/handleTransition.js';
|
5
|
+
|
6
|
+
var _exp = function _exp() {
|
7
|
+
return handleTransition('all 0.5s 0.1s');
|
8
|
+
};
|
9
|
+
var StyledContentWrapper = /*#__PURE__*/styled('div')({
|
10
|
+
name: "StyledContentWrapper",
|
11
|
+
"class": "sah7qw3",
|
12
|
+
propsAsIs: false,
|
13
|
+
vars: {
|
14
|
+
"sah7qw3-0": [/*#__PURE__*/_exp()]
|
15
|
+
}
|
16
|
+
});
|
17
|
+
var StyledSheetHandle = /*#__PURE__*/styled('div')({
|
18
|
+
name: "StyledSheetHandle",
|
19
|
+
"class": "shg69gz",
|
20
|
+
propsAsIs: false
|
21
|
+
});
|
22
|
+
var _exp5 = function _exp5() {
|
23
|
+
return function (_ref) {
|
24
|
+
var hasHeader = _ref.hasHeader;
|
25
|
+
return hasHeader ? 'unset' : '1rem';
|
26
|
+
};
|
27
|
+
};
|
28
|
+
var _exp6 = function _exp6() {
|
29
|
+
return function (_ref2) {
|
30
|
+
var hasFooter = _ref2.hasFooter;
|
31
|
+
return hasFooter ? 'unset' : '1rem';
|
32
|
+
};
|
33
|
+
};
|
34
|
+
var StyledSheetContent = /*#__PURE__*/styled('div')({
|
35
|
+
name: "StyledSheetContent",
|
36
|
+
"class": "s1cdpbaw",
|
37
|
+
propsAsIs: false,
|
38
|
+
vars: {
|
39
|
+
"s1cdpbaw-0": [/*#__PURE__*/_exp5()],
|
40
|
+
"s1cdpbaw-1": [/*#__PURE__*/_exp6()]
|
41
|
+
}
|
42
|
+
});
|
43
|
+
var _exp7 = function _exp7() {
|
44
|
+
return function (_ref3) {
|
45
|
+
var isHeaderFixed = _ref3.isHeaderFixed;
|
46
|
+
return isHeaderFixed ? 'sticky' : 'static';
|
47
|
+
};
|
48
|
+
};
|
49
|
+
var _exp8 = function _exp8() {
|
50
|
+
return function (_ref4) {
|
51
|
+
var isHeaderFixed = _ref4.isHeaderFixed;
|
52
|
+
return isHeaderFixed ? '0' : 'unset';
|
53
|
+
};
|
54
|
+
};
|
55
|
+
var _exp9 = function _exp9() {
|
56
|
+
return function (_ref5) {
|
57
|
+
var isHeaderFixed = _ref5.isHeaderFixed;
|
58
|
+
return isHeaderFixed ? "var(".concat(tokens.contentBackgroundColor, ")") : 'transparent';
|
59
|
+
};
|
60
|
+
};
|
61
|
+
var StyledSheetHeader = /*#__PURE__*/styled('div')({
|
62
|
+
name: "StyledSheetHeader",
|
63
|
+
"class": "sjx120m",
|
64
|
+
propsAsIs: false,
|
65
|
+
vars: {
|
66
|
+
"sjx120m-0": [/*#__PURE__*/_exp7()],
|
67
|
+
"sjx120m-1": [/*#__PURE__*/_exp8()],
|
68
|
+
"sjx120m-2": [/*#__PURE__*/_exp9()]
|
69
|
+
}
|
70
|
+
});
|
71
|
+
var StyledSheetBody = /*#__PURE__*/styled('div')({
|
72
|
+
name: "StyledSheetBody",
|
73
|
+
"class": "s1f8rwx6",
|
74
|
+
propsAsIs: false
|
75
|
+
});
|
76
|
+
var _exp10 = function _exp10() {
|
77
|
+
return function (_ref6) {
|
78
|
+
var isFooterFixed = _ref6.isFooterFixed;
|
79
|
+
return isFooterFixed ? 'sticky' : 'static';
|
80
|
+
};
|
81
|
+
};
|
82
|
+
var _exp11 = function _exp11() {
|
83
|
+
return function (_ref7) {
|
84
|
+
var isFooterFixed = _ref7.isFooterFixed;
|
85
|
+
return isFooterFixed ? '0' : 'unset';
|
86
|
+
};
|
87
|
+
};
|
88
|
+
var _exp12 = function _exp12() {
|
89
|
+
return function (_ref8) {
|
90
|
+
var isFooterFixed = _ref8.isFooterFixed;
|
91
|
+
return isFooterFixed ? "var(".concat(tokens.contentBackgroundColor, ")") : 'transparent';
|
92
|
+
};
|
93
|
+
};
|
94
|
+
var StyledSheetFooter = /*#__PURE__*/styled('div')({
|
95
|
+
name: "StyledSheetFooter",
|
96
|
+
"class": "sqp1ccu",
|
97
|
+
propsAsIs: false,
|
98
|
+
vars: {
|
99
|
+
"sqp1ccu-0": [/*#__PURE__*/_exp10()],
|
100
|
+
"sqp1ccu-1": [/*#__PURE__*/_exp11()],
|
101
|
+
"sqp1ccu-2": [/*#__PURE__*/_exp12()]
|
102
|
+
}
|
103
|
+
});
|
104
|
+
|
105
|
+
export { StyledContentWrapper, StyledSheetBody, StyledSheetContent, StyledSheetFooter, StyledSheetHandle, StyledSheetHeader };
|
106
|
+
//# 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 StyledContentWrapper = styled.div<CommonProps>`\n position: fixed;\n left: 0;\n bottom: 0;\n width: 100%;\n max-height: 100%;\n z-index: 1000;\n opacity: 1;\n\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n\n transition: ${handleTransition('all 0.5s 0.1s')};\n\n &.${String(classes.closed)} {\n opacity: 0;\n visibility: hidden;\n transform: translateY(100%);\n }\n`;\n\nexport const StyledSheetHandle = styled.div`\n width: 3rem;\n padding: 1.75rem 0;\n margin: -1.375rem 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.handleBackgroundColor});\n height: 0.25rem;\n }\n`;\n\nexport const StyledSheetContent = styled.div<{ hasHeader?: boolean; hasFooter?: boolean }>`\n border-radius: 1.25rem 1.25rem 0 0;\n background-color: var(${tokens.contentBackgroundColor});\n padding-left: 1rem;\n padding-right: 1rem;\n padding-top: ${({ hasHeader }) => (hasHeader ? 'unset' : '1rem')};\n padding-bottom: ${({ hasFooter }) => (hasFooter ? 'unset' : '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 StyledSheetHeader = styled.div<{ isHeaderFixed?: boolean }>`\n width: 100%;\n z-index: 1;\n padding-top: 1rem;\n position: ${({ isHeaderFixed }) => (isHeaderFixed ? 'sticky' : 'static')};\n top: ${({ isHeaderFixed }) => (isHeaderFixed ? '0' : 'unset')};\n background-color: ${({ isHeaderFixed }) =>\n isHeaderFixed ? `var(${tokens.contentBackgroundColor})` : 'transparent'};\n`;\n\nexport const StyledSheetBody = styled.div``;\n\nexport const StyledSheetFooter = styled.div<{ isFooterFixed?: boolean }>`\n width: 100%;\n z-index: 1;\n padding-bottom: 1rem;\n position: ${({ isFooterFixed }) => (isFooterFixed ? 'sticky' : 'static')};\n bottom: ${({ isFooterFixed }) => (isFooterFixed ? '0' : 'unset')};\n background-color: ${({ isFooterFixed }) =>\n isFooterFixed ? `var(${tokens.contentBackgroundColor})` : 'transparent'};\n`;\n"],"names":["_exp","handleTransition","StyledContentWrapper","styled","name","class","propsAsIs","vars","StyledSheetHandle","_exp5","_ref","hasHeader","_exp6","_ref2","hasFooter","StyledSheetContent","_exp7","_ref3","isHeaderFixed","_exp8","_ref4","_exp9","_ref5","concat","tokens","contentB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AC,EAAAA,SAAA,EAAA,KAAA;AAAAC,EAAAA,IAAA,EAAA;AAAA,IAAA,WAAA,EAAA,cAIvBqB,MAA4D,EAAA,CAAA;AAAA,IAAA,WAAA,EAAA,cAC9DG,MAAsD,EAAA,CAAA;AAAA,IAAA,WAAA,EAAA,cAC5CE,MACuD,EAAA,CAAA;AAAA,GAAA;AAAA,CAC9E;;;;"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
.sah7qw3{position:fixed;left:0;bottom:0;width:100%;max-height:100%;z-index:1000;opacity: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(--sah7qw3-0);transition:var(--sah7qw3-0);}.sah7qw3.closed{opacity:0;visibility:hidden;-webkit-transform:translateY(100%);-ms-transform:translateY(100%);transform:translateY(100%);}
|
2
|
+
.shg69gz{width:3rem;padding:1.75rem 0;margin:-1.375rem 0;opacity:0.65;-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}.shg69gz::before{content:'';display:block;border-radius:0.625rem;background-color:var(--plasma-sheet-handle-background-color);height:0.25rem;}
|
3
|
+
.s1cdpbaw{border-radius:1.25rem 1.25rem 0 0;background-color:var(--plasma-sheet-content-background-color);padding-left:1rem;padding-right:1rem;padding-top:var(--s1cdpbaw-0);padding-bottom:var(--s1cdpbaw-1);max-height:100%;overflow:auto;overscroll-behavior:contain;}.s1cdpbaw::-webkit-scrollbar{display:none;}
|
4
|
+
.sjx120m{width:100%;z-index:1;padding-top:1rem;position:var(--sjx120m-0);top:var(--sjx120m-1);background-color:var(--sjx120m-2);}
|
5
|
+
|
6
|
+
.sqp1ccu{width:100%;z-index:1;padding-bottom:1rem;position:var(--sqp1ccu-0);bottom:var(--sqp1ccu-1);background-color:var(--sqp1ccu-2);}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
var classes = {
|
2
|
+
closed: 'closed'
|
3
|
+
};
|
4
|
+
var tokens = {
|
5
|
+
sheetOverlayColor: '--plasma-sheet-overlay-color',
|
6
|
+
sheetOverlayWithBlurColor: '--plasma-sheet-overlay-with-blur-color',
|
7
|
+
contentBackgroundColor: '--plasma-sheet-content-background-color',
|
8
|
+
handleBackgroundColor: '--plasma-sheet-handle-background-color'
|
9
|
+
};
|
10
|
+
|
11
|
+
export { classes, tokens };
|
12
|
+
//# 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 closed: 'closed',\n};\n\nexport const tokens = {\n sheetOverlayColor: '--plasma-sheet-overlay-color',\n sheetOverlayWithBlurColor: '--plasma-sheet-overlay-with-blur-color',\n contentBackgroundColor: '--plasma-sheet-content-background-color',\n handleBackgroundColor: '--plasma-sheet-handle-background-color',\n};\n"],"names":["classes","closed","tokens","sheetOverlayColor","sheetOverlayWithBlurColor","contentBackgroundColor","handleBackgroundColor"],"mappings":"AAAO,IAAMA,OAAO,GAAG;AACnBC,EAAAA,MAAM,EAAE,QAAA;AACZ,EAAC;AAEM,IAAMC,MAAM,GAAG;AAClBC,EAAAA,iBAAiB,EAAE,8BAA8B;AACjDC,EAAAA,yBAAyB,EAAE,wCAAwC;AACnEC,EAAAA,sBAAsB,EAAE,yCAAyC;AACjEC,EAAAA,qBAAqB,EAAE,wCAAA;AAC3B;;;;"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { useRef, useEffect } from 'react';
|
2
|
+
|
3
|
+
var useOverflow = function useOverflow(_ref) {
|
4
|
+
var opened = _ref.opened;
|
5
|
+
var overflow = useRef(document.body.style.overflowY);
|
6
|
+
|
7
|
+
// linaria не поддерживает динамический global
|
8
|
+
useEffect(function () {
|
9
|
+
if (opened) {
|
10
|
+
overflow.current = document.body.style.overflowY;
|
11
|
+
document.body.style.overflowY = 'hidden';
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
document.body.style.overflowY = overflow.current;
|
15
|
+
}, [opened]);
|
16
|
+
};
|
17
|
+
|
18
|
+
export { useOverflow };
|
19
|
+
//# sourceMappingURL=useOverflow.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useOverflow.js","sources":["../../../../src/components/Sheet/hooks/useOverflow.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\nimport { SheetHookArgs } from '../Sheet.types';\n\nexport const useOverflow = ({ opened }: SheetHookArgs) => {\n const overflow = useRef<string>(document.body.style.overflowY);\n\n // linaria не поддерживает динамический global\n useEffect(() => {\n if (opened) {\n overflow.current = document.body.style.overflowY;\n document.body.style.overflowY = 'hidden';\n return;\n }\n\n document.body.style.overflowY = overflow.current;\n }, [opened]);\n};\n"],"names":["useOverflow","_ref","opened","overflow","useRef","document","body","style","overflowY","useEffect","current"],"mappings":";;IAIaA,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA,EAAkC;AAAA,EAAA,IAA5BC,MAAM,GAAAD,IAAA,CAANC,MAAM,CAAA;EAChC,IAAMC,QAAQ,GAAGC,MAAM,CAASC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAACC,SAAS,CAAC,CAAA;;AAE9D;AACAC,EAAAA,SAAS,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;AACxC,MAAA,OAAA;AACJ,KAAA;IAEAH,QAAQ,CAACC,IAAI,CAACC,KAAK,CAACC,SAAS,GAAGL,QAAQ,CAACO,OAAO,CAAA;AACpD,GAAC,EAAE,CAACR,MAAM,CAAC,CAAC,CAAA;AAChB;;;;"}
|
@@ -0,0 +1,94 @@
|
|
1
|
+
import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
|
+
import throttle from 'lodash.throttle';
|
3
|
+
import { useState, useRef, useEffect } from 'react';
|
4
|
+
|
5
|
+
var SWIPE_THRESHOLD = 0.2;
|
6
|
+
var THROTTLE_DEFAULT_MS = 0;
|
7
|
+
var isScrollable = function isScrollable(element) {
|
8
|
+
if (!element) {
|
9
|
+
return false;
|
10
|
+
}
|
11
|
+
var style = getComputedStyle(element);
|
12
|
+
return style.overflow === 'scroll' || style.overflow === 'auto' || style.overflowY === 'scroll' || style.overflowY === 'auto';
|
13
|
+
};
|
14
|
+
var useSheetSwipe = function useSheetSwipe(args) {
|
15
|
+
var contentWrapperRef = args.contentWrapperRef,
|
16
|
+
contentRef = args.contentRef,
|
17
|
+
handleRef = args.handleRef,
|
18
|
+
onClose = args.onClose,
|
19
|
+
_args$throttleMs = args.throttleMs,
|
20
|
+
throttleMs = _args$throttleMs === void 0 ? THROTTLE_DEFAULT_MS : _args$throttleMs;
|
21
|
+
var _useState = useState(true),
|
22
|
+
_useState2 = _slicedToArray(_useState, 2),
|
23
|
+
isTopScroll = _useState2[0],
|
24
|
+
setIsTopScroll = _useState2[1];
|
25
|
+
var isOverscroll = useRef(false);
|
26
|
+
var startY = useRef(0);
|
27
|
+
var currentY = useRef(0);
|
28
|
+
useEffect(function () {
|
29
|
+
var contentWrapperEl = contentWrapperRef.current;
|
30
|
+
var handleEl = handleRef.current;
|
31
|
+
var contentEl = contentRef.current;
|
32
|
+
var triggerElement = !isTopScroll ? handleEl : contentWrapperEl;
|
33
|
+
if (!triggerElement || !contentEl || !contentWrapperEl) {
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
var nodes = Array.from(contentWrapperEl.querySelectorAll('*'));
|
37
|
+
var scrollableElements = nodes.filter(isScrollable);
|
38
|
+
contentWrapperEl.style.willChange = 'transform';
|
39
|
+
var onTouchStart = function onTouchStart(event) {
|
40
|
+
isOverscroll.current = false;
|
41
|
+
startY.current = event.changedTouches[0].clientY;
|
42
|
+
currentY.current = startY.current;
|
43
|
+
contentWrapperEl.style.transition = 'none';
|
44
|
+
};
|
45
|
+
var onTouchMove = function onTouchMove(event) {
|
46
|
+
var clientY = event.changedTouches[0].clientY;
|
47
|
+
currentY.current = Math.max(startY.current, clientY);
|
48
|
+
var offsetY = currentY.current - startY.current;
|
49
|
+
if (isOverscroll.current) {
|
50
|
+
startY.current = Infinity;
|
51
|
+
return;
|
52
|
+
}
|
53
|
+
if (offsetY !== 0 && event.cancelable) {
|
54
|
+
event.preventDefault();
|
55
|
+
}
|
56
|
+
contentWrapperEl.style.transform = "translateY(".concat(offsetY, "px)");
|
57
|
+
};
|
58
|
+
var onTouchEnd = function onTouchEnd(event) {
|
59
|
+
isOverscroll.current = false;
|
60
|
+
var curtainHeight = contentWrapperEl.offsetHeight;
|
61
|
+
var endY = event.changedTouches[0].clientY;
|
62
|
+
var offsetY = endY - startY.current;
|
63
|
+
contentWrapperEl.style.transform = '';
|
64
|
+
contentWrapperEl.style.transition = '';
|
65
|
+
if (offsetY / curtainHeight > SWIPE_THRESHOLD) {
|
66
|
+
onClose();
|
67
|
+
}
|
68
|
+
};
|
69
|
+
var onScroll = throttle(function (event) {
|
70
|
+
var onTop = event.target.scrollTop <= 0;
|
71
|
+
if (!onTop) {
|
72
|
+
isOverscroll.current = true;
|
73
|
+
}
|
74
|
+
setIsTopScroll(onTop);
|
75
|
+
}, throttleMs);
|
76
|
+
triggerElement.addEventListener('touchstart', onTouchStart);
|
77
|
+
triggerElement.addEventListener('touchmove', onTouchMove);
|
78
|
+
triggerElement.addEventListener('touchend', onTouchEnd);
|
79
|
+
scrollableElements.forEach(function (element) {
|
80
|
+
element.addEventListener('scroll', onScroll);
|
81
|
+
});
|
82
|
+
return function () {
|
83
|
+
triggerElement.removeEventListener('touchstart', onTouchStart);
|
84
|
+
triggerElement.removeEventListener('touchmove', onTouchMove);
|
85
|
+
triggerElement.removeEventListener('touchend', onTouchEnd);
|
86
|
+
scrollableElements.forEach(function (element) {
|
87
|
+
element.removeEventListener('scroll', onScroll);
|
88
|
+
});
|
89
|
+
};
|
90
|
+
}, [isTopScroll]);
|
91
|
+
};
|
92
|
+
|
93
|
+
export { useSheetSwipe };
|
94
|
+
//# 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 { useEffect, useRef, useState, RefObject } 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: RefObject<HTMLDivElement>;\n contentRef: RefObject<HTMLDivElement>;\n handleRef: 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,QAAQ,CAAC,IAAI,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAA7CI,IAAAA,WAAW,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,cAAc,GAAAH,UAAA,CAAA,CAAA,CAAA,CAAA;AAClC,EAAA,IAAMI,YAAY,GAAGC,MAAM,CAA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AClB,KAAY,EAAK;MACxC,IAAMmB,KAAK,GAAInB,KAAK,CAACoB,MAAM,CAAiBC,SAAS,IAAI,CAAC,CAAA;MAE1D,IAAI,CAACF,KAAK,EAAE;QACRrC,YAAY,CAACM,OAAO,GAAG,IAAI,CAAA;AAC/B,OAAA;MAEAP,cAAc,CAACsC,KAAK,CAAC,CAAA;KACxB,EAAE5C,UAAU,CAAC,CAAA;AAEdgB,IAAAA,cAAc,CAAC+B,gBAAgB,CAAC,YAAY,EAAEvB,YAAY,CAAC,CAAA;AAC3DR,IAAAA,cAAc,CAAC+B,gBAAgB,CAAC,WAAW,EAAElB,WAAW,CAAC,CAAA;AACzDb,IAAAA,cAAc,CAAC+B,gBAAgB,CAAC,UAAU,EAAET,UAAU,CAAC,CAAA;AAEvDjB,IAAAA,kBAAkB,CAAC2B,OAAO,CAAC,UAAC5D,OAAO,EAAK;AACpCA,MAAAA,OAAO,CAAC2D,gBAAgB,CAAC,QAAQ,EAAEL,QAAQ,CAAC,CAAA;AAChD,KAAC,CAAC,CAAA;AAEF,IAAA,OAAO,YAAM;AACT1B,MAAAA,cAAc,CAACiC,mBAAmB,CAAC,YAAY,EAAEzB,YAAY,CAAC,CAAA;AAC9DR,MAAAA,cAAc,CAACiC,mBAAmB,CAAC,WAAW,EAAEpB,WAAW,CAAC,CAAA;AAC5Db,MAAAA,cAAc,CAACiC,mBAAmB,CAAC,UAAU,EAAEX,UAAU,CAAC,CAAA;AAE1DjB,MAAAA,kBAAkB,CAAC2B,OAAO,CAAC,UAAC5D,OAAO,EAAK;AACpCA,QAAAA,OAAO,CAAC6D,mBAAmB,CAAC,QAAQ,EAAEP,QAAQ,CAAC,CAAA;AACnD,OAAC,CAAC,CAAA;KACL,CAAA;AACL,GAAC,EAAE,CAACrC,WAAW,CAAC,CAAC,CAAA;AACrB;;;;"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
var handleTransition = function handleTransition(transition) {
|
2
|
+
return function (props) {
|
3
|
+
var withTransition = props.withTransition;
|
4
|
+
return !withTransition ? 'unset' : transition;
|
5
|
+
};
|
6
|
+
};
|
7
|
+
|
8
|
+
export { handleTransition };
|
9
|
+
//# 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, 'opened'>;\n\nexport const handleTransition = (transition: string) => (props: HandleTransitionProps): string => {\n const { withTransition } = props;\n\n return !withTransition ? 'unset' : transition;\n};\n"],"names":["handleTransition","transition","props","withTransition"],"mappings":"IAIaA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,UAAkB,EAAA;EAAA,OAAK,UAACC,KAA4B,EAAa;AAC9F,IAAA,IAAQC,cAAc,GAAKD,KAAK,CAAxBC,cAAc,CAAA;AAEtB,IAAA,OAAO,CAACA,cAAc,GAAG,OAAO,GAAGF,UAAU,CAAA;GAChD,CAAA;AAAA;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Sheet/utils/index.ts"],"sourcesContent":["export { handleTransition } from './handleTransition';\n\nexport const DEFAULT_Z_INDEX = '0';\n"],"names":["DEFAULT_Z_INDEX"],"mappings":"AAEO,IAAMA,eAAe,GAAG;;;;"}
|
@@ -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/es/index.css
CHANGED
@@ -538,6 +538,13 @@
|
|
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_o73i75_sah7qw3__24445093{position:fixed;left:0;bottom:0;width:100%;max-height:100%;z-index:1000;opacity: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(--sah7qw3-0);transition:var(--sah7qw3-0);}.Sheet_styles_o73i75_sah7qw3__24445093.Sheet_styles_o73i75_closed__24445093{opacity:0;visibility:hidden;-webkit-transform:translateY(100%);-ms-transform:translateY(100%);transform:translateY(100%);}
|
542
|
+
.Sheet_styles_o73i75_shg69gz__24445093{width:3rem;padding:1.75rem 0;margin:-1.375rem 0;opacity:0.65;-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}.Sheet_styles_o73i75_shg69gz__24445093::before{content:'';display:block;border-radius:0.625rem;background-color:var(--plasma-sheet-handle-background-color);height:0.25rem;}
|
543
|
+
.Sheet_styles_o73i75_s1cdpbaw__24445093{border-radius:1.25rem 1.25rem 0 0;background-color:var(--plasma-sheet-content-background-color);padding-left:1rem;padding-right:1rem;padding-top:var(--s1cdpbaw-0);padding-bottom:var(--s1cdpbaw-1);max-height:100%;overflow:auto;overscroll-behavior:contain;}.Sheet_styles_o73i75_s1cdpbaw__24445093::-webkit-scrollbar{display:none;}
|
544
|
+
.Sheet_styles_o73i75_sjx120m__24445093{width:100%;z-index:1;padding-top:1rem;position:var(--sjx120m-0);top:var(--sjx120m-1);background-color:var(--sjx120m-2);}
|
545
|
+
|
546
|
+
.Sheet_styles_o73i75_sqp1ccu__24445093{width:100%;z-index:1;padding-bottom:1rem;position:var(--sqp1ccu-0);bottom:var(--sqp1ccu-1);background-color:var(--sqp1ccu-2);}
|
547
|
+
|
541
548
|
.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
549
|
.SliderBase_styles_7is2ll_rnaoqfb__0c0959e2{height:100%;}
|
543
550
|
.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/es/index.js
CHANGED
@@ -167,6 +167,8 @@ export { classes as dividerClasses, tokens as dividerTokens } from './components
|
|
167
167
|
export { toolbarConfig, toolbarRoot } from './components/Toolbar/Toolbar.js';
|
168
168
|
export { tokens as toolbarTokens } from './components/Toolbar/Toolbar.tokens.js';
|
169
169
|
export { toolbarDividerConfig, toolbarDividerRoot } from './components/Toolbar/ui/ToolbarDivider/ToolbarDivider.js';
|
170
|
+
export { sheetConfig, sheetRoot } from './components/Sheet/Sheet.js';
|
171
|
+
export { classes as sheetClasses, tokens as sheetTokens } from './components/Sheet/Sheet.tokens.js';
|
170
172
|
export { sliderConfig, sliderRoot } from './components/Slider/Slider.js';
|
171
173
|
export { tokens as sliderTokens } from './components/Slider/Slider.tokens.js';
|
172
174
|
import 'react';
|
package/es/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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.89.0-canary.1225.9560665253.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -76,6 +76,7 @@
|
|
76
76
|
"@storybook/react-vite": "7.6.17",
|
77
77
|
"@storybook/theming": "^7.6.17",
|
78
78
|
"@types/lodash": "^4.14.191",
|
79
|
+
"@types/lodash.throttle": "4.1.6",
|
79
80
|
"@types/node": "15.14.9",
|
80
81
|
"@types/react": "18.0.28",
|
81
82
|
"@types/react-dom": "18.0.11",
|
@@ -99,9 +100,10 @@
|
|
99
100
|
"@popperjs/core": "2.11.8",
|
100
101
|
"@salutejs/plasma-core": "1.160.0",
|
101
102
|
"focus-visible": "5.2.0",
|
103
|
+
"lodash.throttle": "4.1.1",
|
102
104
|
"react-draggable": "4.4.3",
|
103
105
|
"react-popper": "2.3.0",
|
104
106
|
"storeon": "3.1.5"
|
105
107
|
},
|
106
|
-
"gitHead": "
|
108
|
+
"gitHead": "69e1998cb04306776407013313a0704dcd020666"
|
107
109
|
}
|
@@ -0,0 +1,108 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
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); }
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.sheetRoot = exports.sheetConfig = void 0;
|
8
|
+
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
|
+
var _Overlay = /*#__PURE__*/require("../Overlay");
|
10
|
+
var _utils = /*#__PURE__*/require("../../utils");
|
11
|
+
var _hooks = /*#__PURE__*/require("./hooks");
|
12
|
+
var _Sheet = /*#__PURE__*/require("./Sheet.tokens");
|
13
|
+
var _Sheet2 = /*#__PURE__*/require("./Sheet.styles");
|
14
|
+
var _base = /*#__PURE__*/require("./variations/_view/base");
|
15
|
+
var _utils2 = /*#__PURE__*/require("./utils");
|
16
|
+
var _excluded = ["opened", "children", "onClose", "hasHandle", "contentHeader", "isHeaderFixed", "contentFooter", "isFooterFixed", "withOverlay", "withBlur", "withTransition", "throttleMs", "className", "view"];
|
17
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
18
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
19
|
+
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); }
|
20
|
+
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; }
|
21
|
+
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; }
|
22
|
+
/**
|
23
|
+
* Открывает окно-шторку поверх основного экрана.
|
24
|
+
*/
|
25
|
+
|
26
|
+
var sheetRoot = exports.sheetRoot = function sheetRoot(Root) {
|
27
|
+
return /*#__PURE__*/(0, _react.forwardRef)(function (_ref, rootRef) {
|
28
|
+
var opened = _ref.opened,
|
29
|
+
children = _ref.children,
|
30
|
+
onClose = _ref.onClose,
|
31
|
+
_ref$hasHandle = _ref.hasHandle,
|
32
|
+
hasHandle = _ref$hasHandle === void 0 ? true : _ref$hasHandle,
|
33
|
+
contentHeader = _ref.contentHeader,
|
34
|
+
_ref$isHeaderFixed = _ref.isHeaderFixed,
|
35
|
+
isHeaderFixed = _ref$isHeaderFixed === void 0 ? false : _ref$isHeaderFixed,
|
36
|
+
contentFooter = _ref.contentFooter,
|
37
|
+
_ref$isFooterFixed = _ref.isFooterFixed,
|
38
|
+
isFooterFixed = _ref$isFooterFixed === void 0 ? false : _ref$isFooterFixed,
|
39
|
+
_ref$withOverlay = _ref.withOverlay,
|
40
|
+
withOverlay = _ref$withOverlay === void 0 ? true : _ref$withOverlay,
|
41
|
+
_ref$withBlur = _ref.withBlur,
|
42
|
+
withBlur = _ref$withBlur === void 0 ? false : _ref$withBlur,
|
43
|
+
_ref$withTransition = _ref.withTransition,
|
44
|
+
withTransition = _ref$withTransition === void 0 ? true : _ref$withTransition,
|
45
|
+
throttleMs = _ref.throttleMs,
|
46
|
+
className = _ref.className,
|
47
|
+
view = _ref.view,
|
48
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
49
|
+
var contentWrapperRef = _react["default"].useRef(null);
|
50
|
+
var contentRef = _react["default"].useRef(null);
|
51
|
+
var handleRef = _react["default"].useRef(null);
|
52
|
+
(0, _hooks.useOverflow)({
|
53
|
+
opened: opened
|
54
|
+
});
|
55
|
+
(0, _hooks.useSheetSwipe)({
|
56
|
+
contentWrapperRef: contentWrapperRef,
|
57
|
+
contentRef: contentRef,
|
58
|
+
handleRef: handleRef,
|
59
|
+
throttleMs: throttleMs,
|
60
|
+
onClose: onClose
|
61
|
+
});
|
62
|
+
var hasHeader = Boolean(contentHeader);
|
63
|
+
var hasFooter = Boolean(contentFooter);
|
64
|
+
var closedClass = opened ? undefined : "".concat(_Sheet.classes.closed);
|
65
|
+
var overlayBackgroundToken = withBlur ? "var(".concat(_Sheet.tokens.sheetOverlayWithBlurColor, ")") : "var(".concat(_Sheet.tokens.sheetOverlayColor, ")");
|
66
|
+
return /*#__PURE__*/_react["default"].createElement(Root, {
|
67
|
+
opened: opened,
|
68
|
+
onClose: onClose,
|
69
|
+
view: view,
|
70
|
+
ref: rootRef
|
71
|
+
}, /*#__PURE__*/_react["default"].createElement(_Sheet2.StyledContentWrapper, _extends({
|
72
|
+
opened: opened,
|
73
|
+
withTransition: withTransition,
|
74
|
+
className: (0, _utils.cx)(closedClass, className),
|
75
|
+
ref: contentWrapperRef
|
76
|
+
}, restProps), hasHandle && /*#__PURE__*/_react["default"].createElement(_Sheet2.StyledSheetHandle, {
|
77
|
+
ref: handleRef
|
78
|
+
}), /*#__PURE__*/_react["default"].createElement(_Sheet2.StyledSheetContent, {
|
79
|
+
hasHeader: hasHeader,
|
80
|
+
hasFooter: hasFooter,
|
81
|
+
ref: contentRef
|
82
|
+
}, hasHeader && /*#__PURE__*/_react["default"].createElement(_Sheet2.StyledSheetHeader, {
|
83
|
+
isHeaderFixed: isHeaderFixed
|
84
|
+
}, contentHeader), /*#__PURE__*/_react["default"].createElement(_Sheet2.StyledSheetBody, null, children), hasFooter && /*#__PURE__*/_react["default"].createElement(_Sheet2.StyledSheetFooter, {
|
85
|
+
isFooterFixed: isFooterFixed
|
86
|
+
}, contentFooter))), withOverlay && opened && /*#__PURE__*/_react["default"].createElement(_Overlay.Overlay, {
|
87
|
+
zIndex: _utils2.DEFAULT_Z_INDEX,
|
88
|
+
backgroundColorProperty: overlayBackgroundToken,
|
89
|
+
withBlur: withBlur,
|
90
|
+
isClickable: true,
|
91
|
+
onOverlayClick: onClose
|
92
|
+
}));
|
93
|
+
});
|
94
|
+
};
|
95
|
+
var sheetConfig = exports.sheetConfig = {
|
96
|
+
name: 'Sheet',
|
97
|
+
tag: 'div',
|
98
|
+
layout: sheetRoot,
|
99
|
+
base: '',
|
100
|
+
variations: {
|
101
|
+
view: {
|
102
|
+
css: _base.base
|
103
|
+
}
|
104
|
+
},
|
105
|
+
defaults: {
|
106
|
+
view: 'default'
|
107
|
+
}
|
108
|
+
};
|