mcr-design-systems 1.0.80 → 1.0.83

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.
@@ -126,7 +126,6 @@ export interface SelectProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
126
126
  error?: boolean;
127
127
  haveIcon?: boolean;
128
128
  iconsCustom?: React.ReactNode;
129
- onBlur?: React.FocusEventHandler<HTMLDivElement>;
130
129
  }
131
130
  declare const _default: React.NamedExoticComponent<SelectProps & React.RefAttributes<HTMLDivElement>>;
132
131
  export default _default;
@@ -1,34 +1,34 @@
1
- import { jsxs as h, jsx as t, Fragment as H } from "react/jsx-runtime";
2
- import { forwardRef as we, useState as I, useRef as Se, useEffect as We, useCallback as R, useMemo as V, memo as Re } from "react";
1
+ import { jsxs as h, jsx as t, Fragment as Z } from "react/jsx-runtime";
2
+ import { forwardRef as be, useState as _, useRef as ye, useEffect as Se, useCallback as R, useMemo as B, memo as We } from "react";
3
3
  import { cn as d } from "../../shared/utils/cn.js";
4
- import { dataTestId as Me } from "../../shared/utils/dataTestId.js";
5
- import { Typography as O } from "../Typography/index.js";
4
+ import { dataTestId as we } from "../../shared/utils/dataTestId.js";
5
+ import { Typography as H } from "../Typography/index.js";
6
6
  import x from "../Icon/Icon.js";
7
- import { Dropdown as ee } from "../Dropdown/index.js";
8
- import { selectVariants as $e } from "./helper/variants.js";
9
- import te from "../Chip/index.js";
10
- import ke from "../TextField/HelperText.js";
11
- const re = we(
7
+ import { Dropdown as I } from "../Dropdown/index.js";
8
+ import { selectVariants as Re } from "./helper/variants.js";
9
+ import O from "../Chip/index.js";
10
+ import Me from "../TextField/HelperText.js";
11
+ const ee = be(
12
12
  ({
13
- items: w = [],
13
+ items: W = [],
14
14
  value: r,
15
15
  onChange: N,
16
- placeholder: A = "Select an option...",
16
+ placeholder: b = "Select an option...",
17
17
  disabled: s = !1,
18
18
  readOnly: n = !1,
19
- loading: P = !1,
20
- showCheckmark: B = !1,
19
+ loading: F = !1,
20
+ showCheckmark: P = !1,
21
21
  emptyText: D = "No options available",
22
22
  state: M,
23
23
  label: q,
24
- helpText: se,
25
- required: ne = !1,
24
+ helpText: te,
25
+ required: re = !1,
26
26
  leadingIcon: o,
27
27
  trailingIcon: p,
28
28
  mode: i = "single",
29
29
  maxDisplayChips: $ = 3,
30
- moreItemsText: ae = "+{count}",
31
- trigger: ce,
30
+ moreItemsText: se = "+{count}",
31
+ trigger: ne,
32
32
  side: z = "bottom",
33
33
  align: G = "start",
34
34
  sideOffset: J = 4,
@@ -38,17 +38,16 @@ const re = we(
38
38
  size: c = "md",
39
39
  variant: k = "default",
40
40
  fullWidth: T = !1,
41
- className: oe,
42
- iconsSize: ie,
41
+ className: ae,
42
+ iconsSize: ce,
43
43
  "data-testid": u,
44
44
  width: C,
45
- error: le,
46
- haveIcon: me,
47
- iconsCustom: pe,
48
- onBlur: U,
49
- ...fe
50
- }, ue) => {
51
- const [f, S] = I(!1), [j, he] = I(0), E = Se(null), l = $e({
45
+ error: oe,
46
+ haveIcon: ie,
47
+ iconsCustom: le,
48
+ ...me
49
+ }, pe) => {
50
+ const [f, y] = _(!1), [j, fe] = _(0), E = ye(null), l = Re({
52
51
  size: c,
53
52
  variant: k,
54
53
  fullWidth: T,
@@ -56,33 +55,33 @@ const re = we(
56
55
  disabled: s,
57
56
  readOnly: n
58
57
  });
59
- We(() => {
58
+ Se(() => {
60
59
  if (E.current) {
61
60
  const e = new ResizeObserver((a) => {
62
61
  for (const m of a)
63
- he(m.contentRect.width);
62
+ fe(m.contentRect.width);
64
63
  });
65
64
  return e.observe(E.current), () => e.disconnect();
66
65
  }
67
66
  }, []);
68
- const X = R(() => {
67
+ const U = R(() => {
69
68
  if (j === 0) return $;
70
- const e = c === "sm" ? 100 : c === "lg" ? 140 : 120, a = 4, m = 32, y = 32, b = o ? 24 : 0, be = m + y + b + 16, Ae = j - be, ye = Math.floor(
71
- Ae / (e + a)
69
+ const e = c === "sm" ? 100 : c === "lg" ? 140 : 120, a = 4, m = 32, S = 32, A = o ? 24 : 0, xe = m + S + A + 16, Ce = j - xe, Ae = Math.floor(
70
+ Ce / (e + a)
72
71
  );
73
- return Math.max(1, Math.min(ye, $));
74
- }, [j, $, c, o]), Y = R(
72
+ return Math.max(1, Math.min(Ae, $));
73
+ }, [j, $, c, o]), X = R(
75
74
  (e) => {
76
75
  if (!(s || n))
77
76
  if (i === "single")
78
77
  N?.(e);
79
78
  else {
80
- const a = Array.isArray(r) ? r : [], m = a.includes(e) ? a.filter((y) => y !== e) : [...a, e];
79
+ const a = Array.isArray(r) ? r : [], m = a.includes(e) ? a.filter((S) => S !== e) : [...a, e];
81
80
  N?.(m);
82
81
  }
83
82
  },
84
83
  [i, r, N, s, n]
85
- ), de = R(
84
+ ), ue = R(
86
85
  (e) => {
87
86
  if (i === "multiple" && Array.isArray(r) && !s && !n) {
88
87
  const a = r.filter((m) => m !== e);
@@ -90,33 +89,33 @@ const re = we(
90
89
  }
91
90
  },
92
91
  [i, r, N, s, n]
93
- ), Ne = R(() => {
92
+ ), he = R(() => {
94
93
  i === "multiple" && Array.isArray(r) && r.length > 0 && !s && !n && N?.([]);
95
- }, [i, r, N, s, n]), g = V(() => {
94
+ }, [i, r, N, s, n]), g = B(() => {
96
95
  if (!r) return [];
97
96
  const e = [], a = Array.isArray(r) ? r : [r];
98
- return ((y) => {
99
- y.forEach((b) => {
100
- "items" in b ? b.items.forEach((F) => {
101
- a.includes(F.value) && e.push(F);
102
- }) : a.includes(b.value) && e.push(b);
97
+ return ((S) => {
98
+ S.forEach((A) => {
99
+ "items" in A ? A.items.forEach((V) => {
100
+ a.includes(V.value) && e.push(V);
101
+ }) : a.includes(A.value) && e.push(A);
103
102
  });
104
- })(w), e;
105
- }, [r, w]), ge = V(() => {
103
+ })(W), e;
104
+ }, [r, W]), de = B(() => {
106
105
  if (i === "single") {
107
106
  const e = g[0];
108
- return e ? e.label : A;
107
+ return e ? e.label : b;
109
108
  }
110
109
  return "";
111
- }, [i, g, A]), W = V(() => {
110
+ }, [i, g, b]), w = B(() => {
112
111
  if (i !== "multiple" || !Array.isArray(r)) return [];
113
- const e = X(), a = g.slice(0, e), m = g.length - e;
112
+ const e = U(), a = g.slice(0, e), m = g.length - e;
114
113
  return {
115
114
  displayItems: a,
116
115
  remainingCount: m,
117
116
  hasMore: m > 0
118
117
  };
119
- }, [i, r, g, X]), ve = C ? { width: typeof C == "number" ? `${C}px` : C } : {}, xe = d(l.container(), oe), v = (e) => {
118
+ }, [i, r, g, U]), Ne = C ? { width: typeof C == "number" ? `${C}px` : C } : {}, ge = d(l.container(), ae), v = (e) => {
120
119
  switch (e) {
121
120
  case "sm":
122
121
  return 16;
@@ -127,7 +126,7 @@ const re = we(
127
126
  default:
128
127
  return 16;
129
128
  }
130
- }, Z = (e) => {
129
+ }, Y = (e) => {
131
130
  switch (e) {
132
131
  case "sm":
133
132
  return "small";
@@ -138,11 +137,7 @@ const re = we(
138
137
  default:
139
138
  return "medium";
140
139
  }
141
- }, _ = (e) => {
142
- S(e), !e && U && U(
143
- new FocusEvent("blur")
144
- );
145
- }, Ce = () => /* @__PURE__ */ h(
140
+ }, ve = () => /* @__PURE__ */ h(
146
141
  "div",
147
142
  {
148
143
  className: l.trigger(),
@@ -163,7 +158,7 @@ const re = we(
163
158
  "flex-1 truncate text-left",
164
159
  g.length > 0 ? "text-fg-neutral-main" : l.placeholder()
165
160
  ),
166
- children: ge
161
+ children: de
167
162
  }
168
163
  ),
169
164
  p ? /* @__PURE__ */ t("span", { className: l.trailingIcon(), children: p.node || p.name && /* @__PURE__ */ t(
@@ -187,17 +182,17 @@ const re = we(
187
182
  return /* @__PURE__ */ h(
188
183
  "div",
189
184
  {
190
- ref: ue,
191
- className: xe,
192
- style: ve,
193
- ...Me(u || "select"),
194
- ...fe,
185
+ ref: pe,
186
+ className: ge,
187
+ style: Ne,
188
+ ...we(u || "select"),
189
+ ...me,
195
190
  children: [
196
191
  q && /* @__PURE__ */ h("div", { className: "mb-1 flex items-center gap-[2px]", children: [
197
- /* @__PURE__ */ t(O, { variants: "action", size: "sm", color: "fg-neutral-subtle", children: q }),
198
- ne && /* @__PURE__ */ t(O, { variants: "action", size: "sm", color: "fg-accent-error", children: "*" })
192
+ /* @__PURE__ */ t(H, { variants: "action", size: "sm", color: "fg-neutral-subtle", children: q }),
193
+ re && /* @__PURE__ */ t(H, { variants: "action", size: "sm", color: "fg-accent-error", children: "*" })
199
194
  ] }),
200
- /* @__PURE__ */ t("div", { className: "relative", children: i === "multiple" ? /* @__PURE__ */ h(H, { children: [
195
+ /* @__PURE__ */ t("div", { className: "relative", children: i === "multiple" ? /* @__PURE__ */ h(Z, { children: [
201
196
  /* @__PURE__ */ h(
202
197
  "div",
203
198
  {
@@ -222,20 +217,20 @@ const re = we(
222
217
  !s && !n && "cursor-pointer"
223
218
  ),
224
219
  onClick: (e) => {
225
- s || n || e.target.closest('[data-testid*="chip"]') || S(!f);
220
+ s || n || e.target.closest('[data-testid*="chip"]') || y(!f);
226
221
  },
227
222
  children: [
228
- Array.isArray(W) ? null : /* @__PURE__ */ h(H, { children: [
229
- W.displayItems.map((e) => /* @__PURE__ */ t(
223
+ Array.isArray(w) ? null : /* @__PURE__ */ h(Z, { children: [
224
+ w.displayItems.map((e) => /* @__PURE__ */ t(
230
225
  "div",
231
226
  {
232
227
  onClick: (a) => a.stopPropagation(),
233
228
  className: "flex-shrink-0",
234
229
  children: /* @__PURE__ */ t(
235
- te,
230
+ O,
236
231
  {
237
- size: Z(c),
238
- onRemove: !s && !n ? () => de(e.value) : void 0,
232
+ size: Y(c),
233
+ onRemove: !s && !n ? () => ue(e.value) : void 0,
239
234
  className: "bg-bg-surface-level-3",
240
235
  variant: "neutral",
241
236
  trailingIcon: !s && !n ? {
@@ -249,21 +244,21 @@ const re = we(
249
244
  },
250
245
  e.value
251
246
  )),
252
- W.hasMore && /* @__PURE__ */ t(
247
+ w.hasMore && /* @__PURE__ */ t(
253
248
  "div",
254
249
  {
255
250
  onClick: (e) => e.stopPropagation(),
256
251
  className: "flex-shrink-0",
257
252
  children: /* @__PURE__ */ t(
258
- te,
253
+ O,
259
254
  {
260
- size: Z(c),
255
+ size: Y(c),
261
256
  variant: "neutral",
262
257
  className: "self-center bg-bg-surface-level-3",
263
258
  dataTestIdName: `${u || "select"}-chip-more`,
264
- children: ae.replace(
259
+ children: se.replace(
265
260
  "{count}",
266
- W.remainingCount.toString()
261
+ w.remainingCount.toString()
267
262
  )
268
263
  }
269
264
  )
@@ -277,7 +272,7 @@ const re = we(
277
272
  l.placeholder(),
278
273
  !s && !n && "cursor-pointer"
279
274
  ),
280
- children: A
275
+ children: b
281
276
  }
282
277
  )
283
278
  ]
@@ -288,7 +283,7 @@ const re = we(
288
283
  "button",
289
284
  {
290
285
  type: "button",
291
- onClick: Ne,
286
+ onClick: he,
292
287
  className: d(
293
288
  "flex items-center justify-center p-1 rounded-sm transition-colors",
294
289
  !s && !n && "cursor-pointer hover:bg-bg-neutral-subtle",
@@ -313,7 +308,7 @@ const re = we(
313
308
  {
314
309
  type: "button",
315
310
  onClick: () => {
316
- !s && !n && S(!f);
311
+ !s && !n && y(!f);
317
312
  },
318
313
  className: d(
319
314
  "flex items-center justify-center p-1",
@@ -344,19 +339,19 @@ const re = we(
344
339
  }
345
340
  ),
346
341
  /* @__PURE__ */ t(
347
- ee,
342
+ I,
348
343
  {
349
- items: w,
344
+ items: W,
350
345
  value: r,
351
- onValueChange: Y,
352
- placeholder: A,
346
+ onValueChange: X,
347
+ placeholder: b,
353
348
  disabled: s,
354
- loading: P,
355
- showCheckmark: B,
349
+ loading: F,
350
+ showCheckmark: P,
356
351
  emptyText: D,
357
352
  state: M,
358
353
  open: f,
359
- onOpenChange: _,
354
+ onOpenChange: y,
360
355
  side: z,
361
356
  align: G,
362
357
  sideOffset: J,
@@ -374,21 +369,21 @@ const re = we(
374
369
  ] }) : (
375
370
  /* Single mode - use Dropdown normally */
376
371
  /* @__PURE__ */ t(
377
- ee,
372
+ I,
378
373
  {
379
- items: w,
374
+ items: W,
380
375
  value: r,
381
376
  onValueChange: (e) => {
382
- Y(e), S(!1);
377
+ X(e), y(!1);
383
378
  },
384
- placeholder: A,
379
+ placeholder: b,
385
380
  disabled: s,
386
- loading: P,
387
- showCheckmark: B,
381
+ loading: F,
382
+ showCheckmark: P,
388
383
  emptyText: D,
389
384
  state: M,
390
385
  open: f,
391
- onOpenChange: _,
386
+ onOpenChange: y,
392
387
  side: z,
393
388
  align: G,
394
389
  sideOffset: J,
@@ -400,19 +395,19 @@ const re = we(
400
395
  fullWidth: T,
401
396
  width: C,
402
397
  "data-testid": u ? `${u}-dropdown` : void 0,
403
- children: ce || Ce()
398
+ children: ne || ve()
404
399
  }
405
400
  )
406
401
  ) }),
407
402
  /* @__PURE__ */ t(
408
- ke,
403
+ Me,
409
404
  {
410
405
  className: "mt-1",
411
- text: se,
412
- error: le,
413
- haveIcon: me,
414
- iconsSize: ie,
415
- iconsCustom: pe
406
+ text: te,
407
+ error: oe,
408
+ haveIcon: ie,
409
+ iconsSize: ce,
410
+ iconsCustom: le
416
411
  }
417
412
  )
418
413
  ]
@@ -420,8 +415,8 @@ const re = we(
420
415
  );
421
416
  }
422
417
  );
423
- re.displayName = "Select";
424
- const Ge = Re(re);
418
+ ee.displayName = "Select";
419
+ const qe = We(ee);
425
420
  export {
426
- Ge as default
421
+ qe as default
427
422
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mcr-design-systems",
3
3
  "private": false,
4
- "version": "1.0.80",
4
+ "version": "1.0.83",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",