mcr-design-systems 1.0.11 → 1.0.13

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 +1 @@
1
- export type IconName = 'activity' | 'activity-heart' | 'alarm-clock' | 'alarm-clock-check' | 'alert-circle' | 'alert-octagon' | 'alert-triangle' | 'align-left' | 'align-right' | 'bell-01' | 'calendar' | 'camera-01' | 'check' | 'check-circle' | 'chevron-down' | 'chevron-left' | 'chevron-left-double' | 'chevron-right' | 'chevron-right-double' | 'chevron-up' | 'circle' | 'download-01' | 'eye' | 'eye-off' | 'filter-funnel-01' | 'help-circle' | 'info-circle' | 'loading-01' | 'minus' | 'plus' | 'search-lg' | 'search-md' | 'user-03' | 'x-circle' | 'x-close';
1
+ export type IconName = 'activity' | 'activity-heart' | 'alarm-clock' | 'alarm-clock-check' | 'alert-circle' | 'alert-octagon' | 'alert-triangle' | 'align-left' | 'align-right' | 'bell-01' | 'calendar' | 'camera-01' | 'check' | 'check-circle' | 'chevron-down' | 'chevron-left' | 'chevron-left-double' | 'chevron-right' | 'chevron-right-double' | 'chevron-up' | 'circle' | 'download-01' | 'eye' | 'eye-off' | 'filter-funnel-01' | 'help-circle' | 'info-circle' | 'loading-01' | 'minus' | 'plus' | 'search-lg' | 'search-md' | 'user-03' | 'x-circle' | 'x-close' | 'refresh-cw_01';
@@ -1,10 +1,10 @@
1
- import { jsx as i, jsxs as I } from "react/jsx-runtime";
2
- import m, { forwardRef as A, useState as D, useMemo as B, useEffect as H, memo as R } from "react";
3
- import { inputBaseVariants as _, textAreaVariants as F } from "./variants.js";
4
- import K from "../Icon/Icon.js";
5
- import { cn as p } from "../../shared/utils/cn.js";
6
- import { dataTestId as W } from "../../shared/utils/dataTestId.js";
7
- const q = (n) => {
1
+ import { jsxs as I, jsx as u } from "react/jsx-runtime";
2
+ import r, { forwardRef as D, useState as H, useMemo as B, useEffect as R, memo as _ } from "react";
3
+ import { inputBaseVariants as F, textAreaVariants as K } from "./variants.js";
4
+ import W from "../Icon/Icon.js";
5
+ import { cn as f } from "../../shared/utils/cn.js";
6
+ import { dataTestId as q } from "../../shared/utils/dataTestId.js";
7
+ const A = (n) => {
8
8
  switch (n) {
9
9
  case "sm":
10
10
  return 16;
@@ -15,127 +15,134 @@ const q = (n) => {
15
15
  default:
16
16
  return 20;
17
17
  }
18
- }, N = A(
18
+ }, N = D(
19
19
  ({
20
20
  disabled: n,
21
21
  readOnly: a,
22
- endAdornment: d,
23
- className: w,
24
- color: T,
25
- sizeVariant: f = "md",
26
- startAdornment: y,
27
- InputComponent: b,
22
+ endAdornment: l,
23
+ className: V,
24
+ color: w,
25
+ sizeVariant: v = "md",
26
+ startAdornment: b,
27
+ InputComponent: y,
28
28
  containerProps: z,
29
- containerRef: C,
30
- width: S,
31
- iconsSize: V,
29
+ containerRef: T,
30
+ width: C,
31
+ iconsSize: S,
32
32
  error: j,
33
33
  clearText: M,
34
34
  optionalProps: h,
35
35
  // inputSize,
36
36
  ...e
37
37
  }, k) => {
38
- const [L, v] = D(!1), g = V || q(f), c = B(
38
+ const [L, g] = H(!1), o = S || A(v), m = B(
39
39
  () => `inputbase-input-${Math.random().toString(36).substring(2, 9)}`,
40
40
  []
41
- ), l = B(
41
+ ), p = B(
42
42
  () => `inputbase-textarea-${Math.random().toString(36).substring(2, 9)}`,
43
43
  []
44
44
  );
45
- H(() => {
45
+ R(() => {
46
46
  const t = e.value;
47
47
  if (t !== void 0) {
48
- v(String(t).length > 0);
48
+ g(String(t).length > 0);
49
49
  return;
50
50
  }
51
- const s = () => {
52
- const r = e.type === "textarea" ? document.getElementById(l) : document.getElementById(c);
53
- if (r) {
54
- const E = () => {
55
- v(r.value.length > 0);
51
+ const i = () => {
52
+ const c = e.type === "textarea" ? document.getElementById(p) : document.getElementById(m);
53
+ if (c) {
54
+ const x = () => {
55
+ g(c.value.length > 0);
56
56
  };
57
- return E(), r.addEventListener("input", E), () => {
58
- r.removeEventListener("input", E);
57
+ return x(), c.addEventListener("input", x), () => {
58
+ c.removeEventListener("input", x);
59
59
  };
60
60
  }
61
- }, o = s();
62
- if (!o) {
63
- const r = setTimeout(() => {
64
- s();
61
+ }, d = i();
62
+ if (!d) {
63
+ const c = setTimeout(() => {
64
+ i();
65
65
  }, 100);
66
- return () => clearTimeout(r);
66
+ return () => clearTimeout(c);
67
67
  }
68
- return o;
69
- }, [e.type, e.value, c, l]);
70
- const x = M && L ? /* @__PURE__ */ i(
71
- K,
68
+ return d;
69
+ }, [e.type, e.value, m, p]);
70
+ const E = M && L ? /* @__PURE__ */ u(
71
+ W,
72
72
  {
73
73
  name: "x-circle",
74
74
  variant: "solid",
75
- size: g,
76
- className: "cursor-pointer hover:opacity-70 transition-opacity text-fg-neutral-subtle",
75
+ size: o,
76
+ className: "cursor-pointer text-fg-neutral-subtle",
77
77
  onClick: () => {
78
- v(!1);
79
- const t = e.type === "textarea" ? document.getElementById(l) : document.getElementById(c);
80
- if (t)
78
+ g(!1);
79
+ const t = e.type === "textarea" ? document.getElementById(p) : document.getElementById(m);
80
+ if (t) {
81
81
  if (t.value = "", e.onChange) {
82
- const s = {
82
+ const i = {
83
83
  target: t,
84
84
  currentTarget: t,
85
85
  type: "change",
86
86
  bubbles: !0
87
87
  };
88
- e.onChange(s);
88
+ e.onChange(i);
89
89
  } else {
90
- const s = new Event("input", { bubbles: !0 }), o = new Event("change", { bubbles: !0 });
91
- t.dispatchEvent(s), t.dispatchEvent(o);
90
+ const i = new Event("input", { bubbles: !0 }), d = new Event("change", { bubbles: !0 });
91
+ t.dispatchEvent(i), t.dispatchEvent(d);
92
92
  }
93
+ t?.focus();
94
+ }
93
95
  },
94
96
  "aria-label": "Clear text"
95
97
  }
96
- ) : null, u = x && d ? /* @__PURE__ */ I("div", { className: "flex items-center gap-1", children: [
97
- x,
98
- d
99
- ] }) : x || d, $ = {
98
+ ) : null, s = E && l ? /* @__PURE__ */ I("div", { className: "flex items-center gap-2", children: [
99
+ E,
100
+ r.isValidElement(l) ? r.cloneElement(
101
+ l,
102
+ {
103
+ size: o
104
+ }
105
+ ) : l
106
+ ] }) : E || l, $ = {
100
107
  sm: "h-4",
101
108
  md: "h-5",
102
109
  lg: "h-6"
103
110
  };
104
- return /* @__PURE__ */ i("div", { className: "relative justify-center items-center", children: /* @__PURE__ */ I(
111
+ return /* @__PURE__ */ u("div", { className: "relative justify-center items-center", children: /* @__PURE__ */ I(
105
112
  "div",
106
113
  {
107
- ...W("InputBase"),
108
- ref: C,
114
+ ...q("InputBase"),
115
+ ref: T,
109
116
  ...z,
110
- className: _({
117
+ className: F({
111
118
  disabled: !!n,
112
- className: w,
113
- color: T,
114
- size: e?.type === "textarea" ? void 0 : f,
119
+ className: V,
120
+ color: w,
121
+ size: e?.type === "textarea" ? void 0 : v,
115
122
  readOnly: !!a,
116
123
  error: !!j
117
124
  }),
118
- style: { minWidth: S ?? "100%" },
125
+ style: { minWidth: C ?? "100%" },
119
126
  children: [
120
- y && /* @__PURE__ */ i(
127
+ b && /* @__PURE__ */ u(
121
128
  "div",
122
129
  {
123
- className: p("flex cursor-pointer items-center justify-center", {
130
+ className: f("flex cursor-pointer items-center justify-center", {
124
131
  "color-icon-disabled": n || a,
125
132
  "cursor-pointer": !n || a
126
133
  }),
127
- children: m.cloneElement(y, {
134
+ children: r.cloneElement(b, {
128
135
  // color: disabled || readOnly ? 'disabled' : 'currentColor',
129
- size: g
136
+ size: o
130
137
  })
131
138
  }
132
139
  ),
133
- b ? m.cloneElement(
134
- b,
140
+ y ? r.cloneElement(
141
+ y,
135
142
  {
136
- id: e?.type === "textarea" ? l : void 0,
137
- className: p(
138
- e?.type === "textarea" ? F({
143
+ id: e?.type === "textarea" ? p : void 0,
144
+ className: f(
145
+ e?.type === "textarea" ? K({
139
146
  size: h?.sizeTextArea,
140
147
  disabled: !!n,
141
148
  readOnly: !!a
@@ -147,13 +154,13 @@ const q = (n) => {
147
154
  ...e
148
155
  },
149
156
  null
150
- ) : /* @__PURE__ */ i(
157
+ ) : /* @__PURE__ */ u(
151
158
  "input",
152
159
  {
153
- id: e.type === "textarea" ? void 0 : c,
154
- className: p(
160
+ id: e.type === "textarea" ? void 0 : m,
161
+ className: f(
155
162
  "w-full appearance-none bg-transparent font-sans outline-none",
156
- $[f || "md"]
163
+ $[v || "md"]
157
164
  ),
158
165
  ref: k,
159
166
  disabled: n || a,
@@ -163,20 +170,19 @@ const q = (n) => {
163
170
  }
164
171
  }
165
172
  ),
166
- u && /* @__PURE__ */ i(
173
+ s && /* @__PURE__ */ u(
167
174
  "div",
168
175
  {
169
- className: p("max-h flex items-center justify-center", {
176
+ className: f("max-h flex items-center justify-center", {
170
177
  "color-icon-disabled": n || a,
171
178
  "cursor-pointer": !n || a
172
179
  }),
173
- children: m.isValidElement(u) ? m.cloneElement(
174
- u,
180
+ children: r.isValidElement(s) && s.type === "div" ? s : r.isValidElement(s) ? r.cloneElement(
181
+ s,
175
182
  {
176
- // color: disabled ? 'disabled' : 'default',
177
- size: g
183
+ size: o
178
184
  }
179
- ) : u
185
+ ) : s
180
186
  }
181
187
  )
182
188
  ]
@@ -185,7 +191,7 @@ const q = (n) => {
185
191
  }
186
192
  );
187
193
  N.displayName = "InputBase";
188
- const P = R(N);
194
+ const P = _(N);
189
195
  export {
190
196
  P as default
191
197
  };
@@ -5,49 +5,49 @@ import I from "../TextField/HelperText.js";
5
5
  import v from "../Icon/Icon.js";
6
6
  const N = y(
7
7
  ({
8
- helperText: o,
9
- error: n = !1,
10
- showHelperIcon: r = !0,
8
+ helperText: r,
9
+ error: a = !1,
10
+ showHelperIcon: n = !0,
11
11
  helperIconCustom: l,
12
12
  helperTextClassName: d,
13
13
  defaultVisible: m = !1,
14
- visible: s,
14
+ visible: t,
15
15
  onVisibilityChange: c,
16
- className: f,
17
- ...t
18
- }, u) => {
19
- const [p, w] = g(m), i = s !== void 0 ? s : p, b = () => {
20
- if (t.disabled)
16
+ className: u,
17
+ ...s
18
+ }, f) => {
19
+ const [p, w] = g(m), o = t !== void 0 ? t : p, b = () => {
20
+ if (s.disabled)
21
21
  return;
22
- const a = !i;
23
- s === void 0 && w(a), c?.(a);
22
+ const i = !o;
23
+ t === void 0 && w(i), c?.(i);
24
24
  };
25
25
  return /* @__PURE__ */ x("div", { className: "w-full [&_input[type='password']::-ms-reveal]:hidden [&_input[type='password']::-ms-clear]:hidden", children: [
26
26
  /* @__PURE__ */ e(
27
27
  h,
28
28
  {
29
- ...t,
30
- ref: u,
31
- type: i ? "text" : "password",
32
- error: n,
33
- className: f,
29
+ ...s,
30
+ ref: f,
31
+ type: o ? "text" : "password",
32
+ error: a,
33
+ className: u,
34
+ clearText: !0,
34
35
  endAdornment: /* @__PURE__ */ e(
35
36
  v,
36
37
  {
37
- name: i ? "eye" : "eye-off",
38
- size: 24,
39
- className: `transition-colors ${t.disabled ? "bg-bg-input-disabled cursor-not-allowed" : "cursor-pointer hover:text-fg-neutral-rest text-fg-neutral-rest"}`,
38
+ name: o ? "eye" : "eye-off",
39
+ className: `transition-colors ${s.disabled ? "bg-bg-input-disabled cursor-not-allowed" : "cursor-pointer hover:text-fg-neutral-rest text-fg-neutral-rest"}`,
40
40
  onClick: b
41
41
  }
42
42
  )
43
43
  }
44
44
  ),
45
- o && /* @__PURE__ */ e("div", { className: "mt-1", children: /* @__PURE__ */ e(
45
+ r && /* @__PURE__ */ e("div", { className: "mt-1", children: /* @__PURE__ */ e(
46
46
  I,
47
47
  {
48
- text: o,
49
- error: n,
50
- haveIcon: r,
48
+ text: r,
49
+ error: a,
50
+ haveIcon: n,
51
51
  iconsCustom: l,
52
52
  className: d
53
53
  }
@@ -1,116 +1,116 @@
1
- import { jsxs as B, jsx as p } from "react/jsx-runtime";
2
- import { forwardRef as E, useState as F, useRef as H, useEffect as j, useCallback as w } from "react";
3
- import { pinInputVariants as S, pinVariants as $ } from "./variants.js";
4
- import { Typography as g } from "../Typography/index.js";
5
- import q from "../TextField/HelperText.js";
6
- import { cn as v } from "../../shared/utils/cn.js";
7
- import { dataTestId as G } from "../../shared/utils/dataTestId.js";
8
- const J = E(
1
+ import { jsxs as z, jsx as m } from "react/jsx-runtime";
2
+ import { forwardRef as B, useState as E, useRef as F, useEffect as d, useCallback as y } from "react";
3
+ import { pinInputVariants as H, pinVariants as S } from "./variants.js";
4
+ import { Typography as $ } from "../Typography/index.js";
5
+ import g from "../TextField/HelperText.js";
6
+ import { cn as j } from "../../shared/utils/cn.js";
7
+ import { dataTestId as q } from "../../shared/utils/dataTestId.js";
8
+ const C = B(
9
9
  ({
10
- length: a = 4,
11
- mask: k = !1,
12
- error: i,
13
- loading: I = !1,
10
+ length: r = 4,
11
+ mask: v = !1,
12
+ error: u,
13
+ loading: w = !1,
14
14
  disabled: n = !1,
15
- onChange: f,
16
- onComplete: m,
17
- value: y = "",
18
- autoFocus: N = !0,
19
- className: A,
20
- label: V,
21
- helperText: d,
22
- size: D = "medium",
23
- ...P
24
- }, b) => {
25
- const [c, l] = F(
26
- Array.from({ length: a }, (s, t) => y[t] || "")
27
- ), e = H([]);
28
- j(() => {
29
- const s = Array.from({ length: a }, (t, r) => y[r] || "");
30
- l(s);
31
- }, [y, a]), j(() => {
32
- N && !n && e.current[0] && e.current[0].focus();
33
- }, [N, n]);
34
- const K = w(
35
- (s, t) => {
36
- const r = t.replace(/\D/g, "").slice(-1), o = [...c];
37
- o[s] = r, l(o);
38
- const u = o.join("");
39
- f?.(u), r && s < a - 1 && e.current[s + 1]?.focus(), u.length === a && m?.(u);
15
+ onChange: c,
16
+ onComplete: G,
17
+ value: p = "",
18
+ autoFocus: I = !0,
19
+ className: k,
20
+ label: N,
21
+ helperText: V,
22
+ size: A = "medium",
23
+ ...D
24
+ }, P) => {
25
+ const [o, l] = E(
26
+ Array.from({ length: r }, (t, s) => p[s] || "")
27
+ ), a = F([]);
28
+ d(() => {
29
+ const t = Array.from({ length: r }, (s, e) => p[e] || "");
30
+ l(t);
31
+ }, [p, r]), d(() => {
32
+ I && !n && a.current[0] && a.current[0].focus();
33
+ }, [I, n]);
34
+ const b = y(
35
+ (t, s) => {
36
+ const e = s.replace(/\D/g, "").slice(-1), f = [...o];
37
+ f[t] = e, l(f);
38
+ const i = f.join("");
39
+ c?.(i), e && t < r - 1 && a.current[t + 1]?.focus();
40
40
  },
41
- [c, a, f, m]
42
- ), R = w(
43
- (s, t) => {
44
- if (t.key === "Backspace") {
45
- if (!c[s] && s > 0) {
46
- const r = [...c];
47
- r[s - 1] = "", l(r), e.current[s - 1]?.focus(), f?.(r.join(""));
48
- } else if (c[s]) {
49
- const r = [...c];
50
- r[s] = "", l(r), f?.(r.join(""));
41
+ [o, r, c]
42
+ ), K = y(
43
+ (t, s) => {
44
+ if (s.key === "Backspace") {
45
+ if (!o[t] && t > 0) {
46
+ const e = [...o];
47
+ e[t - 1] = "", l(e), a.current[t - 1]?.focus(), c?.(e.join(""));
48
+ } else if (o[t]) {
49
+ const e = [...o];
50
+ e[t] = "", l(e), c?.(e.join(""));
51
51
  }
52
- } else t.key === "ArrowLeft" && s > 0 ? e.current[s - 1]?.focus() : t.key === "ArrowRight" && s < a - 1 ? e.current[s + 1]?.focus() : t.key === "v" && (t.metaKey || t.ctrlKey) && (t.preventDefault(), navigator.clipboard.readText().then((r) => {
53
- const o = r.replace(/\D/g, "").slice(0, a), u = Array.from({ length: a }, (O, z) => o[z] || "");
54
- l(u), f?.(u.join(""));
55
- const M = Math.min(o.length, a - 1);
56
- e.current[M]?.focus(), o.length === a && m?.(o);
52
+ } else s.key === "ArrowLeft" && t > 0 ? a.current[t - 1]?.focus() : s.key === "ArrowRight" && t < r - 1 ? a.current[t + 1]?.focus() : s.key === "v" && (s.metaKey || s.ctrlKey) && (s.preventDefault(), navigator.clipboard.readText().then((e) => {
53
+ const f = e.replace(/\D/g, "").slice(0, r), i = Array.from({ length: r }, (J, M) => f[M] || "");
54
+ l(i), c?.(i.join(""));
55
+ const L = Math.min(f.length, r - 1);
56
+ a.current[L]?.focus();
57
57
  }));
58
58
  },
59
- [c, a, f, m]
60
- ), _ = w((s) => {
61
- e.current[s]?.select();
62
- }, []), { id: T } = G("PIN"), L = i ? "error" : n ? "disabled" : I ? "loading" : "default";
63
- return /* @__PURE__ */ B("div", { ref: b, className: v($({ className: A })), ...P, children: [
64
- V && /* @__PURE__ */ p(
65
- g,
59
+ [o, r, c]
60
+ ), R = y((t) => {
61
+ a.current[t]?.select();
62
+ }, []), { id: _ } = q("PIN"), T = u ? "error" : n ? "disabled" : w ? "loading" : "default";
63
+ return /* @__PURE__ */ z("div", { ref: P, className: j(S({ className: k })), ...D, children: [
64
+ N && /* @__PURE__ */ m(
65
+ $,
66
66
  {
67
67
  variants: "label",
68
68
  size: "sm",
69
69
  color: "fg-neutral-subtle",
70
70
  className: "mb-xs",
71
- children: V
71
+ children: N
72
72
  }
73
73
  ),
74
- /* @__PURE__ */ p("div", { className: "flex gap-xs", "data-test-id": T, children: Array.from({ length: a }).map((s, t) => /* @__PURE__ */ p(
74
+ /* @__PURE__ */ m("div", { className: "flex gap-xs", "data-test-id": _, children: Array.from({ length: r }).map((t, s) => /* @__PURE__ */ m(
75
75
  "input",
76
76
  {
77
- ref: (r) => {
78
- e.current[t] = r;
77
+ ref: (e) => {
78
+ a.current[s] = e;
79
79
  },
80
- type: k ? "password" : "text",
80
+ type: v ? "password" : "text",
81
81
  inputMode: "numeric",
82
82
  pattern: "[0-9]*",
83
83
  maxLength: 1,
84
- value: c[t],
85
- disabled: n || I,
86
- className: v(
87
- S({
88
- size: D,
89
- state: L
84
+ value: o[s],
85
+ disabled: n || w,
86
+ className: j(
87
+ H({
88
+ size: A,
89
+ state: T
90
90
  })
91
91
  ),
92
- onChange: (r) => K(t, r.target.value),
93
- onKeyDown: (r) => R(t, r),
94
- onFocus: () => _(t),
95
- "aria-label": `PIN digit ${t + 1}`,
92
+ onChange: (e) => b(s, e.target.value),
93
+ onKeyDown: (e) => K(s, e),
94
+ onFocus: () => R(s),
95
+ "aria-label": `PIN digit ${s + 1}`,
96
96
  autoComplete: "off"
97
97
  },
98
- t
98
+ s
99
99
  )) }),
100
- (d || i) && /* @__PURE__ */ p(
101
- q,
100
+ (V || u) && /* @__PURE__ */ m(
101
+ g,
102
102
  {
103
- text: i || d,
104
- error: !!i,
105
- haveIcon: !i,
103
+ text: u || V,
104
+ error: !!u,
105
+ haveIcon: !u,
106
106
  className: "justify-start"
107
107
  }
108
108
  )
109
109
  ] });
110
110
  }
111
111
  );
112
- J.displayName = "PIN";
112
+ C.displayName = "PIN";
113
113
  export {
114
- J as PIN,
115
- J as default
114
+ C as PIN,
115
+ C as default
116
116
  };
@@ -4,14 +4,17 @@ export declare const phoneInputVariants: import('tailwind-variants').TVReturnTyp
4
4
  sm: {
5
5
  countryButton: string;
6
6
  inputContainer: string;
7
+ input: string;
7
8
  };
8
9
  md: {
9
10
  countryButton: string;
10
11
  inputContainer: string;
12
+ input: string;
11
13
  };
12
14
  lg: {
13
15
  countryButton: string;
14
16
  inputContainer: string;
17
+ input: string;
15
18
  };
16
19
  };
17
20
  opened: {
@@ -43,14 +46,17 @@ export declare const phoneInputVariants: import('tailwind-variants').TVReturnTyp
43
46
  sm: {
44
47
  countryButton: string;
45
48
  inputContainer: string;
49
+ input: string;
46
50
  };
47
51
  md: {
48
52
  countryButton: string;
49
53
  inputContainer: string;
54
+ input: string;
50
55
  };
51
56
  lg: {
52
57
  countryButton: string;
53
58
  inputContainer: string;
59
+ input: string;
54
60
  };
55
61
  };
56
62
  opened: {
@@ -82,14 +88,17 @@ export declare const phoneInputVariants: import('tailwind-variants').TVReturnTyp
82
88
  sm: {
83
89
  countryButton: string;
84
90
  inputContainer: string;
91
+ input: string;
85
92
  };
86
93
  md: {
87
94
  countryButton: string;
88
95
  inputContainer: string;
96
+ input: string;
89
97
  };
90
98
  lg: {
91
99
  countryButton: string;
92
100
  inputContainer: string;
101
+ input: string;
93
102
  };
94
103
  };
95
104
  opened: {
@@ -1,23 +1,26 @@
1
- import { tv as r } from "../../../node_modules/tailwind-variants/dist/index.js";
2
- const n = r({
1
+ import { tv as e } from "../../../node_modules/tailwind-variants/dist/index.js";
2
+ const t = e({
3
3
  slots: {
4
4
  countryButton: "border border-input bg-bg-input flex items-center hover:cursor-pointer border-r-0",
5
5
  inputContainer: "min-w-[177px] flex-1 border border-input bg-bg-input hover:border-input-active focus-within:border-input-active focus-within:border-2 flex items-center",
6
- input: "bg-transparent outline-none w-full h-full font-primary text-base-lg font-normal leading-base-lg text-fg-neutral-main placeholder:text-fg-neutral-subtlest"
6
+ input: "bg-transparent outline-none w-full h-full font-primary text-fg-neutral-main placeholder:text-fg-neutral-subtlest"
7
7
  },
8
8
  variants: {
9
9
  size: {
10
10
  sm: {
11
11
  countryButton: "h-lg rounded-l-lg rounded-bl-lg py-none px-xs-2 gap-xs-3",
12
- inputContainer: "h-lg rounded-r-lg rounded-br-lg px-sm py-sm-2 "
12
+ inputContainer: "h-lg rounded-r-lg rounded-br-lg px-sm py-sm-2 ",
13
+ input: "text-base-md font-normal leading-base-md placeholder:text-base-md"
13
14
  },
14
15
  md: {
15
16
  countryButton: "h-xl rounded-l-lg rounded-bl-lg py-none px-xs gap-xs-3",
16
- inputContainer: "h-xl rounded-r-lg rounded-br-lg px-sm-2 py-[10px]"
17
+ inputContainer: "h-xl rounded-r-lg rounded-br-lg px-sm-2 py-[10px]",
18
+ input: "text-base-md font-normal leading-base-md placeholder:text-base-md"
17
19
  },
18
20
  lg: {
19
21
  countryButton: "h-xl-2 rounded-l-lg rounded-bl-lg py-none px-sm-2 gap-xs-3",
20
- inputContainer: "h-xl-2 rounded-r-lg rounded-br-lg py-xs-2 px-xs"
22
+ inputContainer: "h-xl-2 rounded-r-lg rounded-br-lg py-xs-2 px-xs",
23
+ input: "text-base-lg font-normal leading-base-lg placeholder:text-base-lg"
21
24
  }
22
25
  },
23
26
  opened: {
@@ -48,5 +51,5 @@ const n = r({
48
51
  }
49
52
  });
50
53
  export {
51
- n as phoneInputVariants
54
+ t as phoneInputVariants
52
55
  };
@@ -1,25 +1,25 @@
1
1
  import { jsxs as l, jsx as s } from "react/jsx-runtime";
2
2
  import * as n from "react";
3
3
  import G from "../../node_modules/libphonenumber-js/examples.mobile.json.js";
4
- import { cn as C } from "../../shared/utils/cn.js";
4
+ import { cn as b } from "../../shared/utils/cn.js";
5
5
  import { COUNTRIES_DATA as Q } from "../../shared/flags/countries-data.js";
6
6
  import { FLAG_POSITIONS as W } from "../../shared/flags/flag-positions.js";
7
7
  import { FLAG_BASE64 as Y } from "../../shared/flags/base64.js";
8
8
  import { phoneInputVariants as q } from "./helper/variants.js";
9
9
  import { Dropdown as H } from "../Dropdown/index.js";
10
- import { Typography as N } from "../Typography/index.js";
10
+ import { Typography as v } from "../Typography/index.js";
11
11
  import J from "../Icon/Icon.js";
12
12
  import K from "./FagDefault.js";
13
13
  import { getExampleNumber as X } from "../../node_modules/libphonenumber-js/min/exports/getExampleNumber.js";
14
14
  import { AsYouType as Z } from "../../node_modules/libphonenumber-js/min/exports/AsYouType.js";
15
- const v = ({
15
+ const F = ({
16
16
  countryCode: o
17
17
  }) => {
18
18
  const t = W[o];
19
19
  return /* @__PURE__ */ s("div", { className: "w-[30px] h-[20px] overflow-hidden rounded-xs", children: t === void 0 ? /* @__PURE__ */ s(K, {}) : /* @__PURE__ */ s(
20
20
  "div",
21
21
  {
22
- className: C(),
22
+ className: b(),
23
23
  style: {
24
24
  backgroundImage: `url('${Y}')`,
25
25
  backgroundPosition: `${t.x}px ${t.y}px`,
@@ -44,7 +44,7 @@ const v = ({
44
44
  );
45
45
  }
46
46
  return "Enter phone number";
47
- }, F = (o, t) => {
47
+ }, P = (o, t) => {
48
48
  if (!o || !o.trim()) return "";
49
49
  try {
50
50
  const c = new Z(t.toUpperCase()), d = o.replace(/[^\d]/g, "");
@@ -64,29 +64,29 @@ const v = ({
64
64
  placeholder: d,
65
65
  countries: a = Q,
66
66
  showSearch: f = !1,
67
- searchPlaceholder: P = "Search countries",
68
- className: O,
69
- size: z = "md",
70
- "data-testid": D,
71
- error: R,
67
+ searchPlaceholder: O = "Search countries",
68
+ className: D,
69
+ size: h = "md",
70
+ "data-testid": R,
71
+ error: k,
72
72
  // placeholder = 'Enter phone number',
73
- ...k
74
- }, A) => {
75
- const [b, L] = n.useState(!1), [T, y] = n.useState(!1), [i, V] = n.useState(
73
+ ...A
74
+ }, L) => {
75
+ const [y, z] = n.useState(!1), [T, w] = n.useState(!1), [i, V] = n.useState(
76
76
  t || a[0]?.code || "us"
77
- ), [h, w] = n.useState(""), S = n.useRef(null), I = b, g = n.useCallback((e) => {
78
- L(e), e || w("");
77
+ ), [g, S] = n.useState(""), I = n.useRef(null), N = y, x = n.useCallback((e) => {
78
+ z(e), e || S("");
79
79
  }, []), m = n.useMemo(
80
80
  () => a.find((e) => e.code === i) || a[0],
81
81
  [a, i]
82
- ), _ = n.useMemo(() => d || ee(i), [i, d]), x = q({
83
- size: z,
84
- opened: I,
82
+ ), _ = n.useMemo(() => d || ee(i), [i, d]), C = q({
83
+ size: h,
84
+ opened: N,
85
85
  inputFocused: T
86
86
  }), $ = n.useCallback(
87
87
  (e) => {
88
- if (o?.(e), g(!1), V(e.code), t && t.trim()) {
89
- const r = F(
88
+ if (o?.(e), x(!1), V(e.code), t && t.trim()) {
89
+ const r = P(
90
90
  t,
91
91
  e.code
92
92
  );
@@ -97,20 +97,20 @@ const v = ({
97
97
  });
98
98
  }
99
99
  },
100
- [o, g, t, c]
100
+ [o, x, t, c]
101
101
  ), E = n.useMemo(() => a.filter(
102
- (e) => e.name.toLowerCase().includes(h.toLowerCase()) || e.code.toLowerCase().includes(h.toLowerCase())
102
+ (e) => e.name.toLowerCase().includes(g.toLowerCase()) || e.code.toLowerCase().includes(g.toLowerCase())
103
103
  ).map((e) => ({
104
104
  label: e.name,
105
105
  value: e.code,
106
- icon: /* @__PURE__ */ s(v, { countryCode: e.code }),
106
+ icon: /* @__PURE__ */ s(F, { countryCode: e.code }),
107
107
  startIconSize: "auto",
108
108
  endIconSize: "auto",
109
- endIcon: /* @__PURE__ */ l(N, { variants: "body", size: "sm", color: "fg-neutral-subtle", children: [
109
+ endIcon: /* @__PURE__ */ l(v, { variants: "body", size: "sm", color: "fg-neutral-subtle", children: [
110
110
  "+",
111
111
  e.dial_code
112
112
  ] })
113
- })), [a, h]), B = n.useCallback(
113
+ })), [a, g]), B = n.useCallback(
114
114
  (e) => {
115
115
  const r = e.target.value, p = t, M = r.length < p.length;
116
116
  if (r.length > 20) {
@@ -127,7 +127,7 @@ const v = ({
127
127
  });
128
128
  return;
129
129
  }
130
- const j = u ? F(u, i) : "";
130
+ const j = u ? P(u, i) : "";
131
131
  c?.({
132
132
  formatted: j,
133
133
  raw: u,
@@ -137,12 +137,12 @@ const v = ({
137
137
  },
138
138
  [m, c, i, t]
139
139
  );
140
- return /* @__PURE__ */ l("div", { className: C("flex items-center", O), ref: S, children: [
140
+ return /* @__PURE__ */ l("div", { className: b("flex items-center", D), ref: I, children: [
141
141
  /* @__PURE__ */ s(
142
142
  H,
143
143
  {
144
- open: b,
145
- onOpenChange: g,
144
+ open: y,
145
+ onOpenChange: x,
146
146
  items: E,
147
147
  value: i,
148
148
  onValueChange: (e) => {
@@ -154,36 +154,36 @@ const v = ({
154
154
  align: "start",
155
155
  "data-testid": "align-start-dropdown",
156
156
  search: f,
157
- searchPlaceholder: P,
157
+ searchPlaceholder: O,
158
158
  enableVirtualization: !0,
159
159
  onSearchChange: (e) => {
160
- w(e);
160
+ S(e);
161
161
  },
162
- width: S.current?.clientWidth || "auto",
163
- children: /* @__PURE__ */ l("div", { className: x.countryButton(), children: [
164
- /* @__PURE__ */ s(v, { countryCode: i }),
162
+ width: I.current?.clientWidth || "auto",
163
+ children: /* @__PURE__ */ l("div", { className: C.countryButton(), children: [
164
+ /* @__PURE__ */ s(F, { countryCode: i }),
165
165
  /* @__PURE__ */ l("div", { className: "flex gap-xs-4", children: [
166
- /* @__PURE__ */ l(N, { variants: "body", size: "md", children: [
166
+ /* @__PURE__ */ l(v, { variants: "body", size: "md", children: [
167
167
  "+",
168
168
  m.dial_code
169
169
  ] }),
170
- /* @__PURE__ */ s(J, { name: I ? "chevron-up" : "chevron-down", size: 16 })
170
+ /* @__PURE__ */ s(J, { name: N ? "chevron-up" : "chevron-down", size: 16 })
171
171
  ] })
172
172
  ] })
173
173
  }
174
174
  ),
175
- /* @__PURE__ */ s("div", { className: x.inputContainer({ error: R }), children: /* @__PURE__ */ s(
175
+ /* @__PURE__ */ s("div", { className: C.inputContainer({ error: k, size: h }), children: /* @__PURE__ */ s(
176
176
  "input",
177
177
  {
178
- ...k,
179
- ref: A,
180
- className: C(x.input()),
178
+ ...A,
179
+ ref: L,
180
+ className: b(C.input({ size: h })),
181
181
  placeholder: _,
182
182
  value: t,
183
183
  onChange: B,
184
- onFocus: () => y(!0),
185
- onBlur: () => y(!1),
186
- "data-testid": D
184
+ onFocus: () => w(!0),
185
+ onBlur: () => w(!1),
186
+ "data-testid": R
187
187
  }
188
188
  ) })
189
189
  ] });
@@ -1,44 +1,50 @@
1
- import { jsxs as c, jsx as a } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as c } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import { Typography as f } from "../Typography/index.js";
4
4
  import s from "../Icon/Icon.js";
5
- const d = ({
6
- text: t,
7
- error: r = !1,
8
- haveIcon: n = !0,
9
- iconsCustom: l,
10
- className: m,
11
- iconsSize: e = 16
12
- }) => t ? /* @__PURE__ */ c("div", { className: `flex items-center gap-1 ${m || ""}`, children: [
13
- r && (l || /* @__PURE__ */ a(
14
- s,
15
- {
16
- name: "alert-octagon",
17
- className: "text-fg-accent-error",
18
- size: typeof e == "number" ? e : 16,
19
- variant: "solid"
20
- }
21
- )),
22
- n && !r && /* @__PURE__ */ a(
23
- s,
24
- {
25
- name: "help-circle",
26
- variant: "line",
27
- className: "text-fg-neutral-subtle",
28
- size: typeof e == "number" ? e : 16
29
- }
30
- ),
31
- /* @__PURE__ */ a("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ a(
32
- f,
33
- {
34
- variants: "paragraph",
35
- size: "sm",
36
- color: r ? "fg-accent-error" : "fg-neutral-subtle",
37
- className: "font-body-sm",
38
- children: t
39
- }
40
- ) })
41
- ] }) : null;
5
+ const p = ({
6
+ text: l,
7
+ error: a = !1,
8
+ haveIcon: i = !0,
9
+ iconsCustom: r,
10
+ className: n,
11
+ iconsSize: t = 16
12
+ }) => l ? /* @__PURE__ */ e(
13
+ "div",
14
+ {
15
+ className: `self-stretch inline-flex flex-col justify-start items-start ${n || ""}`,
16
+ children: /* @__PURE__ */ c("div", { className: "self-stretch inline-flex justify-start items-start gap-1", children: [
17
+ a && (r ? /* @__PURE__ */ e("div", { className: "w-5 h-5 relative", children: r }) : /* @__PURE__ */ e("div", { className: "w-5 h-5 relative", children: /* @__PURE__ */ e(
18
+ s,
19
+ {
20
+ name: "alert-octagon",
21
+ className: "text-fg-accent-error",
22
+ variant: "solid",
23
+ size: typeof t == "number" ? t : 16
24
+ }
25
+ ) })),
26
+ i && !a && /* @__PURE__ */ e("div", { className: "w-5 h-5 relative", children: /* @__PURE__ */ e(
27
+ s,
28
+ {
29
+ name: "help-circle",
30
+ variant: "line",
31
+ className: "text-fg-neutral-subtle",
32
+ size: typeof t == "number" ? t : 16
33
+ }
34
+ ) }),
35
+ /* @__PURE__ */ e("div", { className: "flex-1 justify-start text-left flex flex-wrap items-center gap-0", children: /* @__PURE__ */ e(
36
+ f,
37
+ {
38
+ variants: "body",
39
+ size: "md",
40
+ color: a ? "fg-accent-error-strong" : "fg-neutral-subtle",
41
+ className: "inline",
42
+ children: l
43
+ }
44
+ ) })
45
+ ] })
46
+ }
47
+ ) : null;
42
48
  export {
43
- d as default
49
+ p as default
44
50
  };
@@ -1,51 +1,51 @@
1
1
  import { jsxs as r, jsx as a } from "react/jsx-runtime";
2
- import { forwardRef as T, memo as p } from "react";
2
+ import { forwardRef as b, memo as p } from "react";
3
3
  import I from "../InputBase/index.js";
4
- import { Typography as n } from "../Typography/index.js";
4
+ import { Typography as m } from "../Typography/index.js";
5
5
  import H from "./HelperText.js";
6
6
  import "clsx";
7
7
  import "tailwind-merge";
8
8
  import { dataTestId as A } from "../../shared/utils/dataTestId.js";
9
- const d = T(
9
+ const d = b(
10
10
  ({
11
- label: s,
11
+ label: n,
12
12
  helpText: x,
13
- error: l,
13
+ error: s,
14
14
  color: f,
15
15
  disabled: o,
16
16
  readOnly: u,
17
- width: c,
17
+ width: l,
18
18
  type: i,
19
19
  iconsCustom: g,
20
- iconsSize: m = 24,
20
+ iconsSize: c,
21
21
  fontSize: h,
22
22
  optionalProps: e,
23
23
  indicatorLength: v,
24
24
  haveIcon: y,
25
25
  // inputSize = 'md',
26
- clearText: b,
26
+ clearText: N,
27
27
  ...t
28
- }, N) => /* @__PURE__ */ r(
28
+ }, T) => /* @__PURE__ */ r(
29
29
  "div",
30
30
  {
31
31
  style: {
32
- width: c
32
+ width: l
33
33
  },
34
34
  ...A("TextField"),
35
35
  children: [
36
36
  /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
37
- s && /* @__PURE__ */ r("div", { className: "mb-1 flex items-center gap-[2px]", children: [
37
+ n && /* @__PURE__ */ r("div", { className: "mb-1 flex items-center gap-[2px]", children: [
38
38
  /* @__PURE__ */ a(
39
- n,
39
+ m,
40
40
  {
41
41
  variants: "action",
42
42
  size: "sm",
43
43
  color: "fg-neutral-subtle",
44
- children: s
44
+ children: n
45
45
  }
46
46
  ),
47
47
  t.required && /* @__PURE__ */ a(
48
- n,
48
+ m,
49
49
  {
50
50
  variants: "action",
51
51
  size: "sm",
@@ -56,7 +56,7 @@ const d = T(
56
56
  )
57
57
  ] }),
58
58
  i === "textarea" && e?.showIndicator && /* @__PURE__ */ r(
59
- n,
59
+ m,
60
60
  {
61
61
  variants: "action",
62
62
  size: "sm",
@@ -74,15 +74,15 @@ const d = T(
74
74
  /* @__PURE__ */ a(
75
75
  I,
76
76
  {
77
- ref: N,
77
+ ref: T,
78
78
  disabled: o,
79
79
  readOnly: u,
80
- width: c,
80
+ width: l,
81
81
  type: i,
82
82
  fontSize: h,
83
- iconsSize: typeof m == "number" ? m : 24,
83
+ iconsSize: c,
84
84
  optionalProps: e,
85
- clearText: b,
85
+ clearText: N,
86
86
  InputComponent: i === "textarea" ? /* @__PURE__ */ a(
87
87
  "textarea",
88
88
  {
@@ -96,7 +96,7 @@ const d = T(
96
96
  }
97
97
  ) : void 0,
98
98
  ...t,
99
- color: l ? "error" : f || "primary"
99
+ color: s ? "error" : f || "primary"
100
100
  }
101
101
  ),
102
102
  /* @__PURE__ */ a(
@@ -104,9 +104,9 @@ const d = T(
104
104
  {
105
105
  className: "mt-1",
106
106
  text: x,
107
- error: l,
107
+ error: s,
108
108
  haveIcon: y,
109
- iconsSize: m,
109
+ iconsSize: c,
110
110
  iconsCustom: g
111
111
  }
112
112
  )
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mcr-design-systems",
3
3
  "private": false,
4
- "version": "1.0.11",
4
+ "version": "1.0.13",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",