@phillips/seldon 1.167.0 → 1.168.0

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.
@@ -28,6 +28,14 @@ export interface ModalProps extends React.HTMLAttributes<HTMLDivElement>, Dialog
28
28
  * Content label for accessibility
29
29
  */
30
30
  contentLabel?: string;
31
+ /**
32
+ * Custom close icon
33
+ */
34
+ closeIcon?: React.ReactElement;
35
+ /**
36
+ * Position of the close icon
37
+ */
38
+ closeIconPosition?: 'left' | 'right';
31
39
  }
32
40
  /**
33
41
  * ## Overview
@@ -1,51 +1,64 @@
1
- import { jsx as o, jsxs as e } from "react/jsx-runtime";
2
- import r from "../../node_modules/classnames/index.js";
3
- import { getCommonProps as C, noOp as y } from "../../utils/index.js";
4
- import N from "../Icon/Icon.js";
5
- import M from "../IconButton/IconButton.js";
1
+ import { jsx as o, jsxs as r } from "react/jsx-runtime";
2
+ import t from "../../node_modules/classnames/index.js";
3
+ import { getCommonProps as N, noOp as _ } from "../../utils/index.js";
4
+ import M from "../Icon/Icon.js";
5
+ import g from "../IconButton/IconButton.js";
6
6
  import { ButtonVariants as v } from "../Button/types.js";
7
- import { Root as _, Portal as b, Overlay as g, Content as x, Title as I, Description as O, Close as P } from "../../node_modules/@radix-ui/react-dialog/dist/index.js";
8
- import { VisuallyHidden as j } from "../../node_modules/@radix-ui/react-visually-hidden/dist/index.js";
9
- import { forwardRef as w } from "react";
10
- const B = w(
11
- ({ children: l, className: i, overlayClassName: s, isOpen: m = !1, onClose: d = y, style: n, contentLabel: c, ...t }, p) => {
12
- const { className: a, "data-testid": f, ...h } = C(t, "Modal");
7
+ import { Root as b, Portal as x, Overlay as I, Content as O, Title as P, Description as $, Close as j } from "../../node_modules/@radix-ui/react-dialog/dist/index.js";
8
+ import { VisuallyHidden as w } from "../../node_modules/@radix-ui/react-visually-hidden/dist/index.js";
9
+ import { forwardRef as B } from "react";
10
+ const R = B(
11
+ ({
12
+ children: l,
13
+ className: i,
14
+ overlayClassName: s,
15
+ isOpen: m = !1,
16
+ onClose: d = _,
17
+ style: n,
18
+ contentLabel: c,
19
+ closeIcon: f = /* @__PURE__ */ o(M, { icon: "CloseX", height: 32, width: 32, color: "currentColor" }),
20
+ closeIconPosition: p = "right",
21
+ ...e
22
+ }, h) => {
23
+ const { className: a, "data-testid": u, ...C } = N(e, "Modal");
13
24
  return /* @__PURE__ */ o(
14
- _,
25
+ b,
15
26
  {
16
27
  open: m,
17
- onOpenChange: (u) => {
18
- u || d();
28
+ onOpenChange: (y) => {
29
+ y || d();
19
30
  },
20
- children: /* @__PURE__ */ e(b, { children: [
31
+ children: /* @__PURE__ */ r(x, { children: [
21
32
  /* @__PURE__ */ o(
22
- g,
33
+ I,
23
34
  {
24
- className: r(`${a}__overlay`, s),
35
+ className: t(`${a}__overlay`, s),
25
36
  "data-testid": "modal-overlay"
26
37
  }
27
38
  ),
28
- /* @__PURE__ */ e(
29
- x,
39
+ /* @__PURE__ */ r(
40
+ O,
30
41
  {
31
- ref: p,
32
- className: r(a, i),
33
- "data-testid": f,
42
+ ref: h,
43
+ className: t(a, i),
44
+ "data-testid": u,
34
45
  "aria-modal": "true",
35
46
  style: n,
36
- ...h,
37
- ...t,
47
+ ...C,
48
+ ...e,
38
49
  children: [
39
- /* @__PURE__ */ o(j, { asChild: !0, children: /* @__PURE__ */ o(I, { children: c ?? "Modal" }) }),
40
- /* @__PURE__ */ o(O, {}),
41
- /* @__PURE__ */ o(P, { asChild: !0, children: /* @__PURE__ */ o(
42
- M,
50
+ /* @__PURE__ */ o(w, { asChild: !0, children: /* @__PURE__ */ o(P, { children: c ?? "Modal" }) }),
51
+ /* @__PURE__ */ o($, {}),
52
+ /* @__PURE__ */ o(j, { asChild: !0, children: /* @__PURE__ */ o(
53
+ g,
43
54
  {
44
55
  id: "modal-close-button",
45
56
  "aria-label": "Close Modal",
46
- className: r(`${a}__close`),
57
+ className: t(`${a}__close`, {
58
+ [`${a}__close--left`]: p === "left"
59
+ }),
47
60
  variant: v.tertiary,
48
- children: /* @__PURE__ */ o(N, { icon: "CloseX", height: 32, width: 32, color: "currentColor" })
61
+ children: f
49
62
  }
50
63
  ) }),
51
64
  l
@@ -57,7 +70,7 @@ const B = w(
57
70
  );
58
71
  }
59
72
  );
60
- B.displayName = "Modal";
73
+ R.displayName = "Modal";
61
74
  export {
62
- B as default
75
+ R as default
63
76
  };
@@ -10,3 +10,4 @@ export declare const Playground: {
10
10
  };
11
11
  };
12
12
  export declare const ModalFromDrawer: () => import("react/jsx-runtime").JSX.Element;
13
+ export declare const CustomCloseIcon: () => import("react/jsx-runtime").JSX.Element;
@@ -12,6 +12,11 @@
12
12
  transform: translate(-50%, -50%);
13
13
  z-index: 30;
14
14
 
15
+ &__close--left {
16
+ left: 0.4rem;
17
+ right: auto;
18
+ }
19
+
15
20
  &__overlay {
16
21
  background-color: $overlay-black;
17
22
  inset: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.167.0",
3
+ "version": "1.168.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"