@pibit.ai/cure-design-system 0.6.33 → 0.6.35

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.
@@ -26,8 +26,10 @@ export interface ConfirmDialogProps {
26
26
  testIdPrefix?: string;
27
27
  /** When false, neither overlay clicks nor Escape close the dialog. Default true. */
28
28
  isDismissable?: boolean;
29
+ /** When true, clicks on this dialog won't trigger parent ClickAwayListener handlers. */
30
+ ignoreClickAway?: boolean;
29
31
  /** Lands on the dialog element, as in {@link ModalWrapper}. */
30
32
  "data-testid"?: string;
31
33
  }
32
- export declare const ConfirmDialog: ({ isOpen, onClose, title, description, confirmLabel, cancelLabel, onConfirm, isLoading, tone, icon, secondaryAction, testIdPrefix, isDismissable, "data-testid": dataTestId, }: ConfirmDialogProps) => import("react/jsx-runtime").JSX.Element;
34
+ export declare const ConfirmDialog: ({ isOpen, onClose, title, description, confirmLabel, cancelLabel, onConfirm, isLoading, tone, icon, secondaryAction, testIdPrefix, isDismissable, ignoreClickAway, "data-testid": dataTestId, }: ConfirmDialogProps) => import("react/jsx-runtime").JSX.Element;
33
35
  //# sourceMappingURL=confirm-dialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"confirm-dialog.d.ts","sourceRoot":"","sources":["../../../src/patterns/confirm-dialog/confirm-dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAgBvC,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,SAAS,GAAG,SAAS,CAAC;AA0BtE,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,2EAA2E;IAC3E,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,KAAK,EAAE,MAAM,CA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;IACrB,SAAS,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,uEAAuE;IACvE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uEAAuE;IACvE,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,kEAAkE;IAClE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,6EAA6E;IAC7E,eAAe,CAAC,EAAE,4BAA4B,CAAC;IAC/C,sFAAsF;IACtF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,wFAAwF;IACxF,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,aAAa,GAAI,iMAgB3B,kBAAkB,4CA+FpB,CAAC"}
@@ -1,30 +1,30 @@
1
- import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
- import { useRef as I, useEffect as j } from "react";
3
- import { InfoCircle as q, AlertTriangle as A, AlertCircle as F, XClose as R } from "@untitledui/icons";
4
- import { ButtonUtility as $ } from "../../primitives/button/button-utility.js";
1
+ import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
+ import { useRef as j, useEffect as q } from "react";
3
+ import { InfoCircle as A, AlertTriangle as F, AlertCircle as R, XClose as $ } from "@untitledui/icons";
4
+ import { ButtonUtility as E } from "../../primitives/button/button-utility.js";
5
5
  import { cx as b } from "../../utils/cn.js";
6
- import { ModalWrapper as E } from "../modal/modal-wrapper.js";
6
+ import { ModalWrapper as M } from "../modal/modal-wrapper.js";
7
7
  import { Button as c } from "../../primitives/button/button.js";
8
- const M = {
8
+ const S = {
9
9
  destructive: {
10
- Icon: F,
10
+ Icon: R,
11
11
  iconBox: "bg-warning-secondary",
12
12
  icon: "text-featured-icon-light-fg-warning",
13
13
  confirmColor: "primary-destructive"
14
14
  },
15
15
  warning: {
16
- Icon: A,
16
+ Icon: F,
17
17
  iconBox: "bg-warning-secondary",
18
18
  icon: "text-fg-warning-primary",
19
19
  confirmColor: "primary"
20
20
  },
21
21
  primary: {
22
- Icon: q,
22
+ Icon: A,
23
23
  iconBox: "bg-brand-secondary",
24
24
  icon: "text-fg-brand-secondary",
25
25
  confirmColor: "primary"
26
26
  }
27
- }, J = ({
27
+ }, K = ({
28
28
  isOpen: a,
29
29
  onClose: n,
30
30
  title: s,
@@ -35,93 +35,104 @@ const M = {
35
35
  isLoading: r = !1,
36
36
  tone: m = "primary",
37
37
  icon: v,
38
- secondaryAction: o,
38
+ secondaryAction: i,
39
39
  testIdPrefix: f,
40
40
  isDismissable: N = !0,
41
- "data-testid": w
41
+ ignoreClickAway: w = !1,
42
+ "data-testid": D
42
43
  }) => {
43
- const { Icon: z, iconBox: B, icon: D, confirmColor: k } = M[m], t = (l) => f ? `${f}-${l}` : void 0, x = () => n(!1), u = I(null);
44
- return j(() => {
44
+ const { Icon: z, iconBox: B, icon: k, confirmColor: I } = S[m], t = (l) => f ? `${f}-${l}` : void 0, x = () => n(!1), u = j(null);
45
+ return q(() => {
45
46
  if (!a) return;
46
47
  const l = requestAnimationFrame(() => {
47
48
  var p, y;
48
49
  (y = (p = u.current) == null ? void 0 : p.querySelector("[data-confirm-dialog-cancel]")) == null || y.focus();
49
50
  });
50
51
  return () => cancelAnimationFrame(l);
51
- }, [a]), /* @__PURE__ */ e(E, { isOpen: a, onClose: n, isDismissable: N, "data-testid": w, children: /* @__PURE__ */ i(
52
- "div",
52
+ }, [a]), /* @__PURE__ */ e(
53
+ M,
53
54
  {
54
- ref: u,
55
- className: b(
56
- "relative max-w-[90vw] rounded-2xl bg-primary p-5",
57
- o ? "w-[520px]" : "w-[400px]"
58
- ),
59
- children: [
60
- /* @__PURE__ */ e(
61
- $,
62
- {
63
- color: "tertiary",
64
- className: "absolute right-2 top-2",
65
- icon: /* @__PURE__ */ e(R, { size: 24 }),
66
- isDisabled: r,
67
- onClick: x,
68
- "data-testid": t("close")
69
- }
70
- ),
71
- /* @__PURE__ */ i("div", { className: "flex flex-col gap-5", children: [
72
- /* @__PURE__ */ e("div", { className: b("flex size-12 shrink-0 items-center justify-center rounded-xl p-3", B), children: v ?? /* @__PURE__ */ e(z, { size: 24, "aria-label": s, className: D }) }),
73
- /* @__PURE__ */ i("div", { className: "flex flex-col gap-2", children: [
74
- /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-primary", children: s }),
75
- d != null && /* @__PURE__ */ e("div", { className: "text-sm leading-6 text-tertiary", children: d })
76
- ] }),
77
- /* @__PURE__ */ i("div", { className: "flex gap-3", children: [
55
+ isOpen: a,
56
+ onClose: n,
57
+ isDismissable: N && !r,
58
+ ignoreClickAway: w,
59
+ "data-testid": D,
60
+ children: /* @__PURE__ */ o(
61
+ "div",
62
+ {
63
+ ref: u,
64
+ className: b(
65
+ "relative max-w-[90vw] rounded-2xl bg-primary p-5",
66
+ i ? "w-[520px]" : "w-[400px]"
67
+ ),
68
+ children: [
78
69
  /* @__PURE__ */ e(
79
- c,
70
+ E,
80
71
  {
81
- type: "button",
82
- size: "md",
83
- color: "secondary",
84
- className: "flex-1",
72
+ color: "tertiary",
73
+ className: "absolute right-2 top-2",
74
+ icon: /* @__PURE__ */ e($, { size: 24 }),
85
75
  isDisabled: r,
86
76
  onClick: x,
87
- "data-testid": t("cancel"),
88
- "data-confirm-dialog-cancel": !0,
89
- children: h
90
- }
91
- ),
92
- o && /* @__PURE__ */ e(
93
- c,
94
- {
95
- type: "button",
96
- size: "md",
97
- color: "secondary",
98
- className: "flex-1",
99
- isDisabled: r,
100
- onClick: o.onAction,
101
- "data-testid": t("secondary"),
102
- children: o.label
77
+ "data-testid": t("close")
103
78
  }
104
79
  ),
105
- /* @__PURE__ */ e(
106
- c,
107
- {
108
- type: "button",
109
- size: "md",
110
- color: k,
111
- className: "flex-1",
112
- isLoading: r,
113
- isDisabled: r,
114
- onClick: () => void C(),
115
- "data-testid": t("submit"),
116
- children: g ?? (m === "destructive" ? "Delete" : "Confirm")
117
- }
118
- )
119
- ] })
120
- ] })
121
- ]
80
+ /* @__PURE__ */ o("div", { className: "flex flex-col gap-5", children: [
81
+ /* @__PURE__ */ e("div", { className: b("flex size-12 shrink-0 items-center justify-center rounded-xl p-3", B), children: v ?? /* @__PURE__ */ e(z, { size: 24, "aria-label": s, className: k }) }),
82
+ /* @__PURE__ */ o("div", { className: "flex flex-col gap-2", children: [
83
+ /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-primary", children: s }),
84
+ d != null && /* @__PURE__ */ e("div", { className: "text-sm leading-6 text-tertiary", children: d })
85
+ ] }),
86
+ /* @__PURE__ */ o("div", { className: "flex gap-3", children: [
87
+ /* @__PURE__ */ e(
88
+ c,
89
+ {
90
+ type: "button",
91
+ size: "md",
92
+ color: "secondary",
93
+ className: "flex-1",
94
+ isDisabled: r,
95
+ onClick: x,
96
+ "data-testid": t("cancel"),
97
+ "data-confirm-dialog-cancel": !0,
98
+ children: h
99
+ }
100
+ ),
101
+ i && /* @__PURE__ */ e(
102
+ c,
103
+ {
104
+ type: "button",
105
+ size: "md",
106
+ color: "secondary",
107
+ className: "flex-1",
108
+ isDisabled: r,
109
+ onClick: i.onAction,
110
+ "data-testid": t("secondary"),
111
+ children: i.label
112
+ }
113
+ ),
114
+ /* @__PURE__ */ e(
115
+ c,
116
+ {
117
+ type: "button",
118
+ size: "md",
119
+ color: I,
120
+ className: "flex-1",
121
+ isLoading: r,
122
+ isDisabled: r,
123
+ onClick: () => void C(),
124
+ "data-testid": t("submit"),
125
+ children: g ?? (m === "destructive" ? "Delete" : "Confirm")
126
+ }
127
+ )
128
+ ] })
129
+ ] })
130
+ ]
131
+ }
132
+ )
122
133
  }
123
- ) });
134
+ );
124
135
  };
125
136
  export {
126
- J as ConfirmDialog
137
+ K as ConfirmDialog
127
138
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pibit.ai/cure-design-system",
3
- "version": "0.6.33",
3
+ "version": "0.6.35",
4
4
  "description": "CURE Design System - React component library",
5
5
  "author": "Pibit",
6
6
  "license": "MIT",