@salutejs/plasma-new-hope 0.88.0-canary.1223.9316788273.0 → 0.88.0-canary.1225.9347054103.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/{Accordion/variations/_size → Sheet/variations/_view}/base.js +1 -1
- package/cjs/components/Sheet/variations/_view/base.js.map +1 -0
- package/cjs/index.css +6 -2
- package/cjs/index.js +6 -8
- 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/{Accordion → Sheet}/variations/_view/base.js +1 -1
- package/es/components/Sheet/variations/_view/base.js.map +1 -0
- package/es/index.css +6 -2
- package/es/index.js +2 -3
- 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 -11
- 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 +2 -2
- 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 -1
- package/types/index.d.ts.map +1 -1
- package/cjs/components/Accordion/Accordion.css +0 -1
- package/cjs/components/Accordion/Accordion.js +0 -50
- package/cjs/components/Accordion/Accordion.js.map +0 -1
- package/cjs/components/Accordion/Accordion.styles.js +0 -9
- package/cjs/components/Accordion/Accordion.styles.js.map +0 -1
- package/cjs/components/Accordion/Accordion.styles_1mo1sxr.css +0 -1
- package/cjs/components/Accordion/Accordion.tokens.js +0 -45
- package/cjs/components/Accordion/Accordion.tokens.js.map +0 -1
- package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js +0 -93
- package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js.map +0 -1
- package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +0 -63
- package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.styles.js.map +0 -1
- package/cjs/components/Accordion/variations/_size/base.js.map +0 -1
- package/cjs/components/Accordion/variations/_view/base.js +0 -9
- package/cjs/components/Accordion/variations/_view/base.js.map +0 -1
- package/cjs/components/_Icon/Icon.assets/ChevronDownFill.js +0 -33
- package/cjs/components/_Icon/Icon.assets/ChevronDownFill.js.map +0 -1
- package/cjs/components/_Icon/Icon.assets/Minus.js +0 -22
- package/cjs/components/_Icon/Icon.assets/Minus.js.map +0 -1
- package/cjs/components/_Icon/Icons/IconChevronDownFill.js +0 -23
- package/cjs/components/_Icon/Icons/IconChevronDownFill.js.map +0 -1
- package/cjs/components/_Icon/Icons/IconMinus.js +0 -23
- package/cjs/components/_Icon/Icons/IconMinus.js.map +0 -1
- package/es/components/Accordion/Accordion.css +0 -1
- package/es/components/Accordion/Accordion.js +0 -45
- package/es/components/Accordion/Accordion.js.map +0 -1
- package/es/components/Accordion/Accordion.styles.js +0 -5
- package/es/components/Accordion/Accordion.styles.js.map +0 -1
- package/es/components/Accordion/Accordion.styles_1mo1sxr.css +0 -1
- package/es/components/Accordion/Accordion.tokens.js +0 -40
- package/es/components/Accordion/Accordion.tokens.js.map +0 -1
- package/es/components/Accordion/ui/AccordionItem/AccordionItem.js +0 -89
- package/es/components/Accordion/ui/AccordionItem/AccordionItem.js.map +0 -1
- package/es/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +0 -49
- package/es/components/Accordion/ui/AccordionItem/AccordionItem.styles.js.map +0 -1
- package/es/components/Accordion/variations/_size/base.js +0 -5
- package/es/components/Accordion/variations/_size/base.js.map +0 -1
- package/es/components/Accordion/variations/_size/base_x642ct.css +0 -1
- package/es/components/Accordion/variations/_view/base.js.map +0 -1
- package/es/components/Accordion/variations/_view/base_x642ct.css +0 -1
- package/es/components/_Icon/Icon.assets/ChevronDownFill.js +0 -29
- package/es/components/_Icon/Icon.assets/ChevronDownFill.js.map +0 -1
- package/es/components/_Icon/Icon.assets/Minus.js +0 -18
- package/es/components/_Icon/Icon.assets/Minus.js.map +0 -1
- package/es/components/_Icon/Icons/IconChevronDownFill.js +0 -19
- package/es/components/_Icon/Icons/IconChevronDownFill.js.map +0 -1
- package/es/components/_Icon/Icons/IconMinus.js +0 -19
- package/es/components/_Icon/Icons/IconMinus.js.map +0 -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 -43
- package/styled-components/cjs/components/Accordion/index.js +0 -38
- package/styled-components/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js +0 -99
- 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 -37
- package/styled-components/es/components/Accordion/index.js +0 -3
- package/styled-components/es/components/Accordion/ui/AccordionItem/AccordionItem.js +0 -90
- 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 -38
- 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 -43
- 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/cjs/components/{Accordion/variations/_size → Sheet/variations/_view}/base_x642ct.css +0 -0
- /package/cjs/components/{Accordion/ui/AccordionItem/AccordionItem.css → _Icon/Icons/IconClose.css} +0 -0
- /package/{cjs/components/Accordion → es/components/Sheet}/variations/_view/base_x642ct.css +0 -0
- /package/es/components/{Accordion/ui/AccordionItem/AccordionItem.css → _Icon/Icons/IconClose.css} +0 -0
- /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,239 @@
|
|
1
|
+
import React, { useState } from 'react';
|
2
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
3
|
+
import type { ComponentProps } from 'react';
|
4
|
+
import { Body1 } from '@salutejs/plasma-core';
|
5
|
+
|
6
|
+
import { Button } from '../Button/Button';
|
7
|
+
import { WithTheme } from '../../../_helpers';
|
8
|
+
|
9
|
+
import { Sheet } from './Sheet';
|
10
|
+
|
11
|
+
const meta: Meta<typeof Sheet> = {
|
12
|
+
title: 'plasma_web/Sheet',
|
13
|
+
decorators: [WithTheme],
|
14
|
+
parameters: { viewport: { defaultViewport: '860' } },
|
15
|
+
};
|
16
|
+
|
17
|
+
export default meta;
|
18
|
+
|
19
|
+
type StorySheetProps = ComponentProps<typeof Sheet>;
|
20
|
+
|
21
|
+
const StoryDefault = ({ withOverlay, withTransition }: StorySheetProps) => {
|
22
|
+
const [isOpen, setIsOpen] = useState(false);
|
23
|
+
|
24
|
+
return (
|
25
|
+
<>
|
26
|
+
<Button onClick={() => setIsOpen(true)}>Открыть</Button>
|
27
|
+
<Sheet
|
28
|
+
isOpen={isOpen}
|
29
|
+
withOverlay={withOverlay}
|
30
|
+
withTransition={withTransition}
|
31
|
+
onClose={() => setIsOpen(false)}
|
32
|
+
>
|
33
|
+
<p>Вложенные кнопки</p>
|
34
|
+
<div
|
35
|
+
style={{
|
36
|
+
height: '75px',
|
37
|
+
overflow: 'scroll',
|
38
|
+
display: 'flex',
|
39
|
+
flexDirection: 'column',
|
40
|
+
gap: '1rem',
|
41
|
+
}}
|
42
|
+
>
|
43
|
+
<Button>Кнопка 1</Button>
|
44
|
+
<Button>Кнопка 2</Button>
|
45
|
+
<Button>Кнопка 3</Button>
|
46
|
+
<Button>Кнопка 4</Button>
|
47
|
+
<Button>Кнопка 5</Button>
|
48
|
+
<Button>Кнопка 6</Button>
|
49
|
+
<Button>Кнопка 7</Button>
|
50
|
+
<Button>Кнопка 8</Button>
|
51
|
+
</div>
|
52
|
+
<Body1>
|
53
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quae tempore vitae porro laboriosam
|
54
|
+
consectetur fugiat assumenda, earum nesciunt. Distinctio minima nesciunt dicta rem quae vel illum ea
|
55
|
+
fugit molestiae dolorem? Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quos nostrum
|
56
|
+
placeat, neque repudiandae consectetur voluptates soluta et sint eum obcaecati nesciunt ullam,
|
57
|
+
dolorem labore quaerat vero maxime ab ipsa nihil.
|
58
|
+
</Body1>
|
59
|
+
</Sheet>
|
60
|
+
</>
|
61
|
+
);
|
62
|
+
};
|
63
|
+
|
64
|
+
export const Default: StoryObj<StorySheetProps> = {
|
65
|
+
args: {
|
66
|
+
withOverlay: true,
|
67
|
+
withTransition: true,
|
68
|
+
},
|
69
|
+
render: (args) => <StoryDefault {...args} />,
|
70
|
+
};
|
71
|
+
|
72
|
+
const StoryWithoutOverlay = () => {
|
73
|
+
const [isOpen, setIsOpen] = useState(false);
|
74
|
+
|
75
|
+
return (
|
76
|
+
<>
|
77
|
+
<Button onClick={() => setIsOpen(true)}>Открыть</Button>
|
78
|
+
<Sheet isOpen={isOpen} withOverlay={false} onClose={() => setIsOpen(false)}>
|
79
|
+
<Body1>
|
80
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quae tempore vitae porro laboriosam
|
81
|
+
consectetur fugiat assumenda, earum nesciunt. Distinctio minima nesciunt dicta rem quae vel illum ea
|
82
|
+
fugit molestiae dolorem? Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quos nostrum
|
83
|
+
placeat, neque repudiandae consectetur voluptates soluta et sint eum obcaecati nesciunt ullam,
|
84
|
+
dolorem labore quaerat vero maxime ab ipsa nihil.
|
85
|
+
</Body1>
|
86
|
+
</Sheet>
|
87
|
+
</>
|
88
|
+
);
|
89
|
+
};
|
90
|
+
|
91
|
+
export const WithoutOverlay: StoryObj = {
|
92
|
+
render: () => <StoryWithoutOverlay />,
|
93
|
+
};
|
94
|
+
|
95
|
+
const StoryWithScroll = ({ withOverlay, withTransition }: StorySheetProps) => {
|
96
|
+
const [isOpen, setIsOpen] = useState(false);
|
97
|
+
|
98
|
+
return (
|
99
|
+
<>
|
100
|
+
<Button onClick={() => setIsOpen(true)}>Открыть</Button>
|
101
|
+
<Sheet
|
102
|
+
isOpen={isOpen}
|
103
|
+
withOverlay={withOverlay}
|
104
|
+
withTransition={withTransition}
|
105
|
+
onClose={() => setIsOpen(false)}
|
106
|
+
>
|
107
|
+
<Body1>
|
108
|
+
<Button onClick={() => setIsOpen(false)}>Закрыть</Button>
|
109
|
+
<p>
|
110
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quae tempore vitae porro laboriosam
|
111
|
+
consectetur fugiat assumenda, earum nesciunt. Distinctio minima nesciunt dicta rem quae vel
|
112
|
+
illum ea fugit molestiae dolorem? Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quos
|
113
|
+
nostrum placeat, neque repudiandae consectetur voluptates soluta et sint eum obcaecati nesciunt
|
114
|
+
ullam, dolorem labore quaerat vero maxime ab ipsa nihil.
|
115
|
+
</p>
|
116
|
+
<Button onClick={() => setIsOpen(false)}>Закрыть</Button>
|
117
|
+
<p>
|
118
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quae tempore vitae porro laboriosam
|
119
|
+
consectetur fugiat assumenda, earum nesciunt. Distinctio minima nesciunt dicta rem quae vel
|
120
|
+
illum ea fugit molestiae dolorem? Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quos
|
121
|
+
nostrum placeat, neque repudiandae consectetur voluptates soluta et sint eum obcaecati nesciunt
|
122
|
+
ullam, dolorem labore quaerat vero maxime ab ipsa nihil.
|
123
|
+
</p>
|
124
|
+
</Body1>
|
125
|
+
</Sheet>
|
126
|
+
</>
|
127
|
+
);
|
128
|
+
};
|
129
|
+
|
130
|
+
export const WithScroll: StoryObj<StorySheetProps> = {
|
131
|
+
render: (args) => <StoryWithScroll {...args} />,
|
132
|
+
};
|
133
|
+
|
134
|
+
const StoryWithInsideScroll = ({ withOverlay, withTransition }: StorySheetProps) => {
|
135
|
+
const [isOpen, setIsOpen] = useState(false);
|
136
|
+
|
137
|
+
return (
|
138
|
+
<>
|
139
|
+
<Button onClick={() => setIsOpen(true)}>Открыть</Button>
|
140
|
+
<Sheet
|
141
|
+
isOpen={isOpen}
|
142
|
+
withOverlay={withOverlay}
|
143
|
+
withTransition={withTransition}
|
144
|
+
onClose={() => setIsOpen(false)}
|
145
|
+
>
|
146
|
+
<p>Вложенные кнопки</p>
|
147
|
+
<div
|
148
|
+
style={{
|
149
|
+
height: '150px',
|
150
|
+
overflow: 'scroll',
|
151
|
+
display: 'flex',
|
152
|
+
flexDirection: 'column',
|
153
|
+
gap: '1rem',
|
154
|
+
}}
|
155
|
+
>
|
156
|
+
<Button>Кнопка 1</Button>
|
157
|
+
<Button>Кнопка 2</Button>
|
158
|
+
<Button>Кнопка 3</Button>
|
159
|
+
<Button>Кнопка 4</Button>
|
160
|
+
<Button>Кнопка 5</Button>
|
161
|
+
<Button>Кнопка 6</Button>
|
162
|
+
<Button>Кнопка 7</Button>
|
163
|
+
<Button>Кнопка 8</Button>
|
164
|
+
</div>
|
165
|
+
<Body1>Lorem ipsum dolor sit amet consectetur adipisicing elit.</Body1>
|
166
|
+
</Sheet>
|
167
|
+
</>
|
168
|
+
);
|
169
|
+
};
|
170
|
+
|
171
|
+
export const WithInsideScroll: StoryObj<StorySheetProps> = {
|
172
|
+
args: {
|
173
|
+
withOverlay: true,
|
174
|
+
withTransition: true,
|
175
|
+
},
|
176
|
+
render: (args) => <StoryWithInsideScroll {...args} />,
|
177
|
+
};
|
178
|
+
|
179
|
+
const StoryWithDoubleScroll = ({ withOverlay, withTransition }: StorySheetProps) => {
|
180
|
+
const [isOpen, setIsOpen] = useState(false);
|
181
|
+
|
182
|
+
return (
|
183
|
+
<>
|
184
|
+
<Button onClick={() => setIsOpen(true)}>Открыть</Button>
|
185
|
+
<Sheet
|
186
|
+
isOpen={isOpen}
|
187
|
+
withOverlay={withOverlay}
|
188
|
+
withTransition={withTransition}
|
189
|
+
onClose={() => setIsOpen(false)}
|
190
|
+
>
|
191
|
+
<Body1>
|
192
|
+
<Button onClick={() => setIsOpen(false)}>Закрыть</Button>
|
193
|
+
<p>Вложенные кнопки</p>
|
194
|
+
<div
|
195
|
+
style={{
|
196
|
+
height: '150px',
|
197
|
+
overflow: 'scroll',
|
198
|
+
display: 'flex',
|
199
|
+
flexDirection: 'column',
|
200
|
+
gap: '1rem',
|
201
|
+
}}
|
202
|
+
>
|
203
|
+
<Button>Кнопка 1</Button>
|
204
|
+
<Button>Кнопка 2</Button>
|
205
|
+
<Button>Кнопка 3</Button>
|
206
|
+
<Button>Кнопка 4</Button>
|
207
|
+
<Button>Кнопка 5</Button>
|
208
|
+
<Button>Кнопка 6</Button>
|
209
|
+
<Button>Кнопка 7</Button>
|
210
|
+
<Button>Кнопка 8</Button>
|
211
|
+
</div>
|
212
|
+
<p>
|
213
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quae tempore vitae porro laboriosam
|
214
|
+
consectetur fugiat assumenda, earum nesciunt. Distinctio minima nesciunt dicta rem quae vel
|
215
|
+
illum ea fugit molestiae dolorem? Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quos
|
216
|
+
nostrum placeat, neque repudiandae consectetur voluptates soluta et sint eum obcaecati nesciunt
|
217
|
+
ullam, dolorem labore quaerat vero maxime ab ipsa nihil.
|
218
|
+
</p>
|
219
|
+
<Button onClick={() => setIsOpen(false)}>Закрыть</Button>
|
220
|
+
<p>
|
221
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quae tempore vitae porro laboriosam
|
222
|
+
consectetur fugiat assumenda, earum nesciunt. Distinctio minima nesciunt dicta rem quae vel
|
223
|
+
illum ea fugit molestiae dolorem? Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quos
|
224
|
+
nostrum placeat, neque repudiandae consectetur voluptates soluta et sint eum obcaecati nesciunt
|
225
|
+
ullam, dolorem labore quaerat vero maxime ab ipsa nihil.
|
226
|
+
</p>
|
227
|
+
</Body1>
|
228
|
+
</Sheet>
|
229
|
+
</>
|
230
|
+
);
|
231
|
+
};
|
232
|
+
|
233
|
+
export const WithDoubleScroll: StoryObj<StorySheetProps> = {
|
234
|
+
args: {
|
235
|
+
withOverlay: true,
|
236
|
+
withTransition: true,
|
237
|
+
},
|
238
|
+
render: (args) => <StoryWithDoubleScroll {...args} />,
|
239
|
+
};
|
@@ -509,6 +509,17 @@ Object.keys(_Toolbar).forEach(function (key) {
|
|
509
509
|
}
|
510
510
|
});
|
511
511
|
});
|
512
|
+
var _Sheet = /*#__PURE__*/require("./components/Sheet");
|
513
|
+
Object.keys(_Sheet).forEach(function (key) {
|
514
|
+
if (key === "default" || key === "__esModule") return;
|
515
|
+
if (key in exports && exports[key] === _Sheet[key]) return;
|
516
|
+
Object.defineProperty(exports, key, {
|
517
|
+
enumerable: true,
|
518
|
+
get: function get() {
|
519
|
+
return _Sheet[key];
|
520
|
+
}
|
521
|
+
});
|
522
|
+
});
|
512
523
|
var _Slider = /*#__PURE__*/require("./components/Slider");
|
513
524
|
Object.keys(_Slider).forEach(function (key) {
|
514
525
|
if (key === "default" || key === "__esModule") return;
|
@@ -530,15 +541,4 @@ Object.keys(_Range).forEach(function (key) {
|
|
530
541
|
return _Range[key];
|
531
542
|
}
|
532
543
|
});
|
533
|
-
});
|
534
|
-
var _Accordion = /*#__PURE__*/require("./components/Accordion");
|
535
|
-
Object.keys(_Accordion).forEach(function (key) {
|
536
|
-
if (key === "default" || key === "__esModule") return;
|
537
|
-
if (key in exports && exports[key] === _Accordion[key]) return;
|
538
|
-
Object.defineProperty(exports, key, {
|
539
|
-
enumerable: true,
|
540
|
-
get: function get() {
|
541
|
-
return _Accordion[key];
|
542
|
-
}
|
543
|
-
});
|
544
544
|
});
|
@@ -0,0 +1,82 @@
|
|
1
|
+
var _excluded = ["isOpen", "children", "onClose", "withOverlay", "withTransition", "throttleMs", "className", "view"];
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
3
|
+
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; }
|
4
|
+
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; }
|
5
|
+
import React, { forwardRef } from 'react';
|
6
|
+
import { cx } from '../../utils';
|
7
|
+
import { useSheet, useSheetSwipe, useThemeContext } from './hooks';
|
8
|
+
import { classes } from './Sheet.tokens';
|
9
|
+
import { StyledContentWrapper, StyledOverlay, StyledSheetContent, StyledSheetHandle, StyledWrapper } from './Sheet.styles';
|
10
|
+
import { base as viewCSS } from './variations/_view/base';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Открывает окно-шторку поверх основного экрана.
|
14
|
+
*/
|
15
|
+
|
16
|
+
export var sheetRoot = function sheetRoot(Root) {
|
17
|
+
return /*#__PURE__*/forwardRef(function (_ref, rootRef) {
|
18
|
+
var isOpen = _ref.isOpen,
|
19
|
+
children = _ref.children,
|
20
|
+
onClose = _ref.onClose,
|
21
|
+
_ref$withOverlay = _ref.withOverlay,
|
22
|
+
withOverlay = _ref$withOverlay === void 0 ? true : _ref$withOverlay,
|
23
|
+
_ref$withTransition = _ref.withTransition,
|
24
|
+
withTransition = _ref$withTransition === void 0 ? true : _ref$withTransition,
|
25
|
+
throttleMs = _ref.throttleMs,
|
26
|
+
className = _ref.className,
|
27
|
+
view = _ref.view,
|
28
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
29
|
+
var contentWrapperRef = React.useRef(null);
|
30
|
+
var contentRef = React.useRef(null);
|
31
|
+
var handleRef = React.useRef(null);
|
32
|
+
var theme = useThemeContext();
|
33
|
+
useSheet({
|
34
|
+
isOpen: isOpen
|
35
|
+
});
|
36
|
+
useSheetSwipe({
|
37
|
+
contentWrapperRef: contentWrapperRef,
|
38
|
+
contentRef: contentRef,
|
39
|
+
handleRef: handleRef,
|
40
|
+
throttleMs: throttleMs,
|
41
|
+
onClose: onClose
|
42
|
+
});
|
43
|
+
var isClosedClass = isOpen ? undefined : "".concat(classes.isClosed);
|
44
|
+
return /*#__PURE__*/React.createElement(StyledWrapper, _extends({
|
45
|
+
theme: theme,
|
46
|
+
isOpen: isOpen,
|
47
|
+
withTransition: withTransition,
|
48
|
+
className: cx(isClosedClass, className)
|
49
|
+
}, restProps), /*#__PURE__*/React.createElement(Root, {
|
50
|
+
isOpen: isOpen,
|
51
|
+
onClose: onClose,
|
52
|
+
view: view,
|
53
|
+
ref: rootRef
|
54
|
+
}, /*#__PURE__*/React.createElement(StyledContentWrapper, {
|
55
|
+
theme: theme,
|
56
|
+
isOpen: isOpen,
|
57
|
+
withTransition: withTransition,
|
58
|
+
ref: contentWrapperRef
|
59
|
+
}, /*#__PURE__*/React.createElement(StyledSheetHandle, {
|
60
|
+
ref: handleRef
|
61
|
+
}), /*#__PURE__*/React.createElement(StyledSheetContent, {
|
62
|
+
ref: contentRef
|
63
|
+
}, children)), /*#__PURE__*/React.createElement(StyledOverlay, {
|
64
|
+
withOverlay: withOverlay,
|
65
|
+
onClick: onClose
|
66
|
+
})));
|
67
|
+
});
|
68
|
+
};
|
69
|
+
export var sheetConfig = {
|
70
|
+
name: 'Sheet',
|
71
|
+
tag: 'div',
|
72
|
+
layout: sheetRoot,
|
73
|
+
base: '',
|
74
|
+
variations: {
|
75
|
+
view: {
|
76
|
+
css: viewCSS
|
77
|
+
}
|
78
|
+
},
|
79
|
+
defaults: {
|
80
|
+
view: 'default'
|
81
|
+
}
|
82
|
+
};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import styled from 'styled-components';
|
2
|
+
import { tokens, classes } from './Sheet.tokens';
|
3
|
+
import { handleTransition } from './utils/handleTransition';
|
4
|
+
export var StyledWrapper = /*#__PURE__*/styled.div.withConfig({
|
5
|
+
componentId: "plasma-new-hope__sc-1pj79gq-0"
|
6
|
+
})(["position:fixed;top:0;bottom:0;left:0;right:0;opacity:1;transition:", ";z-index:1000;&.", "{opacity:0;visibility:hidden;}"], /*#__PURE__*/handleTransition('all 0.5s 0.1s'), /*#__PURE__*/String(classes.isClosed));
|
7
|
+
export var StyledContentWrapper = /*#__PURE__*/styled.div.withConfig({
|
8
|
+
componentId: "plasma-new-hope__sc-1pj79gq-1"
|
9
|
+
})(["position:absolute;left:0;bottom:0;width:100%;max-height:100%;z-index:1;display:flex;flex-direction:column;justify-content:flex-end;transition:", ";&.", "{transform:translateY(100%);}"], /*#__PURE__*/handleTransition('transform 0.5s'), /*#__PURE__*/String(classes.isClosed));
|
10
|
+
export var StyledOverlay = /*#__PURE__*/styled.div.withConfig({
|
11
|
+
componentId: "plasma-new-hope__sc-1pj79gq-2"
|
12
|
+
})(["position:absolute;top:0;left:0;width:100%;height:100%;background-color:", ";"], function (_ref) {
|
13
|
+
var withOverlay = _ref.withOverlay;
|
14
|
+
return withOverlay ? "var(".concat(tokens.overlayBackgroundColor, ")") : 'transparent';
|
15
|
+
});
|
16
|
+
export var StyledSheetContent = /*#__PURE__*/styled.div.withConfig({
|
17
|
+
componentId: "plasma-new-hope__sc-1pj79gq-3"
|
18
|
+
})(["border-radius:1.5rem 1.5rem 0 0;background-color:var(", ");padding:1rem;max-height:100%;overflow:auto;overscroll-behavior:contain;&::-webkit-scrollbar{display:none;}"], tokens.contentBackgroundColor);
|
19
|
+
export var StyledSheetHandle = /*#__PURE__*/styled.div.withConfig({
|
20
|
+
componentId: "plasma-new-hope__sc-1pj79gq-4"
|
21
|
+
})(["width:4rem;padding:1.75rem 0;margin:-1.5rem 0;opacity:0.65;align-self:center;&::before{content:'';display:block;border-radius:0.625rem;background-color:var(", ");height:0.25rem;}"], tokens.handleColor);
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export var classes = {
|
2
|
+
isClosed: 'is-closed'
|
3
|
+
};
|
4
|
+
export var tokens = {
|
5
|
+
overlayBackgroundColor: '--plasma-sheet-overlay-background-color',
|
6
|
+
contentBackgroundColor: '--plasma-sheet-content-background-color',
|
7
|
+
handleColor: '--plasma-sheet-handle-background-color'
|
8
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
2
|
+
export var useSheet = function useSheet(_ref) {
|
3
|
+
var isOpen = _ref.isOpen;
|
4
|
+
var overflow = useRef(document.body.style.overflowY);
|
5
|
+
|
6
|
+
// linaria не поддерживает динамический global
|
7
|
+
useEffect(function () {
|
8
|
+
if (isOpen) {
|
9
|
+
overflow.current = document.body.style.overflowY;
|
10
|
+
document.body.style.overflowY = 'hidden';
|
11
|
+
}
|
12
|
+
}, [isOpen]);
|
13
|
+
useEffect(function () {
|
14
|
+
if (!isOpen) {
|
15
|
+
document.body.style.overflowY = overflow.current;
|
16
|
+
}
|
17
|
+
}, [isOpen, overflow.current]);
|
18
|
+
};
|
@@ -0,0 +1,95 @@
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
7
|
+
import throttle from 'lodash.throttle';
|
8
|
+
import { useEffect, useRef, useState } from 'react';
|
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
|
+
export 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 = useState(true),
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
27
|
+
isTopScroll = _useState2[0],
|
28
|
+
setIsTopScroll = _useState2[1];
|
29
|
+
var isOverscroll = useRef(false);
|
30
|
+
var startY = useRef(0);
|
31
|
+
var currentY = useRef(0);
|
32
|
+
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
|
+
};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { useContext } from 'react';
|
2
|
+
import { ThemeContext } from 'styled-components';
|
3
|
+
/**
|
4
|
+
* Возвращает контекст темы.
|
5
|
+
* @return {ThemeProviderContext}
|
6
|
+
*/
|
7
|
+
export var useThemeContext = function useThemeContext() {
|
8
|
+
return useContext(ThemeContext) || {};
|
9
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { handleTransition } from './handleTransition';
|
@@ -4,8 +4,6 @@ export { IconMic } from './Icons/IconMic';
|
|
4
4
|
export { IconChevronLeft } from './Icons/IconChevronLeft';
|
5
5
|
export { IconChevronDoubleLeft } from './Icons/IconChevronDoubleLeft';
|
6
6
|
export { IconChevronDown } from './Icons/IconChevronDown';
|
7
|
-
export { IconChevronDownFill } from './Icons/IconChevronDownFill';
|
8
7
|
export { IconClose } from './Icons/IconClose';
|
9
8
|
export { IconCross } from './Icons/IconCross';
|
10
|
-
export { IconDone } from './Icons/IconDone';
|
11
|
-
export { IconMinus } from './Icons/IconMinus';
|
9
|
+
export { IconDone } from './Icons/IconDone';
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { css } from 'styled-components';
|
2
|
+
import { sheetTokens } from '../../../../components/Sheet';
|
3
|
+
export var config = {
|
4
|
+
defaults: {
|
5
|
+
view: 'default'
|
6
|
+
},
|
7
|
+
variations: {
|
8
|
+
view: {
|
9
|
+
"default": /*#__PURE__*/css(["", ":var(--surface-solid-card);", ":var(--overlay-soft);", ":var(--text-primary);"], sheetTokens.contentBackgroundColor, sheetTokens.overlayBackgroundColor, sheetTokens.handleColor)
|
10
|
+
}
|
11
|
+
}
|
12
|
+
};
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { sheetConfig } from '../../../../components/Sheet';
|
2
|
+
import { component, mergeConfig } from '../../../../engines';
|
3
|
+
import { config } from './Sheet.config';
|
4
|
+
export { sheetClasses } from '../../../../components/Sheet';
|
5
|
+
var mergedConfig = /*#__PURE__*/mergeConfig(sheetConfig, config);
|
6
|
+
export var Sheet = /*#__PURE__*/component(mergedConfig);
|