mcr-design-systems 1.0.6 → 1.0.7

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.
@@ -64,7 +64,7 @@ const r = e({
64
64
  "x-small": ["h-6", "text-xs", "rounded-sm"],
65
65
  small: ["h-8", "text-sm", "rounded-md"],
66
66
  medium: ["h-10", "text-sm", "rounded-lg"],
67
- large: ["h-12", "text-base", "rounded-xl"]
67
+ large: ["h-12", "text-base", "rounded-lg"]
68
68
  },
69
69
  spacing: {
70
70
  "xx-small": ["px-xs-3", "gap-xs-4"],
@@ -28,7 +28,6 @@ export declare const modal: import('tailwind-variants').TVReturnType<{
28
28
  header: string[];
29
29
  titleContainer: string[];
30
30
  title: string[];
31
- subtitle: string[];
32
31
  closeButton: string[];
33
32
  body: string[];
34
33
  footer: string[];
@@ -64,7 +63,6 @@ export declare const modal: import('tailwind-variants').TVReturnType<{
64
63
  header: string[];
65
64
  titleContainer: string[];
66
65
  title: string[];
67
- subtitle: string[];
68
66
  closeButton: string[];
69
67
  body: string[];
70
68
  footer: string[];
@@ -100,7 +98,6 @@ export declare const modal: import('tailwind-variants').TVReturnType<{
100
98
  header: string[];
101
99
  titleContainer: string[];
102
100
  title: string[];
103
- subtitle: string[];
104
101
  closeButton: string[];
105
102
  body: string[];
106
103
  footer: string[];
@@ -0,0 +1,62 @@
1
+ import { tv as e } from "../../../node_modules/tailwind-variants/dist/index.js";
2
+ const l = e({
3
+ slots: {
4
+ overlay: [
5
+ "fixed inset-0 z-modal flex items-center justify-center",
6
+ "bg-bg-surface-level-4 "
7
+ ],
8
+ content: [
9
+ "relative flex flex-col max-h-[90vh] w-full max-w-full",
10
+ "bg-bg-dialog shadow-300 rounded-lg border border-dialog",
11
+ "focus:outline-none"
12
+ ],
13
+ header: [
14
+ "flex items-center justify-between gap-xs px-sm py-sm-2 border-b border-neutral",
15
+ "shrink-0 h-[64px]"
16
+ ],
17
+ titleContainer: ["flex flex-col gap-1 flex-1 min-w-0"],
18
+ title: ["text-lg font-semibold text-fg-neutral-main leading-tight"],
19
+ closeButton: ["shrink-0"],
20
+ body: ["flex-1 overflow-y-auto relative p-4", "scroll-bar"],
21
+ footer: ["shrink-0 border-t border-neutral px-sm py-sm-2 h-[64px]"],
22
+ actionsContainer: ["flex items-center justify-end gap-2"],
23
+ loadingContainer: [
24
+ "flex flex-col items-center justify-center gap-3 py-8 bg-black/20 absolute w-full h-full z-100 left-0 top-0"
25
+ ]
26
+ },
27
+ variants: {
28
+ size: {
29
+ "xx-small": {
30
+ content: "w-[360px]"
31
+ },
32
+ "x-small": {
33
+ content: "w-[456px]"
34
+ },
35
+ small: {
36
+ content: "w-[552px]"
37
+ },
38
+ medium: {
39
+ content: "w-[744px]"
40
+ },
41
+ large: {
42
+ content: "w-[936px]"
43
+ }
44
+ },
45
+ variant: {
46
+ default: {},
47
+ body: {
48
+ overlay: [
49
+ "absolute inset-0 bg-black/20 backdrop-blur-none",
50
+ "flex items-center justify-center"
51
+ ]
52
+ }
53
+ }
54
+ },
55
+ defaultVariants: {
56
+ size: "medium",
57
+ variant: "default"
58
+ }
59
+ });
60
+ export {
61
+ l as modal
62
+ };
@@ -78,6 +78,7 @@ export interface ModalProps extends React.HTMLAttributes<HTMLDivElement>, Varian
78
78
  */
79
79
  footerClassName?: string;
80
80
  isProcessing?: boolean;
81
+ footer?: React.ReactNode;
81
82
  }
82
83
  /**
83
84
  * Modal component for displaying temporary information, forms, or confirmations
@@ -107,4 +108,4 @@ export interface ModalProps extends React.HTMLAttributes<HTMLDivElement>, Varian
107
108
  * </Modal>
108
109
  * ```
109
110
  */
110
- export default function Modal({ open, onClose, title, subtitle, children, actions, loading, submitting, closable, closeOnBackdropClick, closeOnEscape, size, className, contentClassName, bodyClassName, footerClassName, isProcessing, ...props }: ModalProps): import("react/jsx-runtime").JSX.Element | null;
111
+ export default function Modal({ open, onClose, title, subtitle, children, actions, loading, submitting, closable, closeOnBackdropClick, closeOnEscape, size, className, contentClassName, bodyClassName, footerClassName, isProcessing, footer, ...props }: ModalProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,152 @@
1
+ import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
+ import { useRef as s, useEffect as m } from "react";
3
+ import { modal as J } from "./helper/variants.js";
4
+ import { cn as a } from "../../shared/utils/cn.js";
5
+ import { dataTestId as K } from "../../shared/utils/dataTestId.js";
6
+ import f from "../Button/index.js";
7
+ import k from "../Loading/index.js";
8
+ import { Typography as O } from "../Typography/index.js";
9
+ function $({
10
+ open: i,
11
+ onClose: d,
12
+ title: C,
13
+ subtitle: N,
14
+ children: w,
15
+ actions: r,
16
+ loading: t = !1,
17
+ submitting: u = !1,
18
+ closable: x = !0,
19
+ closeOnBackdropClick: B = !0,
20
+ closeOnEscape: h = !0,
21
+ size: g = "medium",
22
+ className: E,
23
+ contentClassName: R,
24
+ bodyClassName: j,
25
+ footerClassName: v,
26
+ isProcessing: o,
27
+ footer: y,
28
+ ...L
29
+ }) {
30
+ const b = s(null), T = s(null), c = s(null), {
31
+ overlay: z,
32
+ content: D,
33
+ header: S,
34
+ titleContainer: I,
35
+ title: M,
36
+ closeButton: V,
37
+ body: q,
38
+ footer: p,
39
+ actionsContainer: A,
40
+ loadingContainer: F
41
+ } = J();
42
+ m(() => {
43
+ if (!i || !h) return;
44
+ const l = (H) => {
45
+ H.key === "Escape" && d();
46
+ };
47
+ return document.addEventListener("keydown", l), () => document.removeEventListener("keydown", l);
48
+ }, [i, h, d]), m(() => {
49
+ if (!i) return;
50
+ const l = window.getComputedStyle(document.body).overflow;
51
+ return document.body.style.overflow = "hidden", () => {
52
+ document.body.style.overflow = l;
53
+ };
54
+ }, [i]), m(() => {
55
+ t && i && c.current?.scrollTo({ top: 0, behavior: "instant" });
56
+ }, [t, i, c]);
57
+ const G = (l) => {
58
+ B && l.target === b.current && !u && d();
59
+ };
60
+ return i ? /* @__PURE__ */ e(
61
+ "div",
62
+ {
63
+ ref: b,
64
+ className: a(z(), E),
65
+ onClick: G,
66
+ ...K("modal"),
67
+ ...L,
68
+ children: /* @__PURE__ */ n(
69
+ "div",
70
+ {
71
+ ref: T,
72
+ className: a(D({ size: g }), R),
73
+ role: "dialog",
74
+ "aria-modal": "true",
75
+ "aria-labelledby": "modal-title",
76
+ "aria-describedby": N ? "modal-subtitle" : void 0,
77
+ children: [
78
+ /* @__PURE__ */ n("div", { className: S(), children: [
79
+ /* @__PURE__ */ e("div", { className: I(), children: /* @__PURE__ */ e(
80
+ O,
81
+ {
82
+ id: "modal-title",
83
+ variants: "heading-xs",
84
+ size: "xs",
85
+ className: M(),
86
+ children: C
87
+ }
88
+ ) }),
89
+ x && /* @__PURE__ */ e(
90
+ f,
91
+ {
92
+ variant: "outline",
93
+ size: "medium",
94
+ iconOnly: !0,
95
+ icon: "x-close",
96
+ onClick: d,
97
+ disabled: u,
98
+ className: V(),
99
+ "aria-label": "Close modal"
100
+ }
101
+ )
102
+ ] }),
103
+ /* @__PURE__ */ n(
104
+ "div",
105
+ {
106
+ ref: c,
107
+ className: a(q(), j, {
108
+ "overflow-hidden": t
109
+ }),
110
+ children: [
111
+ t && /* @__PURE__ */ e("div", { className: F(), children: /* @__PURE__ */ e("div", { className: "w-[44px] h-[44px] p-sm-2 bg-neutral-700 rounded-lg flex items-center justify-center", children: /* @__PURE__ */ e(k, { width: 20, thickness: 3 }) }) }),
112
+ w
113
+ ]
114
+ }
115
+ ),
116
+ r && /* @__PURE__ */ e("div", { className: a(p(), v), children: /* @__PURE__ */ e("div", { className: A(), children: /* @__PURE__ */ n("div", { className: "flex gap-3", children: [
117
+ /* @__PURE__ */ e(
118
+ f,
119
+ {
120
+ disabled: r.cancelBtn?.isDisabled || o,
121
+ variant: "outline",
122
+ onClick: (l) => {
123
+ l.stopPropagation(), r.cancelBtn?.onClick?.();
124
+ },
125
+ children: r.cancelBtn?.label || "Cancel"
126
+ }
127
+ ),
128
+ /* @__PURE__ */ n(
129
+ f,
130
+ {
131
+ disabled: r.confirmBtn?.isDisabled || o || t,
132
+ variant: r?.confirmBtn?.isConfirm ? "danger" : "primary",
133
+ onClick: (l) => {
134
+ l.stopPropagation(), r.confirmBtn?.onClick?.();
135
+ },
136
+ children: [
137
+ r.confirmBtn?.label || "Confirm",
138
+ o && /* @__PURE__ */ e(k, { width: 16, thickness: 2 })
139
+ ]
140
+ }
141
+ )
142
+ ] }) }) }),
143
+ y && /* @__PURE__ */ e("div", { className: a(p(), v), children: y })
144
+ ]
145
+ }
146
+ )
147
+ }
148
+ ) : null;
149
+ }
150
+ export {
151
+ $ as default
152
+ };
@@ -4,13 +4,13 @@ const s = e(
4
4
  base: "font-primary",
5
5
  variants: {
6
6
  variants: {
7
- display: "font-semibold",
8
- "heading-xs": "font-bold",
9
- "heading-sm": "font-bold",
10
- "heading-md": "font-bold",
11
- "heading-lg": "font-bold",
12
- "heading-xl": "font-bold",
13
- "heading-2xl": "font-bold",
7
+ display: "font-bold",
8
+ "heading-xs": "",
9
+ "heading-sm": "",
10
+ "heading-md": "",
11
+ "heading-lg": "",
12
+ "heading-xl": "",
13
+ "heading-2xl": "",
14
14
  label: "font-medium",
15
15
  paragraph: "font-regular",
16
16
  body: "font-regular",
@@ -301,32 +301,32 @@ const s = e(
301
301
  {
302
302
  variants: "heading-xs",
303
303
  size: "xs",
304
- className: "text-heading-xs font-heading-xs leading-heading-xs"
304
+ className: "text-heading-xs font-heading-xs leading-heading-xs font-semibold"
305
305
  },
306
306
  {
307
307
  variants: "heading-sm",
308
308
  size: "sm",
309
- className: "text-heading-sm font-heading-sm leading-heading-sm"
309
+ className: "text-heading-sm font-heading-sm leading-heading-sm font-semibold"
310
310
  },
311
311
  {
312
312
  variants: "heading-md",
313
313
  size: "md",
314
- className: "text-heading-md font-heading-md leading-heading-md"
314
+ className: "text-heading-md font-heading-md leading-heading-md font-semibold"
315
315
  },
316
316
  {
317
317
  variants: "heading-lg",
318
318
  size: "lg",
319
- className: "text-heading-lg font-heading-lg leading-heading-lg"
319
+ className: "text-heading-lg font-heading-lg leading-heading-lg font-bold"
320
320
  },
321
321
  {
322
322
  variants: "heading-xl",
323
323
  size: "xl",
324
- className: "text-heading-xl font-heading-xl leading-heading-xl"
324
+ className: "text-heading-xl font-heading-xl leading-heading-xl font-bold"
325
325
  },
326
326
  {
327
327
  variants: "heading-2xl",
328
328
  size: "2xl",
329
- className: "text-heading-2xl font-heading-2xl leading-heading-2xl"
329
+ className: "text-heading-2xl font-heading-2xl leading-heading-2xl font-bold"
330
330
  },
331
331
  // Display variants
332
332
  {
package/dist/index.d.ts CHANGED
@@ -65,5 +65,7 @@ export { default as ProgressBar } from './components/ProgressBar';
65
65
  export type { ProgressBarProps, ProgressBarValue, } from './components/ProgressBar';
66
66
  export { default as Breadcrumb } from './components/Breadcrumb';
67
67
  export type { BreadcrumbProps, BreadcrumbItem, BreadcrumbSeparator, } from './components/Breadcrumb';
68
+ export { default as Modal } from './components/Modal';
69
+ export type { ModalProps } from './components/Modal';
68
70
  export * from './tokens';
69
71
  export { dataTestId, generateTestId } from './shared/utils';
package/dist/index.js CHANGED
@@ -34,18 +34,19 @@ import { default as Io } from "./components/Icon/Icon.js";
34
34
  import { PIN as wo } from "./components/PIN/index.js";
35
35
  import { ProgressBar as Do } from "./components/ProgressBar/index.js";
36
36
  import { Breadcrumb as bo } from "./components/Breadcrumb/index.js";
37
- import { getColorVar as yo, getSemanticColorVar as Ao, getSpacingVar as Go } from "./tokens/index.js";
37
+ import { default as yo } from "./components/Modal/index.js";
38
+ import { getColorVar as Go, getSemanticColorVar as Ro, getSpacingVar as Vo } from "./tokens/index.js";
38
39
  import "clsx";
39
40
  import "tailwind-merge";
40
- import { dataTestId as Vo, generateTestId as Mo } from "./shared/utils/dataTestId.js";
41
- import { alphaColors as zo, baseColors as Fo, colorScales as Ho, ringColors as Lo } from "./tokens/primitives/colors.js";
42
- import { typography as Yo } from "./tokens/primitives/typography.js";
43
- import { borderRadius as qo, shadows as Eo, spacing as Jo, transitions as Ko, zIndex as Oo } from "./tokens/primitives/layout.js";
44
- import { ThemeProvider as Wo } from "./tokens/theme.js";
45
- import { useTheme as Zo } from "./tokens/hooks.js";
46
- import { themeUtils as $o } from "./tokens/utils.js";
47
- import { generateTailwindConfig as rr } from "./tokens/tailwind-config.js";
48
- import { semanticTokens as tr } from "./tokens/semantic.js";
41
+ import { dataTestId as No, generateTestId as zo } from "./shared/utils/dataTestId.js";
42
+ import { alphaColors as Ho, baseColors as Lo, colorScales as Uo, ringColors as Yo } from "./tokens/primitives/colors.js";
43
+ import { typography as qo } from "./tokens/primitives/typography.js";
44
+ import { borderRadius as Jo, shadows as Ko, spacing as Oo, transitions as Qo, zIndex as Wo } from "./tokens/primitives/layout.js";
45
+ import { ThemeProvider as Zo } from "./tokens/theme.js";
46
+ import { useTheme as $o } from "./tokens/hooks.js";
47
+ import { themeUtils as rr } from "./tokens/utils.js";
48
+ import { generateTailwindConfig as tr } from "./tokens/tailwind-config.js";
49
+ import { semanticTokens as pr } from "./tokens/semantic.js";
49
50
  export {
50
51
  a as Alert,
51
52
  d as Avatar,
@@ -67,6 +68,7 @@ export {
67
68
  To as InputPassword,
68
69
  u as Loading,
69
70
  S as MenuItem,
71
+ yo as Modal,
70
72
  fo as MonthGrid,
71
73
  wo as PIN,
72
74
  H as PhoneInput,
@@ -78,7 +80,7 @@ export {
78
80
  Q as Sidebar,
79
81
  K as Switch,
80
82
  X as Tabs,
81
- Wo as ThemeProvider,
83
+ Zo as ThemeProvider,
82
84
  V as Toast,
83
85
  M as ToastAction,
84
86
  N as ToastClose,
@@ -89,24 +91,24 @@ export {
89
91
  ho as TopNavigationBar,
90
92
  k as Typography,
91
93
  so as YearGrid,
92
- zo as alphaColors,
93
- Fo as baseColors,
94
- qo as borderRadius,
95
- Ho as colorScales,
96
- Vo as dataTestId,
97
- rr as generateTailwindConfig,
98
- Mo as generateTestId,
99
- yo as getColorVar,
100
- Ao as getSemanticColorVar,
101
- Go as getSpacingVar,
102
- Lo as ringColors,
103
- tr as semanticTokens,
104
- Eo as shadows,
105
- Jo as spacing,
106
- $o as themeUtils,
107
- Ko as transitions,
108
- Yo as typography,
109
- Zo as useTheme,
94
+ Ho as alphaColors,
95
+ Lo as baseColors,
96
+ Jo as borderRadius,
97
+ Uo as colorScales,
98
+ No as dataTestId,
99
+ tr as generateTailwindConfig,
100
+ zo as generateTestId,
101
+ Go as getColorVar,
102
+ Ro as getSemanticColorVar,
103
+ Vo as getSpacingVar,
104
+ Yo as ringColors,
105
+ pr as semanticTokens,
106
+ Ko as shadows,
107
+ Oo as spacing,
108
+ rr as themeUtils,
109
+ Qo as transitions,
110
+ qo as typography,
111
+ $o as useTheme,
110
112
  j as useToast,
111
- Oo as zIndex
113
+ Wo as zIndex
112
114
  };
@@ -1,5 +1,5 @@
1
1
  import { generateTailwindConfig as i } from "./tokens/tailwind-config.js";
2
- const o = i();
2
+ const o = i({});
3
3
  export {
4
4
  o as default
5
5
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mcr-design-systems",
3
3
  "private": false,
4
- "version": "1.0.6",
4
+ "version": "1.0.7",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",