@dreamcommerce/aurora 2.2.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/packages/aurora/src/components/slide/index.js +11 -5
- package/build/cjs/packages/aurora/src/components/slide/index.js.map +1 -1
- package/build/cjs/packages/aurora/src/constants/directions.js +13 -0
- package/build/cjs/packages/aurora/src/constants/directions.js.map +1 -0
- package/build/cjs/packages/aurora/src/css/slide/main.module.less.js +1 -1
- package/build/esm/packages/aurora/src/components/slide/index.js +10 -5
- package/build/esm/packages/aurora/src/components/slide/index.js.map +1 -1
- package/build/esm/packages/aurora/src/components/slide/types.d.ts +3 -7
- package/build/esm/packages/aurora/src/components/slide/types.js +1 -0
- package/build/esm/packages/aurora/src/components/slide/types.js.map +1 -1
- package/build/esm/packages/aurora/src/constants/directions.d.ts +6 -0
- package/build/esm/packages/aurora/src/constants/directions.js +9 -0
- package/build/esm/packages/aurora/src/constants/directions.js.map +1 -0
- package/build/esm/packages/aurora/src/css/slide/main.module.less.js +1 -1
- package/build/esm/packages/aurora/src/typings/general.d.ts +8 -0
- package/build/esm/packages/aurora/src/typings/general.js +1 -0
- package/build/esm/packages/aurora/src/typings/general.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,32 +3,38 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
+
var classnames = require('classnames');
|
|
7
|
+
var directions = require('../../constants/directions.js');
|
|
6
8
|
var css_classes = require('./css_classes.js');
|
|
7
9
|
var main_module = require('../../css/slide/main.module.less.js');
|
|
8
10
|
|
|
9
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
12
|
|
|
11
13
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
|
+
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
12
15
|
|
|
13
16
|
const Slide = ({ isOpen, autoOpen, direction = 'left', position, animationDurationMs = 300, children }) => {
|
|
14
17
|
if (autoOpen)
|
|
15
18
|
isOpen = true;
|
|
16
19
|
let directionClass;
|
|
17
20
|
switch (direction) {
|
|
18
|
-
case
|
|
21
|
+
case directions.DIRECTION.top:
|
|
19
22
|
directionClass = css_classes['default'].slideDirectionTop;
|
|
20
23
|
break;
|
|
21
|
-
case
|
|
24
|
+
case directions.DIRECTION.right:
|
|
22
25
|
directionClass = css_classes['default'].slideDirectionRight;
|
|
23
26
|
break;
|
|
24
|
-
case
|
|
27
|
+
case directions.DIRECTION.bottom:
|
|
25
28
|
directionClass = css_classes['default'].slideDirectionBottom;
|
|
26
29
|
break;
|
|
27
|
-
case
|
|
30
|
+
case directions.DIRECTION.left:
|
|
28
31
|
directionClass = css_classes['default'].slideDirectionLeft;
|
|
29
32
|
break;
|
|
30
33
|
}
|
|
31
|
-
|
|
34
|
+
const slideClassNames = classnames__default['default'](main_module['default'][css_classes['default'].slide], main_module['default'][directionClass], {
|
|
35
|
+
[main_module['default'][css_classes['default'].slideIsOpen]]: isOpen
|
|
36
|
+
});
|
|
37
|
+
return (React__default['default'].createElement("div", { className: slideClassNames, style: {
|
|
32
38
|
animationDuration: `${animationDurationMs}ms`,
|
|
33
39
|
top: (position === null || position === void 0 ? void 0 : position.top) ? `${position.top}px` : '',
|
|
34
40
|
right: (position === null || position === void 0 ? void 0 : position.right) ? `${position.right}px` : '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const DIRECTION = {
|
|
6
|
+
top: 'top',
|
|
7
|
+
right: 'right',
|
|
8
|
+
bottom: 'bottom',
|
|
9
|
+
left: 'left'
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.DIRECTION = DIRECTION;
|
|
13
|
+
//# sourceMappingURL=directions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var styleInject_es = require('../../../../../external/style-inject/dist/style-inject.es.js');
|
|
6
6
|
|
|
7
|
-
var css_248z = "@-webkit-keyframes main-module_directionLeftShow__1VVi1 {\n from {\n transform: translateX(100%);\n }\n to {\n transform: translateX(0);\n }\n}\n@keyframes main-module_directionLeftShow__1VVi1 {\n from {\n transform: translateX(100%);\n }\n to {\n transform: translateX(0);\n }\n}\n@-webkit-keyframes main-module_directionLeftHide__QSuRw {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(100%);\n }\n}\n@keyframes main-module_directionLeftHide__QSuRw {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(100%);\n }\n}\n.main-module_slide__1kcca {\n position: absolute;\n top: 0;\n height: 100%;\n background-color: #fff;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n overflow-y: auto;\n z-index: 1;\n}\n.main-module_slide_direction-left__Rg5kV {\n right: 0;\n -webkit-animation-name: main-module_directionLeftHide__QSuRw;\n animation-name: main-module_directionLeftHide__QSuRw;\n}\n.main-module_slide_direction-left__Rg5kV.main-module_slide_is-open__3twK9 {\n -webkit-animation-name: main-module_directionLeftShow__1VVi1;\n animation-name: main-module_directionLeftShow__1VVi1;\n}\n";
|
|
7
|
+
var css_248z = "@-webkit-keyframes main-module_directionLeftShow__1VVi1 {\n from {\n transform: translateX(100%);\n }\n to {\n transform: translateX(0);\n }\n}\n@keyframes main-module_directionLeftShow__1VVi1 {\n from {\n transform: translateX(100%);\n }\n to {\n transform: translateX(0);\n }\n}\n@-webkit-keyframes main-module_directionLeftHide__QSuRw {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(100%);\n }\n}\n@keyframes main-module_directionLeftHide__QSuRw {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(100%);\n }\n}\n.main-module_slide__1kcca {\n position: absolute;\n top: 0;\n height: 100%;\n background-color: #fff;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n overflow-y: auto;\n z-index: 1;\n}\n.main-module_slide_direction-left__Rg5kV {\n right: 0;\n left: 0;\n -webkit-animation-name: main-module_directionLeftHide__QSuRw;\n animation-name: main-module_directionLeftHide__QSuRw;\n}\n.main-module_slide_direction-left__Rg5kV.main-module_slide_is-open__3twK9 {\n -webkit-animation-name: main-module_directionLeftShow__1VVi1;\n animation-name: main-module_directionLeftShow__1VVi1;\n}\n";
|
|
8
8
|
var cssClasses = {"slide":"main-module_slide__1kcca","slide_direction-left":"main-module_slide_direction-left__Rg5kV","directionLeftHide":"main-module_directionLeftHide__QSuRw","slide_is-open":"main-module_slide_is-open__3twK9","directionLeftShow":"main-module_directionLeftShow__1VVi1"};
|
|
9
9
|
styleInject_es['default'](css_248z);
|
|
10
10
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { DIRECTION } from '../../constants/directions.js';
|
|
2
4
|
import CSS_CLASSES from './css_classes.js';
|
|
3
5
|
import cssClasses from '../../css/slide/main.module.less.js';
|
|
4
6
|
|
|
@@ -7,20 +9,23 @@ const Slide = ({ isOpen, autoOpen, direction = 'left', position, animationDurati
|
|
|
7
9
|
isOpen = true;
|
|
8
10
|
let directionClass;
|
|
9
11
|
switch (direction) {
|
|
10
|
-
case
|
|
12
|
+
case DIRECTION.top:
|
|
11
13
|
directionClass = CSS_CLASSES.slideDirectionTop;
|
|
12
14
|
break;
|
|
13
|
-
case
|
|
15
|
+
case DIRECTION.right:
|
|
14
16
|
directionClass = CSS_CLASSES.slideDirectionRight;
|
|
15
17
|
break;
|
|
16
|
-
case
|
|
18
|
+
case DIRECTION.bottom:
|
|
17
19
|
directionClass = CSS_CLASSES.slideDirectionBottom;
|
|
18
20
|
break;
|
|
19
|
-
case
|
|
21
|
+
case DIRECTION.left:
|
|
20
22
|
directionClass = CSS_CLASSES.slideDirectionLeft;
|
|
21
23
|
break;
|
|
22
24
|
}
|
|
23
|
-
|
|
25
|
+
const slideClassNames = classnames(cssClasses[CSS_CLASSES.slide], cssClasses[directionClass], {
|
|
26
|
+
[cssClasses[CSS_CLASSES.slideIsOpen]]: isOpen
|
|
27
|
+
});
|
|
28
|
+
return (React.createElement("div", { className: slideClassNames, style: {
|
|
24
29
|
animationDuration: `${animationDurationMs}ms`,
|
|
25
30
|
top: (position === null || position === void 0 ? void 0 : position.top) ? `${position.top}px` : '',
|
|
26
31
|
right: (position === null || position === void 0 ? void 0 : position.right) ? `${position.right}px` : '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
+
import { TCssPositions, TDirection } from "../../typings/general";
|
|
1
2
|
import { ReactNode } from 'react';
|
|
2
3
|
export interface ISlideProps {
|
|
3
4
|
isOpen?: boolean;
|
|
4
5
|
autoOpen?: boolean;
|
|
5
|
-
direction?:
|
|
6
|
-
position?:
|
|
7
|
-
top?: number;
|
|
8
|
-
right?: number;
|
|
9
|
-
bottom?: number;
|
|
10
|
-
left?: number;
|
|
11
|
-
};
|
|
6
|
+
direction?: TDirection;
|
|
7
|
+
position?: TCssPositions;
|
|
12
8
|
animationDurationMs?: number;
|
|
13
9
|
children: ReactNode;
|
|
14
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../src/components/slide/types.ts"],"names":[],"mappings":"AAAA,OAA0B,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../src/components/slide/types.ts"],"names":[],"mappings":"AAAA,OAA0C,wBAAwB,CAAC;AAEnE,OAA0B,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styleInject from '../../../../../external/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = "@-webkit-keyframes main-module_directionLeftShow__1VVi1 {\n from {\n transform: translateX(100%);\n }\n to {\n transform: translateX(0);\n }\n}\n@keyframes main-module_directionLeftShow__1VVi1 {\n from {\n transform: translateX(100%);\n }\n to {\n transform: translateX(0);\n }\n}\n@-webkit-keyframes main-module_directionLeftHide__QSuRw {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(100%);\n }\n}\n@keyframes main-module_directionLeftHide__QSuRw {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(100%);\n }\n}\n.main-module_slide__1kcca {\n position: absolute;\n top: 0;\n height: 100%;\n background-color: #fff;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n overflow-y: auto;\n z-index: 1;\n}\n.main-module_slide_direction-left__Rg5kV {\n right: 0;\n -webkit-animation-name: main-module_directionLeftHide__QSuRw;\n animation-name: main-module_directionLeftHide__QSuRw;\n}\n.main-module_slide_direction-left__Rg5kV.main-module_slide_is-open__3twK9 {\n -webkit-animation-name: main-module_directionLeftShow__1VVi1;\n animation-name: main-module_directionLeftShow__1VVi1;\n}\n";
|
|
3
|
+
var css_248z = "@-webkit-keyframes main-module_directionLeftShow__1VVi1 {\n from {\n transform: translateX(100%);\n }\n to {\n transform: translateX(0);\n }\n}\n@keyframes main-module_directionLeftShow__1VVi1 {\n from {\n transform: translateX(100%);\n }\n to {\n transform: translateX(0);\n }\n}\n@-webkit-keyframes main-module_directionLeftHide__QSuRw {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(100%);\n }\n}\n@keyframes main-module_directionLeftHide__QSuRw {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(100%);\n }\n}\n.main-module_slide__1kcca {\n position: absolute;\n top: 0;\n height: 100%;\n background-color: #fff;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n overflow-y: auto;\n z-index: 1;\n}\n.main-module_slide_direction-left__Rg5kV {\n right: 0;\n left: 0;\n -webkit-animation-name: main-module_directionLeftHide__QSuRw;\n animation-name: main-module_directionLeftHide__QSuRw;\n}\n.main-module_slide_direction-left__Rg5kV.main-module_slide_is-open__3twK9 {\n -webkit-animation-name: main-module_directionLeftShow__1VVi1;\n animation-name: main-module_directionLeftShow__1VVi1;\n}\n";
|
|
4
4
|
var cssClasses = {"slide":"main-module_slide__1kcca","slide_direction-left":"main-module_slide_direction-left__Rg5kV","directionLeftHide":"main-module_directionLeftHide__QSuRw","slide_is-open":"main-module_slide_is-open__3twK9","directionLeftShow":"main-module_directionLeftShow__1VVi1"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { HORIZONTAL_POSITION, VERTICAL_POSITION } from "../constants/positions";
|
|
2
|
+
import { DIRECTION } from "../constants/directions";
|
|
2
3
|
export declare type EnumLiteralsOf<T extends object> = T[keyof T];
|
|
3
4
|
export declare type THorizontalPosition = EnumLiteralsOf<typeof HORIZONTAL_POSITION>;
|
|
4
5
|
export declare type TVerticalPosition = EnumLiteralsOf<typeof VERTICAL_POSITION>;
|
|
6
|
+
export declare type TCssPositions = {
|
|
7
|
+
top?: number;
|
|
8
|
+
right?: number;
|
|
9
|
+
bottom?: number;
|
|
10
|
+
left?: number;
|
|
11
|
+
};
|
|
12
|
+
export declare type TDirection = EnumLiteralsOf<typeof DIRECTION>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.js","sourceRoot":"","sources":["../../../../../../src/typings/general.ts"],"names":[],"mappings":"AAAA,OAAuD,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"general.js","sourceRoot":"","sources":["../../../../../../src/typings/general.ts"],"names":[],"mappings":"AAAA,OAAuD,4BAA4B,CAAC;AAEpF,OAA0B,6BAA6B,CAAC"}
|