mcr-design-systems 1.0.212 → 1.0.213
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.
- package/dist/components/Avatar/helper/variants.js +1 -1
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Avatar/index.js +125 -113
- package/dist/components/Button/index.js +0 -1
- package/dist/components/ButtonFilter/index.js +0 -1
- package/dist/components/Dropdown/index.js +193 -178
- package/dist/components/Icon/generated/ImagePlusIcon.d.ts +38 -0
- package/dist/components/Icon/generated/ImagePlusIcon.js +54 -0
- package/dist/components/Icon/generated/ImagePlusSolidIcon.d.ts +38 -0
- package/dist/components/Icon/generated/ImagePlusSolidIcon.js +56 -0
- package/dist/components/Icon/helper/index.d.ts +1 -1
- package/dist/components/Icon/helper/mapicon.js +3 -1
- package/dist/components/InputBase/index.js +88 -94
- package/dist/components/InputBase/variants.d.ts +2 -2
- package/dist/components/InputBase/variants.js +7 -7
- package/dist/components/Select/index.js +161 -156
- package/dist/components/TextField/index.d.ts +2 -0
- package/dist/components/TextField/index.js +38 -32
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +1 -1
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +238 -236
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js +3 -1
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +56 -57
- package/dist/node_modules/@radix-ui/react-popover/dist/index.js +6 -7
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js +50 -49
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-toast/dist/index.js +9 -15
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +7 -8
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +195 -170
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +25 -25
- package/dist/node_modules/libphonenumber-js/es6/AsYouType.js +115 -99
- package/dist/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.PatternMatcher.js +88 -69
- package/dist/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.PatternParser.js +79 -58
- package/dist/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.complete.js +10 -10
- package/dist/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.js +83 -66
- package/dist/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.util.js +27 -29
- package/dist/node_modules/libphonenumber-js/es6/AsYouTypeParser.js +134 -115
- package/dist/node_modules/libphonenumber-js/es6/AsYouTypeState.js +47 -26
- package/dist/node_modules/libphonenumber-js/es6/PhoneNumber.js +62 -41
- package/dist/node_modules/libphonenumber-js/es6/format.js +70 -105
- package/dist/node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js +11 -9
- package/dist/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js +20 -20
- package/dist/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +14 -14
- package/dist/node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js +20 -16
- package/dist/node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js +3 -4
- package/dist/node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js +26 -30
- package/dist/node_modules/libphonenumber-js/es6/helpers/getNumberType.js +15 -17
- package/dist/node_modules/libphonenumber-js/es6/helpers/parseDigits.js +23 -25
- package/dist/node_modules/libphonenumber-js/es6/isPossible.js +4 -13
- package/dist/node_modules/libphonenumber-js/es6/metadata.js +79 -66
- package/dist/node_modules/libphonenumber-js/examples.mobile.json.js +1 -1
- package/dist/node_modules/libphonenumber-js/metadata.min.json.js +1 -1
- package/dist/node_modules/lucide-react/dist/esm/Icon.js +0 -6
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.js +0 -6
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.js +0 -6
- package/dist/node_modules/lucide-react/dist/esm/icons/x.js +0 -6
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.js +0 -6
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +75 -72
- package/dist/tokens/tailwind-config.js +45 -45
- package/package.json +1 -1
|
@@ -32,6 +32,8 @@ export interface AvatarProps extends React.HTMLAttributes<HTMLDivElement>, Varia
|
|
|
32
32
|
containerClassName?: string;
|
|
33
33
|
outerClassName?: string;
|
|
34
34
|
showHelperTextIcon?: boolean;
|
|
35
|
+
shouldShowPlaceholderIconUpload?: boolean;
|
|
36
|
+
shouldShowDropdownForOptions?: boolean;
|
|
35
37
|
}
|
|
36
38
|
declare const Avatar: React.FC<AvatarProps>;
|
|
37
39
|
export default Avatar;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsxs as N, jsx as t, Fragment as
|
|
2
|
-
import { useState as p, useRef as
|
|
3
|
-
import { avatar as
|
|
4
|
-
import
|
|
5
|
-
import { cn as
|
|
6
|
-
import
|
|
7
|
-
import { Dropdown as
|
|
8
|
-
import
|
|
9
|
-
const
|
|
1
|
+
import { jsxs as N, jsx as t, Fragment as pe } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useRef as $, useEffect as F } from "react";
|
|
3
|
+
import { avatar as ue, presenceBadge as xe } from "./helper/variants.js";
|
|
4
|
+
import B from "../Icon/Icon.js";
|
|
5
|
+
import { cn as o } from "../../shared/utils/cn.js";
|
|
6
|
+
import de from "../Loading/index.js";
|
|
7
|
+
import { Dropdown as we } from "../Dropdown/index.js";
|
|
8
|
+
import G from "../TextField/HelperText.js";
|
|
9
|
+
const j = {
|
|
10
10
|
10: "text-[4.55px]",
|
|
11
11
|
12: "text-[5.45px]",
|
|
12
12
|
14: "text-[6.36px]",
|
|
@@ -25,123 +25,125 @@ const I = {
|
|
|
25
25
|
88: "text-[40px]",
|
|
26
26
|
128: "text-[58.18px]",
|
|
27
27
|
160: "text-[72.73px]"
|
|
28
|
-
},
|
|
28
|
+
}, ge = 2 * 1024 * 1024, T = ["image/jpeg", "image/jpg", "image/png", "image/webp"], W = "avatar-cache-v1", Ce = ({
|
|
29
29
|
src: n = "",
|
|
30
30
|
size: l = 48,
|
|
31
|
-
shape:
|
|
32
|
-
showPresence:
|
|
33
|
-
presenceStatus:
|
|
34
|
-
alt:
|
|
35
|
-
className:
|
|
36
|
-
firstName:
|
|
31
|
+
shape: H = "circle",
|
|
32
|
+
showPresence: J = !1,
|
|
33
|
+
presenceStatus: Z = "available",
|
|
34
|
+
alt: D = "",
|
|
35
|
+
className: V,
|
|
36
|
+
firstName: I,
|
|
37
37
|
lastName: R,
|
|
38
|
-
onUpload:
|
|
39
|
-
onRemove:
|
|
40
|
-
isLoading:
|
|
41
|
-
isCanEdit:
|
|
38
|
+
onUpload: C,
|
|
39
|
+
onRemove: L,
|
|
40
|
+
isLoading: d = !1,
|
|
41
|
+
isCanEdit: X = !0,
|
|
42
42
|
disableCache: w = !1,
|
|
43
|
-
icon:
|
|
44
|
-
bordered:
|
|
45
|
-
overlap:
|
|
46
|
-
overlapPrefix:
|
|
47
|
-
helperText:
|
|
48
|
-
errors:
|
|
49
|
-
maxFileSize:
|
|
50
|
-
allowedFileTypes:
|
|
51
|
-
innerClass:
|
|
52
|
-
containerClassName:
|
|
43
|
+
icon: U,
|
|
44
|
+
bordered: Y = !1,
|
|
45
|
+
overlap: q = !1,
|
|
46
|
+
overlapPrefix: k = "",
|
|
47
|
+
helperText: S,
|
|
48
|
+
errors: m,
|
|
49
|
+
maxFileSize: K = ge,
|
|
50
|
+
allowedFileTypes: Q = T,
|
|
51
|
+
innerClass: z = "",
|
|
52
|
+
containerClassName: ee = "",
|
|
53
53
|
outerClassName: O = "",
|
|
54
|
-
showHelperTextIcon:
|
|
54
|
+
showHelperTextIcon: te = !0,
|
|
55
|
+
shouldShowPlaceholderIconUpload: A = !0,
|
|
56
|
+
shouldShowDropdownForOptions: P = !0,
|
|
55
57
|
...g
|
|
56
58
|
}) => {
|
|
57
|
-
const [
|
|
59
|
+
const [re, s] = p(!1), [v, u] = p(""), [a, i] = p(n || ""), [x, b] = p(""), [M, E] = p(!1), f = $(null), ae = $(null), ne = async (e) => {
|
|
58
60
|
try {
|
|
59
|
-
const r = await caches.open(
|
|
61
|
+
const r = await caches.open(W);
|
|
60
62
|
if (!await r.match(e)) {
|
|
61
|
-
const
|
|
63
|
+
const h = await fetch(e, {
|
|
62
64
|
mode: "cors",
|
|
63
65
|
method: "GET",
|
|
64
66
|
headers: { "Access-Control-Allow-Origin": "*" }
|
|
65
67
|
});
|
|
66
|
-
if (!
|
|
67
|
-
throw new Error(`Failed to fetch image: ${
|
|
68
|
-
await r.put(e,
|
|
68
|
+
if (!h.ok)
|
|
69
|
+
throw new Error(`Failed to fetch image: ${h.status}`);
|
|
70
|
+
await r.put(e, h.clone());
|
|
69
71
|
}
|
|
70
72
|
} catch {
|
|
71
73
|
}
|
|
72
74
|
};
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
+
o();
|
|
76
|
+
const le = async (e) => {
|
|
75
77
|
if (w) return null;
|
|
76
78
|
try {
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
return URL.createObjectURL(
|
|
79
|
+
const c = await (await caches.open(W)).match(e);
|
|
80
|
+
if (c) {
|
|
81
|
+
const h = await c.blob();
|
|
82
|
+
return URL.createObjectURL(h);
|
|
81
83
|
}
|
|
82
84
|
return null;
|
|
83
85
|
} catch {
|
|
84
86
|
return null;
|
|
85
87
|
}
|
|
86
88
|
};
|
|
87
|
-
|
|
89
|
+
F(() => {
|
|
88
90
|
let e = null;
|
|
89
|
-
return n && !w ? (
|
|
90
|
-
r ? (b(r),
|
|
91
|
-
})) :
|
|
91
|
+
return n && !w ? (ne(n), le(n).then((r) => {
|
|
92
|
+
r ? (b(r), i(r), e = r) : i(n);
|
|
93
|
+
})) : i(n || ""), () => {
|
|
92
94
|
e && URL.revokeObjectURL(e);
|
|
93
95
|
};
|
|
94
|
-
}, [n, w]),
|
|
96
|
+
}, [n, w]), F(() => {
|
|
95
97
|
if (!a) {
|
|
96
98
|
E(!1);
|
|
97
99
|
return;
|
|
98
100
|
}
|
|
99
101
|
const e = new window.Image();
|
|
100
102
|
return e.src = a, e.onload = () => E(!1), e.onerror = () => {
|
|
101
|
-
E(!0),
|
|
103
|
+
E(!0), x && a !== x && i(x);
|
|
102
104
|
}, () => {
|
|
103
105
|
a.startsWith("blob:") && URL.revokeObjectURL(a);
|
|
104
106
|
};
|
|
105
|
-
}, [a,
|
|
106
|
-
const
|
|
107
|
+
}, [a, x]);
|
|
108
|
+
const ce = () => k || (U ? /* @__PURE__ */ t(
|
|
107
109
|
"span",
|
|
108
110
|
{
|
|
109
|
-
className: `flex h-full w-full items-center justify-center ${
|
|
110
|
-
children:
|
|
111
|
+
className: `flex h-full w-full items-center justify-center ${j[l ?? 48]}`,
|
|
112
|
+
children: U
|
|
111
113
|
}
|
|
112
|
-
) :
|
|
114
|
+
) : I || R ? `${I?.[0] || ""}${R?.[0] || ""}`.toUpperCase() : n ? n[0]?.toUpperCase() : ""), se = async (e) => {
|
|
113
115
|
const r = e.target.files?.[0];
|
|
114
116
|
if (!r) return;
|
|
115
|
-
if (!
|
|
117
|
+
if (!Q.includes(r.type)) {
|
|
116
118
|
u(
|
|
117
|
-
|
|
119
|
+
m?.imageFileTypeError || "Please select a valid image file (JPG, JPEG, PNG, or WEBP)"
|
|
118
120
|
);
|
|
119
121
|
return;
|
|
120
122
|
}
|
|
121
|
-
if (r.size >
|
|
123
|
+
if (r.size > K) {
|
|
122
124
|
u(
|
|
123
|
-
|
|
125
|
+
m?.imageUploadLimitError || "Image is too large, must be no larger than 2 MB."
|
|
124
126
|
);
|
|
125
127
|
return;
|
|
126
128
|
}
|
|
127
129
|
u("");
|
|
128
|
-
let
|
|
130
|
+
let c = null;
|
|
129
131
|
try {
|
|
130
|
-
|
|
132
|
+
c = URL.createObjectURL(r), i(c), await C?.(r);
|
|
131
133
|
} finally {
|
|
132
|
-
|
|
134
|
+
f.current && (f.current.value = ""), s(!1), c && URL.revokeObjectURL(c);
|
|
133
135
|
}
|
|
134
|
-
},
|
|
136
|
+
}, ie = async () => {
|
|
135
137
|
try {
|
|
136
|
-
await
|
|
138
|
+
await L?.(), i(""), b("");
|
|
137
139
|
} finally {
|
|
138
|
-
|
|
140
|
+
s(!1), u("");
|
|
139
141
|
}
|
|
140
|
-
},
|
|
141
|
-
e === "change-photo" ?
|
|
142
|
-
|
|
143
|
-
}),
|
|
144
|
-
}, y =
|
|
142
|
+
}, oe = (e) => {
|
|
143
|
+
e === "change-photo" ? f.current?.click() : e === "remove-photo" && ie().then(() => {
|
|
144
|
+
i(""), b("");
|
|
145
|
+
}), s(!1);
|
|
146
|
+
}, y = X && (C || L) && l >= 24, me = ce(), fe = l && l >= 24 && l <= 64, { id: he } = "data-testid" in g ? g : { id: "avatar" }, _ = {
|
|
145
147
|
10: "h-[0.625rem] w-[0.625rem]",
|
|
146
148
|
// 10px
|
|
147
149
|
12: "h-[0.75rem] w-[0.75rem]",
|
|
@@ -179,21 +181,21 @@ const I = {
|
|
|
179
181
|
160: "h-[10rem] w-[10rem]"
|
|
180
182
|
// 160px
|
|
181
183
|
};
|
|
182
|
-
return /* @__PURE__ */ N("div", { "data-testid":
|
|
184
|
+
return /* @__PURE__ */ N("div", { "data-testid": he, className: "relative block w-fit", children: [
|
|
183
185
|
/* @__PURE__ */ t(
|
|
184
186
|
"div",
|
|
185
187
|
{
|
|
186
|
-
className:
|
|
188
|
+
className: o(
|
|
187
189
|
"w-fit overflow-hidden",
|
|
188
|
-
|
|
189
|
-
|
|
190
|
+
_[l ?? 48],
|
|
191
|
+
ee
|
|
190
192
|
),
|
|
191
193
|
children: /* @__PURE__ */ N(
|
|
192
|
-
|
|
194
|
+
we,
|
|
193
195
|
{
|
|
194
196
|
selected: !0,
|
|
195
|
-
onValueChange:
|
|
196
|
-
open:
|
|
197
|
+
onValueChange: oe,
|
|
198
|
+
open: re,
|
|
197
199
|
items: [
|
|
198
200
|
{
|
|
199
201
|
label: "Change photo",
|
|
@@ -207,58 +209,68 @@ const I = {
|
|
|
207
209
|
}
|
|
208
210
|
],
|
|
209
211
|
align: "start",
|
|
210
|
-
onOpenChange:
|
|
212
|
+
onOpenChange: (e) => {
|
|
213
|
+
if (!e)
|
|
214
|
+
return s(!1);
|
|
215
|
+
y && !d && P || !P && a ? s(e) : (f.current?.click(), s(!1));
|
|
216
|
+
},
|
|
211
217
|
children: [
|
|
212
218
|
/* @__PURE__ */ N(
|
|
213
219
|
"div",
|
|
214
220
|
{
|
|
215
|
-
className:
|
|
216
|
-
|
|
217
|
-
shape:
|
|
221
|
+
className: o(
|
|
222
|
+
ue({
|
|
223
|
+
shape: H,
|
|
218
224
|
// type: previewSrc && !isImageError ? 'image' : 'initials',
|
|
219
|
-
className:
|
|
220
|
-
bordered: a && !
|
|
221
|
-
overlap:
|
|
225
|
+
className: o(_[l ?? 48], V),
|
|
226
|
+
bordered: a && !M ? !0 : Y,
|
|
227
|
+
overlap: q
|
|
222
228
|
}),
|
|
223
229
|
O
|
|
224
230
|
),
|
|
225
231
|
...g,
|
|
226
232
|
children: [
|
|
227
|
-
a && !
|
|
233
|
+
a && !M ? /* @__PURE__ */ t(
|
|
228
234
|
"img",
|
|
229
235
|
{
|
|
230
236
|
src: a,
|
|
231
|
-
alt:
|
|
232
|
-
className:
|
|
237
|
+
alt: D,
|
|
238
|
+
className: o("object-cover", z)
|
|
233
239
|
}
|
|
234
240
|
) : /* @__PURE__ */ t(
|
|
235
241
|
"div",
|
|
236
242
|
{
|
|
237
|
-
className: `flex h-full w-full items-center justify-center ${
|
|
243
|
+
className: `flex h-full w-full items-center justify-center ${j[l ?? 48]}`,
|
|
238
244
|
children: /* @__PURE__ */ t(
|
|
239
245
|
"div",
|
|
240
246
|
{
|
|
241
|
-
className:
|
|
242
|
-
`${
|
|
247
|
+
className: o(
|
|
248
|
+
`${j[l ?? 48]} leading-none`,
|
|
243
249
|
O
|
|
244
250
|
),
|
|
245
|
-
children:
|
|
251
|
+
children: me
|
|
246
252
|
}
|
|
247
253
|
)
|
|
248
254
|
}
|
|
249
255
|
),
|
|
250
|
-
y && !
|
|
256
|
+
y && !d && /* @__PURE__ */ t(
|
|
251
257
|
"div",
|
|
252
258
|
{
|
|
253
|
-
ref:
|
|
254
|
-
className:
|
|
259
|
+
ref: ae,
|
|
260
|
+
className: o(
|
|
261
|
+
"absolute bottom-0 flex w-full cursor-pointer items-center justify-center",
|
|
262
|
+
{
|
|
263
|
+
"bg-black-alpha-4": A
|
|
264
|
+
}
|
|
265
|
+
),
|
|
255
266
|
style: {
|
|
256
267
|
color: "white",
|
|
257
|
-
height:
|
|
268
|
+
height: fe ? "100%" : "24px"
|
|
258
269
|
},
|
|
259
|
-
onClick: () =>
|
|
260
|
-
|
|
261
|
-
|
|
270
|
+
onClick: () => {
|
|
271
|
+
},
|
|
272
|
+
children: A && /* @__PURE__ */ t(
|
|
273
|
+
B,
|
|
262
274
|
{
|
|
263
275
|
name: "camera-01",
|
|
264
276
|
size: 16,
|
|
@@ -270,15 +282,15 @@ const I = {
|
|
|
270
282
|
/* @__PURE__ */ t(
|
|
271
283
|
"input",
|
|
272
284
|
{
|
|
273
|
-
ref:
|
|
285
|
+
ref: f,
|
|
274
286
|
type: "file",
|
|
275
|
-
accept:
|
|
287
|
+
accept: T.join(","),
|
|
276
288
|
className: "hidden",
|
|
277
|
-
onChange:
|
|
289
|
+
onChange: se
|
|
278
290
|
}
|
|
279
291
|
),
|
|
280
|
-
|
|
281
|
-
|
|
292
|
+
d && /* @__PURE__ */ t("div", { className: "absolute bottom-0 inset-0 flex items-center justify-center bg-black-alpha-4", children: /* @__PURE__ */ t(
|
|
293
|
+
de,
|
|
282
294
|
{
|
|
283
295
|
thickness: 2,
|
|
284
296
|
width: 14,
|
|
@@ -288,21 +300,21 @@ const I = {
|
|
|
288
300
|
]
|
|
289
301
|
}
|
|
290
302
|
),
|
|
291
|
-
|
|
303
|
+
J && !y && /* @__PURE__ */ t("span", { className: xe({ status: Z }), children: /* @__PURE__ */ t("svg", { className: "h-2 w-2", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ t("circle", { cx: "10", cy: "10", r: "10" }) }) })
|
|
292
304
|
]
|
|
293
305
|
}
|
|
294
306
|
)
|
|
295
307
|
}
|
|
296
308
|
),
|
|
297
|
-
v ||
|
|
298
|
-
|
|
309
|
+
v || m?.externalUploadError ? /* @__PURE__ */ t("div", { className: "mt-1 flex items-center gap-1", children: /* @__PURE__ */ t(
|
|
310
|
+
G,
|
|
299
311
|
{
|
|
300
|
-
text: v ||
|
|
312
|
+
text: v || m?.externalUploadError,
|
|
301
313
|
error: !0,
|
|
302
314
|
haveIcon: !0,
|
|
303
315
|
iconsSize: 16,
|
|
304
316
|
iconsCustom: /* @__PURE__ */ t(
|
|
305
|
-
|
|
317
|
+
B,
|
|
306
318
|
{
|
|
307
319
|
name: "alert-octagon",
|
|
308
320
|
className: "text-fg-accent-error",
|
|
@@ -311,16 +323,16 @@ const I = {
|
|
|
311
323
|
}
|
|
312
324
|
)
|
|
313
325
|
}
|
|
314
|
-
) }) : /* @__PURE__ */ t(
|
|
315
|
-
|
|
326
|
+
) }) : /* @__PURE__ */ t(pe, { children: S ? /* @__PURE__ */ t(
|
|
327
|
+
G,
|
|
316
328
|
{
|
|
317
|
-
text:
|
|
318
|
-
error: !!v || !!
|
|
319
|
-
haveIcon:
|
|
329
|
+
text: S,
|
|
330
|
+
error: !!v || !!m?.externalUploadError,
|
|
331
|
+
haveIcon: te
|
|
320
332
|
}
|
|
321
333
|
) : null })
|
|
322
334
|
] });
|
|
323
335
|
};
|
|
324
336
|
export {
|
|
325
|
-
|
|
337
|
+
Ce as default
|
|
326
338
|
};
|