ar-design 0.3.25 → 0.3.27

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.
@@ -42,5 +42,7 @@ interface IProps extends IChildren, ISize, React.HTMLAttributes<HTMLDivElement>
42
42
  * ```
43
43
  */
44
44
  footer?: React.ReactNode;
45
+ disableCloseOnBackdrop?: boolean;
46
+ disableCloseOnEsc?: boolean;
45
47
  }
46
48
  export default IProps;
@@ -4,7 +4,7 @@ import "../../../assets/css/components/feedback/modal/styles.css";
4
4
  import Typography from "../../data-display/typography";
5
5
  import Popover from "../popover";
6
6
  const { Title } = Typography;
7
- const Modal = ({ children, open, closePopover, title, size = "normal", footer, ...attributes }) => {
7
+ const Modal = ({ children, open, closePopover, title, size = "normal", footer, disableCloseOnBackdrop, disableCloseOnEsc, ...attributes }) => {
8
8
  // refs
9
9
  const _arModal = useRef(null);
10
10
  const _modalWrapperClassName = ["ar-modal-wrapper"];
@@ -15,6 +15,8 @@ const Modal = ({ children, open, closePopover, title, size = "normal", footer, .
15
15
  _modalWrapperClassName.push("closed");
16
16
  // methods
17
17
  const handleKeys = (event) => {
18
+ if (disableCloseOnEsc)
19
+ return;
18
20
  const key = event.key;
19
21
  const isArSelectOptions = document.getElementsByClassName("ar-select-options").length === 0;
20
22
  const isArCalendar = document.getElementsByClassName("ar-date-calendar").length === 0;
@@ -71,6 +73,8 @@ const Modal = ({ children, open, closePopover, title, size = "normal", footer, .
71
73
  }, [attributes.className]);
72
74
  return (React.createElement("div", { className: _modalWrapperClassName.map((c) => c).join(" ") },
73
75
  React.createElement("div", { className: "ar-modal-bg", onMouseDown: (event) => {
76
+ if (disableCloseOnBackdrop)
77
+ return;
74
78
  event.stopPropagation();
75
79
  const target = event.target;
76
80
  if (_arModal.current && !_arModal.current.contains(target))
@@ -17,7 +17,7 @@ const Button = ({ children, variant = "filled", shape, color = "light", border =
17
17
  _arButtonClassName.push(position.type);
18
18
  _arButtonClassName.push(position.inset.map((_inset) => _inset).join(" "));
19
19
  }
20
- return (React.createElement("button", { ref: _button, ...attributes, className: _arButtonClassName.map((c) => c).join(" "), onClick: (event) => {
20
+ return (React.createElement("button", { ref: _button, ...attributes, type: attributes.type ?? "button", className: _arButtonClassName.map((c) => c).join(" "), onClick: (event) => {
21
21
  // Disabled gelmesi durumunda işlem yapmasına izin verme...
22
22
  if (attributes.disabled)
23
23
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.3.25",
3
+ "version": "0.3.27",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",