mcr-design-systems 1.0.29 → 1.0.30

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.
@@ -1,9 +1,9 @@
1
1
  import { jsxs as f, jsx as r } from "react/jsx-runtime";
2
- import { useState as i, useRef as C, useEffect as A } from "react";
3
- import { avatar as te, presenceBadge as re } from "./helper/variants.js";
2
+ import { useState as o, useRef as C, useEffect as A } from "react";
3
+ import { avatar as ee, presenceBadge as te } from "./helper/variants.js";
4
4
  import O from "../Icon/Icon.js";
5
5
  import { cn as x } from "../../shared/utils/cn.js";
6
- import ae from "../Loading/index.js";
6
+ import re from "../Loading/index.js";
7
7
  const d = {
8
8
  10: "text-[4.55px]",
9
9
  12: "text-[5.45px]",
@@ -23,10 +23,10 @@ const d = {
23
23
  88: "text-[40px]",
24
24
  128: "text-[58.18px]",
25
25
  160: "text-[72.73px]"
26
- }, se = 2 * 1024 * 1024, P = ["image/jpeg", "image/jpg", "image/png", "image/webp"], _ = "avatar-cache-v1", fe = ({
26
+ }, ae = 2 * 1024 * 1024, P = ["image/jpeg", "image/jpg", "image/png", "image/webp"], M = "avatar-cache-v1", me = ({
27
27
  src: s = "",
28
28
  size: c = 48,
29
- shape: M = "circle",
29
+ shape: _ = "circle",
30
30
  showPresence: $ = !1,
31
31
  presenceStatus: B = "available",
32
32
  alt: F = "",
@@ -45,32 +45,30 @@ const d = {
45
45
  overlapPrefix: y = "",
46
46
  ...p
47
47
  }) => {
48
- const [D, L] = i(!1), [R, u] = i(""), [a, l] = i(s || ""), [m, H] = i(""), [I, w] = i(!1), S = C(null), X = C(null);
49
- console.log("Avatar rendered with value:", D);
50
- const Y = async (e) => {
48
+ const [, L] = o(!1), [R, u] = o(""), [a, l] = o(s || ""), [m, D] = o(""), [I, w] = o(!1), S = C(null), H = C(null), X = async (e) => {
51
49
  try {
52
- const t = await caches.open(_);
50
+ const t = await caches.open(M);
53
51
  if (!await t.match(e)) {
54
- const o = await fetch(e, {
52
+ const i = await fetch(e, {
55
53
  mode: "cors",
56
54
  method: "GET",
57
55
  headers: { "Access-Control-Allow-Origin": "*" }
58
56
  });
59
- if (!o.ok)
60
- throw new Error(`Failed to fetch image: ${o.status}`);
61
- await t.put(e, o.clone());
57
+ if (!i.ok)
58
+ throw new Error(`Failed to fetch image: ${i.status}`);
59
+ await t.put(e, i.clone());
62
60
  }
63
61
  } catch {
64
62
  }
65
63
  };
66
64
  x();
67
- const q = async (e) => {
65
+ const Y = async (e) => {
68
66
  if (h) return null;
69
67
  try {
70
- const n = await (await caches.open(_)).match(e);
68
+ const n = await (await caches.open(M)).match(e);
71
69
  if (n) {
72
- const o = await n.blob();
73
- return URL.createObjectURL(o);
70
+ const i = await n.blob();
71
+ return URL.createObjectURL(i);
74
72
  }
75
73
  return null;
76
74
  } catch {
@@ -79,8 +77,8 @@ const d = {
79
77
  };
80
78
  A(() => {
81
79
  let e = null;
82
- return s && !h ? (Y(s), q(s).then((t) => {
83
- t ? (H(t), l(t), e = t) : l(s);
80
+ return s && !h ? (X(s), Y(s).then((t) => {
81
+ t ? (D(t), l(t), e = t) : l(s);
84
82
  })) : l(s || ""), () => {
85
83
  e && URL.revokeObjectURL(e);
86
84
  };
@@ -96,13 +94,13 @@ const d = {
96
94
  a.startsWith("blob:") && URL.revokeObjectURL(a);
97
95
  };
98
96
  }, [a, m]);
99
- const K = () => y || (j ? /* @__PURE__ */ r(
97
+ const q = () => y || (j ? /* @__PURE__ */ r(
100
98
  "span",
101
99
  {
102
100
  className: `flex h-full w-full items-center justify-center ${d[c ?? 48]}`,
103
101
  children: j
104
102
  }
105
- ) : g || v ? `${g?.[0] || ""}${v?.[0] || ""}`.toUpperCase() : s ? s[0]?.toUpperCase() : ""), Q = async (e) => {
103
+ ) : g || v ? `${g?.[0] || ""}${v?.[0] || ""}`.toUpperCase() : s ? s[0]?.toUpperCase() : ""), K = async (e) => {
106
104
  const t = e.target.files?.[0];
107
105
  if (!t) return;
108
106
  if (!P.includes(t.type)) {
@@ -111,7 +109,7 @@ const d = {
111
109
  );
112
110
  return;
113
111
  }
114
- if (t.size > se) {
112
+ if (t.size > ae) {
115
113
  u("Image is too large, must be no larger than 2 MB.");
116
114
  return;
117
115
  }
@@ -122,7 +120,7 @@ const d = {
122
120
  } finally {
123
121
  L(!1), n && URL.revokeObjectURL(n);
124
122
  }
125
- }, U = W && (b || T) && c >= 24, V = K(), z = c && c >= 24 && c <= 64, { id: ee } = "data-testid" in p ? p : { id: "avatar" }, k = {
123
+ }, U = W && (b || T) && c >= 24, Q = q(), V = c && c >= 24 && c <= 64, { id: z } = "data-testid" in p ? p : { id: "avatar" }, k = {
126
124
  10: "h-[0.625rem] w-[0.625rem]",
127
125
  // 10px
128
126
  12: "h-[0.75rem] w-[0.75rem]",
@@ -160,13 +158,13 @@ const d = {
160
158
  160: "h-[10rem] w-[10rem]"
161
159
  // 160px
162
160
  };
163
- return /* @__PURE__ */ f("div", { "data-testid": ee, className: "relative block w-fit", children: [
161
+ return /* @__PURE__ */ f("div", { "data-testid": z, className: "relative block w-fit", children: [
164
162
  /* @__PURE__ */ f("div", { className: x("w-fit overflow-hidden", k[c ?? 48]), children: [
165
163
  /* @__PURE__ */ f(
166
164
  "div",
167
165
  {
168
- className: te({
169
- shape: M,
166
+ className: ee({
167
+ shape: _,
170
168
  // type: previewSrc && !isImageError ? 'image' : 'initials',
171
169
  className: x(k[c ?? 48], G),
172
170
  bordered: a && !I ? !0 : J,
@@ -185,15 +183,15 @@ const d = {
185
183
  "div",
186
184
  {
187
185
  className: `flex h-full w-full items-center justify-center ${d[c ?? 48]}`,
188
- children: /* @__PURE__ */ r("div", { className: `${d[c ?? 48]} leading-none`, children: V })
186
+ children: /* @__PURE__ */ r("div", { className: `${d[c ?? 48]} leading-none`, children: Q })
189
187
  }
190
188
  ),
191
189
  U && !E && /* @__PURE__ */ r(
192
190
  "div",
193
191
  {
194
- ref: X,
192
+ ref: H,
195
193
  className: "absolute bottom-0 flex w-full cursor-pointer items-center justify-center bg-black-alpha-40",
196
- style: { color: "white", height: z ? "100%" : "24px" },
194
+ style: { color: "white", height: V ? "100%" : "24px" },
197
195
  onClick: () => a ? L(!0) : S.current?.click(),
198
196
  children: /* @__PURE__ */ r(
199
197
  O,
@@ -211,14 +209,14 @@ const d = {
211
209
  type: "file",
212
210
  accept: P.join(","),
213
211
  className: "hidden",
214
- onChange: Q
212
+ onChange: K
215
213
  }
216
214
  ),
217
- E && /* @__PURE__ */ r("div", { className: "absolute inset-0 flex items-center justify-center bg-bg-white", children: /* @__PURE__ */ r(ae, { thickness: 4, width: 20 }) })
215
+ E && /* @__PURE__ */ r("div", { className: "absolute inset-0 flex items-center justify-center bg-bg-white", children: /* @__PURE__ */ r(re, { thickness: 4, width: 20 }) })
218
216
  ]
219
217
  }
220
218
  ),
221
- $ && !U && /* @__PURE__ */ r("span", { className: re({ status: B }), children: /* @__PURE__ */ r("svg", { className: "h-2 w-2", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ r("circle", { cx: "10", cy: "10", r: "10" }) }) })
219
+ $ && !U && /* @__PURE__ */ r("span", { className: te({ status: B }), children: /* @__PURE__ */ r("svg", { className: "h-2 w-2", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ r("circle", { cx: "10", cy: "10", r: "10" }) }) })
222
220
  ] }),
223
221
  (R || N) && /* @__PURE__ */ f("div", { className: "mt-2 flex items-center gap-1", children: [
224
222
  /* @__PURE__ */ r(O, { name: "circle", color: "error" }),
@@ -227,5 +225,5 @@ const d = {
227
225
  ] });
228
226
  };
229
227
  export {
230
- fe as default
228
+ me as default
231
229
  };
@@ -0,0 +1,106 @@
1
+ import { tv as a } from "../../../node_modules/tailwind-variants/dist/index.js";
2
+ const t = a({
3
+ base: [
4
+ "bg-bg-card",
5
+ "border border-card",
6
+ "rounded-2xl",
7
+ "overflow-hidden",
8
+ "w-full",
9
+ "inline-flex",
10
+ "flex-col",
11
+ "justify-start",
12
+ "items-start"
13
+ ],
14
+ variants: {
15
+ variant: {
16
+ default: ["bg-bg-card", "border-neutral"],
17
+ elevated: ["bg-bg-card", "border-neutral", "shadow-300"],
18
+ outlined: ["bg-transparent", "border-neutral"]
19
+ }
20
+ },
21
+ defaultVariants: {
22
+ variant: "default"
23
+ }
24
+ }), s = a({
25
+ base: [
26
+ "self-stretch",
27
+ "min-h-16",
28
+ "px-sm",
29
+ "py-sm-2",
30
+ "border-b",
31
+ "border-card",
32
+ "flex",
33
+ "justify-between",
34
+ "items-center"
35
+ ],
36
+ variants: {
37
+ gap: {
38
+ xs: "gap-xs",
39
+ sm: "gap-sm",
40
+ md: "gap-md"
41
+ }
42
+ },
43
+ defaultVariants: {
44
+ gap: "xs"
45
+ }
46
+ }), r = a({
47
+ base: [
48
+ "self-stretch",
49
+ "flex",
50
+ "flex-col",
51
+ "justify-start",
52
+ "items-start"
53
+ ],
54
+ variants: {
55
+ padding: {
56
+ none: "p-0",
57
+ sm: "p-sm-2",
58
+ md: "p-sm",
59
+ lg: "p-md"
60
+ },
61
+ gap: {
62
+ none: "",
63
+ sm: "gap-xs",
64
+ md: "gap-sm",
65
+ lg: "gap-md"
66
+ }
67
+ },
68
+ defaultVariants: {
69
+ padding: "md",
70
+ gap: "md"
71
+ }
72
+ }), d = a({
73
+ base: [
74
+ "flex-1",
75
+ "min-h-10",
76
+ "flex",
77
+ "flex-col",
78
+ "justify-center",
79
+ "items-start",
80
+ "overflow-hidden"
81
+ ]
82
+ }), n = a({
83
+ base: [
84
+ "flex",
85
+ "justify-end",
86
+ "items-center",
87
+ "flex-shrink-0"
88
+ ],
89
+ variants: {
90
+ gap: {
91
+ xs: "gap-xs",
92
+ sm: "gap-sm-2",
93
+ md: "gap-sm"
94
+ }
95
+ },
96
+ defaultVariants: {
97
+ gap: "xs"
98
+ }
99
+ });
100
+ export {
101
+ r as cardContentVariants,
102
+ n as cardHeaderActionVariants,
103
+ d as cardHeaderTitleVariants,
104
+ s as cardHeaderVariants,
105
+ t as cardVariants
106
+ };
@@ -0,0 +1,58 @@
1
+ import { jsxs as t, jsx as r } from "react/jsx-runtime";
2
+ import "react";
3
+ import { cardHeaderVariants as x, cardHeaderTitleVariants as g, cardHeaderActionVariants as u, cardContentVariants as v, cardVariants as y } from "./helper/variants.js";
4
+ import { cn as N } from "../../shared/utils/cn.js";
5
+ import { dataTestId as h } from "../../shared/utils/dataTestId.js";
6
+ import { Typography as V } from "../Typography/index.js";
7
+ function w({
8
+ variant: i = "default",
9
+ title: e,
10
+ actionButton: s,
11
+ children: d,
12
+ className: m,
13
+ showHeader: c = !0,
14
+ headerGap: n = "xs",
15
+ contentPadding: o = "md",
16
+ contentGap: l = "md",
17
+ width: a,
18
+ ...p
19
+ }) {
20
+ const f = a ? { width: typeof a == "number" ? `${a}px` : a } : {};
21
+ return /* @__PURE__ */ t(
22
+ "div",
23
+ {
24
+ className: N(y({ variant: i }), m),
25
+ style: f,
26
+ ...h("Card"),
27
+ ...p,
28
+ children: [
29
+ c && (e || s) && /* @__PURE__ */ t("div", { className: x({ gap: n }), children: [
30
+ e && /* @__PURE__ */ r("div", { className: g(), children: /* @__PURE__ */ r(
31
+ V,
32
+ {
33
+ variants: "heading-xs",
34
+ size: "xs",
35
+ className: "self-stretch justify-center text-fg-neutral-main",
36
+ children: e
37
+ }
38
+ ) }),
39
+ s && /* @__PURE__ */ r("div", { className: u({ gap: "xs" }), children: s })
40
+ ] }),
41
+ d && /* @__PURE__ */ r(
42
+ "div",
43
+ {
44
+ className: v({
45
+ padding: o,
46
+ gap: l
47
+ }),
48
+ style: { wordWrap: "break-word", overflowWrap: "break-word" },
49
+ children: d
50
+ }
51
+ )
52
+ ]
53
+ }
54
+ );
55
+ }
56
+ export {
57
+ w as default
58
+ };
package/dist/index.d.ts CHANGED
@@ -77,5 +77,7 @@ export { default as Breadcrumb } from './components/Breadcrumb';
77
77
  export type { BreadcrumbProps, BreadcrumbItem, BreadcrumbSeparator, } from './components/Breadcrumb';
78
78
  export { default as Modal } from './components/Modal';
79
79
  export type { ModalProps } from './components/Modal';
80
+ export { default as Card } from './components/Card';
81
+ export type { CardProps } from './components/Card';
80
82
  export * from './tokens';
81
83
  export { dataTestId, generateTestId } from './shared/utils';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Alert as a } from "./components/Alert/index.js";
2
- import { default as f } from "./components/Button/index.js";
2
+ import { default as p } from "./components/Button/index.js";
3
3
  import { default as x } from "./components/ButtonFilter/index.js";
4
4
  import { default as d } from "./components/Avatar/index.js";
5
5
  import { default as l } from "./components/AvatarGroup/index.js";
@@ -7,7 +7,7 @@ import { default as n } from "./components/Loading/index.js";
7
7
  import { Box as c } from "./components/Box/index.js";
8
8
  import { default as P } from "./components/Divider/index.js";
9
9
  import { Popover as I } from "./components/Popover/index.js";
10
- import { Dropdown as C } from "./components/Dropdown/index.js";
10
+ import { Dropdown as v } from "./components/Dropdown/index.js";
11
11
  import { default as b } from "./components/Select/index.js";
12
12
  import { MenuItem as w } from "./components/MenuItem/index.js";
13
13
  import { Typography as S } from "./components/Typography/index.js";
@@ -23,14 +23,14 @@ import { default as X } from "./components/Tab/index.js";
23
23
  import { default as _ } from "./components/Chip/index.js";
24
24
  import { Tooltip as oo, TooltipProvider as ro } from "./components/Tooltip/index.js";
25
25
  import { default as to, DatePickerHeader as ao } from "./components/DatePicker/index.js";
26
- import { MonthGrid as fo } from "./components/DatePicker/MonthGrid.js";
26
+ import { MonthGrid as po } from "./components/DatePicker/MonthGrid.js";
27
27
  import { YearGrid as xo } from "./components/DatePicker/YearGrid.js";
28
28
  import { CalendarGrid as io } from "./components/DatePicker/CalendarGrid.js";
29
29
  import { DateRangePicker as uo } from "./components/DatePicker/DateRangePicker.js";
30
30
  import { default as To } from "./components/InputPassword/index.js";
31
31
  import { default as go } from "./components/InputDatePicker/index.js";
32
32
  import { default as ho } from "./components/TextField/index.js";
33
- import { default as vo } from "./components/InputNumber/index.js";
33
+ import { default as Co } from "./components/InputNumber/index.js";
34
34
  import { default as Bo } from "./components/TopNavigationBar/index.js";
35
35
  import { default as ko } from "./components/InputBase/index.js";
36
36
  import { default as Do } from "./components/CheckBox/index.js";
@@ -40,45 +40,47 @@ import { PIN as Vo } from "./components/PIN/index.js";
40
40
  import { ProgressBar as No } from "./components/ProgressBar/index.js";
41
41
  import { Breadcrumb as Ho } from "./components/Breadcrumb/index.js";
42
42
  import { default as Lo } from "./components/Modal/index.js";
43
- import { getColorVar as Yo, getSemanticColorVar as jo, getSpacingVar as qo } from "./tokens/index.js";
43
+ import { default as Yo } from "./components/Card/index.js";
44
+ import { getColorVar as qo, getSemanticColorVar as Eo, getSpacingVar as Jo } from "./tokens/index.js";
44
45
  import "clsx";
45
46
  import "tailwind-merge";
46
- import { dataTestId as Jo, generateTestId as Ko } from "./shared/utils/dataTestId.js";
47
- import { alphaColors as Qo, baseColors as Wo, colorScales as Xo, ringColors as Zo } from "./tokens/primitives/colors.js";
48
- import { typography as $o } from "./tokens/primitives/typography.js";
49
- import { borderRadius as rr, shadows as er, spacing as tr, transitions as ar, zIndex as pr } from "./tokens/primitives/layout.js";
50
- import { ThemeProvider as mr } from "./tokens/theme.js";
51
- import { useTheme as sr } from "./tokens/hooks.js";
52
- import { themeUtils as ir } from "./tokens/utils.js";
53
- import { generateTailwindConfig as ur } from "./tokens/tailwind-config.js";
54
- import { semanticTokens as Tr } from "./tokens/semantic.js";
47
+ import { dataTestId as Oo, generateTestId as Qo } from "./shared/utils/dataTestId.js";
48
+ import { alphaColors as Xo, baseColors as Zo, colorScales as _o, ringColors as $o } from "./tokens/primitives/colors.js";
49
+ import { typography as rr } from "./tokens/primitives/typography.js";
50
+ import { borderRadius as tr, shadows as ar, spacing as fr, transitions as pr, zIndex as mr } from "./tokens/primitives/layout.js";
51
+ import { ThemeProvider as sr } from "./tokens/theme.js";
52
+ import { useTheme as ir } from "./tokens/hooks.js";
53
+ import { themeUtils as ur } from "./tokens/utils.js";
54
+ import { generateTailwindConfig as Tr } from "./tokens/tailwind-config.js";
55
+ import { semanticTokens as gr } from "./tokens/semantic.js";
55
56
  export {
56
57
  a as Alert,
57
58
  d as Avatar,
58
59
  l as AvatarGroup,
59
60
  c as Box,
60
61
  Ho as Breadcrumb,
61
- f as Button,
62
+ p as Button,
62
63
  x as ButtonFilter,
63
64
  io as CalendarGrid,
65
+ Yo as Card,
64
66
  Do as CheckBox,
65
67
  _ as Chip,
66
68
  to as DatePicker,
67
69
  ao as DatePickerHeader,
68
70
  uo as DateRangePicker,
69
71
  P as Divider,
70
- C as Dropdown,
72
+ v as Dropdown,
71
73
  Go as HelperText,
72
74
  yo as Icons,
73
75
  A as Image,
74
76
  ko as InputBase,
75
77
  go as InputDatePicker,
76
- vo as InputNumber,
78
+ Co as InputNumber,
77
79
  To as InputPassword,
78
80
  n as Loading,
79
81
  w as MenuItem,
80
82
  Lo as Modal,
81
- fo as MonthGrid,
83
+ po as MonthGrid,
82
84
  Vo as PIN,
83
85
  z as PhoneInput,
84
86
  I as Popover,
@@ -90,7 +92,7 @@ export {
90
92
  K as Switch,
91
93
  X as Tabs,
92
94
  ho as TextField,
93
- mr as ThemeProvider,
95
+ sr as ThemeProvider,
94
96
  V as Toast,
95
97
  M as ToastAction,
96
98
  N as ToastClose,
@@ -101,24 +103,24 @@ export {
101
103
  Bo as TopNavigationBar,
102
104
  S as Typography,
103
105
  xo as YearGrid,
104
- Qo as alphaColors,
105
- Wo as baseColors,
106
- rr as borderRadius,
107
- Xo as colorScales,
108
- Jo as dataTestId,
109
- ur as generateTailwindConfig,
110
- Ko as generateTestId,
111
- Yo as getColorVar,
112
- jo as getSemanticColorVar,
113
- qo as getSpacingVar,
114
- Zo as ringColors,
115
- Tr as semanticTokens,
116
- er as shadows,
117
- tr as spacing,
118
- ir as themeUtils,
119
- ar as transitions,
120
- $o as typography,
121
- sr as useTheme,
106
+ Xo as alphaColors,
107
+ Zo as baseColors,
108
+ tr as borderRadius,
109
+ _o as colorScales,
110
+ Oo as dataTestId,
111
+ Tr as generateTailwindConfig,
112
+ Qo as generateTestId,
113
+ qo as getColorVar,
114
+ Eo as getSemanticColorVar,
115
+ Jo as getSpacingVar,
116
+ $o as ringColors,
117
+ gr as semanticTokens,
118
+ ar as shadows,
119
+ fr as spacing,
120
+ ur as themeUtils,
121
+ pr as transitions,
122
+ rr as typography,
123
+ ir as useTheme,
122
124
  j as useToast,
123
- pr as zIndex
125
+ mr as zIndex
124
126
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mcr-design-systems",
3
3
  "private": false,
4
- "version": "1.0.29",
4
+ "version": "1.0.30",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",