Skip to content

Commit 69bfe05

Browse files
author
Dmitry Dushkin
committed
Use typescript in src
1 parent 04974a9 commit 69bfe05

19 files changed

+5732
-30833
lines changed

.babelrc

-16
This file was deleted.

.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
docs
22
npm-debug.log
3+
*.tgz

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 5.1.0
2+
3+
- Add hideHeader option
4+
15
### 5.0.0
26

37
- Switch dist output to CommonJS module

babel.config.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module.exports = {
2+
plugins: [
3+
"babel-plugin-typescript-to-proptypes",
4+
"@babel/plugin-proposal-class-properties",
5+
],
6+
presets: [
7+
"@babel/preset-typescript",
8+
"@babel/preset-react",
9+
[
10+
"@babel/preset-env",
11+
{
12+
modules: false,
13+
targets: {
14+
browsers: ["last 2 versions"],
15+
},
16+
},
17+
],
18+
],
19+
};

dist/react-sliding-pane.d.ts

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from "react";
2+
import "./react-sliding-pane.css";
3+
declare type Props = {
4+
isOpen: boolean;
5+
title: string;
6+
subtitle?: string;
7+
from?: "left" | "right" | "bottom";
8+
children: React.ReactNode;
9+
className?: string;
10+
overlayClassName?: string;
11+
width?: string;
12+
closeIcon?: React.ReactNode;
13+
shouldCloseOnEsc?: boolean;
14+
hideHeader?: boolean;
15+
onRequestClose?: () => void;
16+
onAfterOpen?: () => void;
17+
};
18+
export declare function ReactSlidingPane({ isOpen, title, subtitle, onRequestClose, onAfterOpen, children, className, overlayClassName, closeIcon, from, width, shouldCloseOnEsc, hideHeader, }: Props): JSX.Element;
19+
export default ReactSlidingPane;

dist/react-sliding-pane.js

+27-21
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
'use strict';
22

3+
Object.defineProperty(exports, '__esModule', { value: true });
4+
35
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
46

7+
var _pt = _interopDefault(require('prop-types'));
58
var React = _interopDefault(require('react'));
6-
var PropTypes = _interopDefault(require('prop-types'));
79
var Modal = _interopDefault(require('react-modal'));
810

911
var CLOSE_TIMEOUT = 500;
@@ -18,26 +20,28 @@ function ReactSlidingPane(_ref) {
1820
overlayClassName = _ref.overlayClassName,
1921
closeIcon = _ref.closeIcon,
2022
_ref$from = _ref.from,
21-
from = _ref$from === void 0 ? 'right' : _ref$from,
23+
from = _ref$from === void 0 ? "right" : _ref$from,
2224
width = _ref.width,
23-
shouldCloseOnEsc = _ref.shouldCloseOnEsc;
25+
shouldCloseOnEsc = _ref.shouldCloseOnEsc,
26+
_ref$hideHeader = _ref.hideHeader,
27+
hideHeader = _ref$hideHeader === void 0 ? false : _ref$hideHeader;
2428
var directionClass = "slide-pane_from_".concat(from);
2529
return /*#__PURE__*/React.createElement(Modal, {
2630
ariaHideApp: false,
27-
className: "slide-pane ".concat(directionClass, " ").concat(className || ''),
31+
className: "slide-pane ".concat(directionClass, " ").concat(className || ""),
2832
style: {
2933
content: {
30-
width: width || '80%'
34+
width: width || "80%"
3135
}
3236
},
33-
overlayClassName: "slide-pane__overlay ".concat(overlayClassName || ''),
37+
overlayClassName: "slide-pane__overlay ".concat(overlayClassName || ""),
3438
closeTimeoutMS: CLOSE_TIMEOUT,
3539
isOpen: isOpen,
3640
shouldCloseOnEsc: shouldCloseOnEsc,
3741
onAfterOpen: onAfterOpen,
3842
onRequestClose: onRequestClose,
39-
contentLabel: "Modal \"".concat(title || '', "\"")
40-
}, /*#__PURE__*/React.createElement("div", {
43+
contentLabel: "Modal \"".concat(title || "", "\"")
44+
}, !hideHeader && /*#__PURE__*/React.createElement("div", {
4145
className: "slide-pane__header"
4246
}, /*#__PURE__*/React.createElement("div", {
4347
className: "slide-pane__close",
@@ -53,18 +57,19 @@ function ReactSlidingPane(_ref) {
5357
}, children));
5458
}
5559
ReactSlidingPane.propTypes = {
56-
isOpen: PropTypes.bool.isRequired,
57-
title: PropTypes.any,
58-
subtitle: PropTypes.any,
59-
onRequestClose: PropTypes.func,
60-
onAfterOpen: PropTypes.func,
61-
children: PropTypes.any.isRequired,
62-
className: PropTypes.string,
63-
overlayClassName: PropTypes.string,
64-
from: PropTypes.oneOf(['left', 'right', 'bottom']),
65-
width: PropTypes.string,
66-
closeIcon: PropTypes.any,
67-
shouldCloseOnEsc: PropTypes.bool
60+
isOpen: _pt.bool.isRequired,
61+
title: _pt.string.isRequired,
62+
subtitle: _pt.string,
63+
from: _pt.oneOf(["left", "right", "bottom"]),
64+
children: _pt.node.isRequired,
65+
className: _pt.string,
66+
overlayClassName: _pt.string,
67+
width: _pt.string,
68+
closeIcon: _pt.node,
69+
shouldCloseOnEsc: _pt.bool,
70+
hideHeader: _pt.bool,
71+
onRequestClose: _pt.func,
72+
onAfterOpen: _pt.func
6873
};
6974

7075
function IconClose() {
@@ -78,4 +83,5 @@ function IconClose() {
7883
}));
7984
}
8085

81-
module.exports = ReactSlidingPane;
86+
exports.ReactSlidingPane = ReactSlidingPane;
87+
exports.default = ReactSlidingPane;

0 commit comments

Comments
 (0)