@wavv/ui 2.4.4-alpha.1 → 2.4.4-alpha.2

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.
@@ -15,8 +15,12 @@ type DialogProps = {
15
15
  confirmText?: string;
16
16
  /** The confirm button will be negative (red) */
17
17
  negative?: boolean;
18
+ /** Disables the confirm button */
19
+ confirmDisabled?: boolean;
18
20
  /** The function called when the confirm button is clicked */
19
21
  onConfirm?: () => void;
22
+ /** The function called when the cancel button is clicked */
23
+ onCancel?: () => void;
20
24
  /** Controls whether or not the Dialog is open */
21
25
  visible: boolean;
22
26
  /** The function called when the Dialog is closed */
@@ -46,5 +50,5 @@ type DialogProps = {
46
50
  /** The `aria-label` of the dialog */
47
51
  'aria-label'?: string;
48
52
  } & WidthHeight & MaxWidthHeight & MinWidthHeight & Padding & DivAttributes;
49
- declare const Dialog: ({ header, text, children, cancelText, confirmText, negative, onConfirm, visible, width, height, onClose, closeIcon, preventOverlayClose, overlayBlur, overlayColor, backgroundColor, inert, scopeRef, position, zIndex, ...props }: DialogProps) => import("react/jsx-runtime").JSX.Element;
53
+ declare const Dialog: ({ header, text, children, cancelText, confirmText, negative, confirmDisabled, onConfirm, onCancel, visible, width, height, onClose, closeIcon, preventOverlayClose, overlayBlur, overlayColor, backgroundColor, inert, scopeRef, position, zIndex, ...props }: DialogProps) => import("react/jsx-runtime").JSX.Element;
50
54
  export default Dialog;
@@ -1,11 +1,11 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import styled from "@emotion/styled";
3
- import { Dialog, Modal, ModalOverlay } from "react-aria-components";
3
+ import { Dialog, Heading, Modal, ModalOverlay } from "react-aria-components";
4
4
  import Button from "./Button/index.js";
5
5
  import { maxWidthHeightProps, minWidthHeightProps, paddingProps } from "./helpers/styledProps.js";
6
6
  import Icon from "./Icon/index.js";
7
7
  import PortalScope from "./PortalScope.js";
8
- const Dialog_Dialog = ({ header, text, children, cancelText = 'Cancel', confirmText = 'Okay', negative, onConfirm, visible, width, height, onClose, closeIcon, preventOverlayClose, overlayBlur = true, overlayColor, backgroundColor, inert, scopeRef, position, zIndex, ...props })=>{
8
+ const Dialog_Dialog = ({ header, text, children, cancelText = 'Cancel', confirmText = 'Okay', negative, confirmDisabled, onConfirm, onCancel, visible, width, height, onClose, closeIcon, preventOverlayClose, overlayBlur = true, overlayColor, backgroundColor, inert, scopeRef, position, zIndex, ...props })=>{
9
9
  const { 'aria-label': ariaLabel, ...rest } = props;
10
10
  const handleOpenChange = (open)=>{
11
11
  if (!open) onClose();
@@ -36,6 +36,7 @@ const Dialog_Dialog = ({ header, text, children, cancelText = 'Cancel', confirmT
36
36
  ...rest,
37
37
  children: [
38
38
  /*#__PURE__*/ jsxs(DialogHeader, {
39
+ slot: "title",
39
40
  children: [
40
41
  header,
41
42
  closeIcon && /*#__PURE__*/ jsx(CloseInHeader, {
@@ -58,11 +59,12 @@ const Dialog_Dialog = ({ header, text, children, cancelText = 'Cancel', confirmT
58
59
  children: [
59
60
  /*#__PURE__*/ jsx(Button, {
60
61
  secondary: true,
61
- onClick: onClose,
62
+ onClick: onCancel || onClose,
62
63
  children: cancelText
63
64
  }),
64
65
  /*#__PURE__*/ jsx(Button, {
65
66
  negative: negative,
67
+ disabled: confirmDisabled,
66
68
  onClick: onConfirm,
67
69
  children: confirmText
68
70
  })
@@ -78,7 +80,7 @@ const Dialog_Dialog = ({ header, text, children, cancelText = 'Cancel', confirmT
78
80
  children: dialog
79
81
  }) : dialog;
80
82
  };
81
- const DialogHeader = styled.div(({ theme })=>({
83
+ const DialogHeader = styled(Heading)(({ theme })=>({
82
84
  display: 'flex',
83
85
  alignItems: 'center',
84
86
  justifyContent: 'space-between',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavv/ui",
3
- "version": "2.4.4-alpha.1",
3
+ "version": "2.4.4-alpha.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {