Skip to content

Commit

Permalink
update to v0.2.0
Browse files Browse the repository at this point in the history
update default options to be the same with bootstrap
remove scrollable option (no need for dialog)
  • Loading branch information
zhaoyao91 committed Sep 20, 2019
1 parent 2440bff commit bd4798b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 20 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,10 @@ The following options can be passed into `Dialog`, `DialogProvider` as the props
- `cancelButtonProps`? : object // options passed into the underlining [Button](https://react-bootstrap.github.io/components/buttons/#button-props)
- `confirmButtonProps`? : object // options passed into the underlining [Button](https://react-bootstrap.github.io/components/buttons/#button-props)
- `autoFocus` = 'select' : boolean | 'select'
- `stubborn` = true : boolean // if true, clicking the background would not trigger canceling
- `centered` = true : boolean // see [Modal](https://react-bootstrap.github.io/components/modal/#modal-props)
- `stubborn` = false : boolean // if true, clicking the background would not trigger canceling
- `centered` = false : boolean // see [Modal](https://react-bootstrap.github.io/components/modal/#modal-props)
- `animation` = true : boolean // see [Modal](https://react-bootstrap.github.io/components/modal/#modal-props)
- `scrollable`? : boolean // see [Modal](https://react-bootstrap.github.io/components/modal/#modal-props)
- `size`? : string // see [Modal](https://react-bootstrap.github.io/components/modal/#modal-props)
- `size` = '' : string // see [Modal](https://react-bootstrap.github.io/components/modal/#modal-props)

## Advanced Usage

Expand Down
11 changes: 5 additions & 6 deletions lib/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,13 @@ function DialogUI(_ref4) {
_ref4$autoFocus = _ref4.autoFocus,
autoFocus = _ref4$autoFocus === void 0 ? "select" : _ref4$autoFocus,
_ref4$stubborn = _ref4.stubborn,
stubborn = _ref4$stubborn === void 0 ? true : _ref4$stubborn,
stubborn = _ref4$stubborn === void 0 ? false : _ref4$stubborn,
_ref4$centered = _ref4.centered,
centered = _ref4$centered === void 0 ? true : _ref4$centered,
centered = _ref4$centered === void 0 ? false : _ref4$centered,
_ref4$animation = _ref4.animation,
animation = _ref4$animation === void 0 ? true : _ref4$animation,
scrollable = _ref4.scrollable,
size = _ref4.size;
_ref4$size = _ref4.size,
size = _ref4$size === void 0 ? "" : _ref4$size;

var _ref5 = inputProps || {},
_ref5$defaultValue = _ref5.defaultValue,
Expand Down Expand Up @@ -279,7 +279,7 @@ function DialogUI(_ref4) {

function handleHide() {
if (!stubborn) {
onCancel();
handleCancel();
}
}

Expand All @@ -303,7 +303,6 @@ function DialogUI(_ref4) {
centered: centered,
onExited: handleExited,
animation: animation,
scrollable: scrollable,
size: size
}, showHeader && _react["default"].createElement(_Modal["default"].Header, null, _react["default"].createElement(_Modal["default"].Title, null, title)), showBody && _react["default"].createElement(_Modal["default"].Body, null, !!text && _react["default"].createElement("p", {
style: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-bootstrap-easy-dialog",
"version": "0.1.1",
"version": "0.2.0-alpha.0",
"description": "React Bootstrap Dialog made easy",
"keywords": [
"react-bootstrap",
Expand Down
16 changes: 7 additions & 9 deletions src/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,14 @@ export function DialogUI({
onConfirm, // (inputValue) => void
onCancel, // () => void
onExited, // () => void
autoFocus = "select", // boolean | 'select'
stubborn = true, // boolean?
centered = true, // boolean?
animation = true,
scrollable,
size
autoFocus = "select", // boolean | 'select' ?
stubborn = false, // boolean?
centered = false, // boolean?
animation = true, // boolean?
size = "" // string?
}) {
const { defaultValue = "", refKey = "ref", ...otherInputProps } =
inputProps || {};
inputProps || {};

const [inputValue, setInputValue] = useState("");
const inputRef = useRef();
Expand Down Expand Up @@ -198,7 +197,7 @@ export function DialogUI({

function handleHide() {
if (!stubborn) {
onCancel();
handleCancel();
}
}

Expand All @@ -223,7 +222,6 @@ export function DialogUI({
centered={centered}
onExited={handleExited}
animation={animation}
scrollable={scrollable}
size={size}
>
{showHeader && (
Expand Down

0 comments on commit bd4798b

Please sign in to comment.