@bridge-ui/vue 0.17.2 → 0.17.3

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.
@@ -193,7 +193,7 @@ function _(p, _, v, y) {
193
193
  }))), Pe = r(() => n(T.value?.end, {}, g({
194
194
  "flex min-w-72 flex-1 flex-col px-2.5 pb-2.5": !0,
195
195
  [E.value.end ?? ""]: !0
196
- }))), Fe = r(() => g({ "absolute inset-0 z-10 flex flex-col bg-white p-2.5 dark:bg-dark-900": !0 })), Z = r(() => n(T.value?.selector, {
196
+ }))), Fe = r(() => g({ "absolute inset-0 z-10 flex flex-col bg-white p-2.5 dark:bg-dark-800": !0 })), Z = r(() => n(T.value?.selector, {
197
197
  type: "button",
198
198
  disabled: C.value.disabled
199
199
  }, g({
@@ -66,7 +66,7 @@ function g(g, _) {
66
66
  class: p({
67
67
  "pointer-events-none absolute z-20 flex min-w-32 flex-col": !0,
68
68
  "rounded-md border border-dark-200 bg-white text-dark-700 shadow-lg": !0,
69
- "dark:border-dark-700 dark:bg-dark-900 dark:text-dark-100": !0,
69
+ "dark:border-dark-700 dark:bg-dark-800 dark:text-dark-100": !0,
70
70
  [y.value.tokenClasses.tooltip ?? ""]: !0,
71
71
  [c(w.value, "root") ?? ""]: !0
72
72
  })
@@ -111,7 +111,7 @@ function E(f, E, D, O) {
111
111
  let t = e.shiftKey ? .1 : .01;
112
112
  e.key === "ArrowLeft" || e.key === "ArrowDown" ? (e.preventDefault(), Z({ a: z.value.a - t })) : (e.key === "ArrowRight" || e.key === "ArrowUp") && (e.preventDefault(), Z({ a: z.value.a + t }));
113
113
  }, me = a(() => t(P.value?.root, F.value, x({
114
- "flex flex-col overflow-hidden bg-white shadow-lg dark:bg-dark-900": !0,
114
+ "flex flex-col overflow-hidden bg-white shadow-lg dark:bg-dark-800": !0,
115
115
  "w-full": M.value.fill,
116
116
  "w-72": !M.value.fill,
117
117
  [K.value]: !0,
@@ -66,7 +66,7 @@ function g(g, _, v, y) {
66
66
  rootBind: i(() => {
67
67
  let t = u(f, C.value.rounded ?? "md");
68
68
  return e(T.value?.root, E.value, p({
69
- "flex flex-col overflow-hidden bg-white shadow-lg dark:bg-dark-900": !0,
69
+ "flex flex-col overflow-hidden bg-white shadow-lg dark:bg-dark-800": !0,
70
70
  "w-full": C.value.fill,
71
71
  "w-fit": !C.value.fill,
72
72
  [t]: !0,
@@ -65,7 +65,7 @@ function g(g, _, v, y) {
65
65
  rootBind: i(() => {
66
66
  let t = u(f, C.value.rounded ?? "md");
67
67
  return e(T.value?.root, E.value, p({
68
- "flex flex-col overflow-hidden bg-white shadow-lg dark:bg-dark-900": !0,
68
+ "flex flex-col overflow-hidden bg-white shadow-lg dark:bg-dark-800": !0,
69
69
  "w-full": C.value.fill,
70
70
  "w-fit": !C.value.fill,
71
71
  [t]: !0,
@@ -63,7 +63,7 @@ function x(x, S, C, w) {
63
63
  }, U = a(() => {
64
64
  let e = d(_, k.value.rounded ?? "md");
65
65
  return t(j.value?.root, M.value, v({
66
- "flex flex-col overflow-hidden bg-white shadow-lg dark:bg-dark-900": !0,
66
+ "flex flex-col overflow-hidden bg-white shadow-lg dark:bg-dark-800": !0,
67
67
  "w-full": k.value.fill,
68
68
  "w-fit": !k.value.fill,
69
69
  [e]: !0,
@@ -74,7 +74,7 @@ function b(b, x, S, C) {
74
74
  }, G = a(() => {
75
75
  let e = d(h, O.value.rounded ?? "md");
76
76
  return t(A.value?.root, j.value, g({
77
- "flex flex-col overflow-hidden bg-white shadow-lg dark:bg-dark-900": !0,
77
+ "flex flex-col overflow-hidden bg-white shadow-lg dark:bg-dark-800": !0,
78
78
  "w-full": O.value.fill,
79
79
  "w-fit": !O.value.fill,
80
80
  [e]: !0,
@@ -131,6 +131,7 @@ function b(b, x, S = {}) {
131
131
  required: M.value.required,
132
132
  root: h({
133
133
  [Q.value?.label ?? ""]: L.value,
134
+ [Q.value?.labelDisabled ?? ""]: L.value && P.value && !N.value,
134
135
  [M.value.label ?? ""]: !0
135
136
  })
136
137
  }
@@ -144,6 +145,7 @@ function b(b, x, S = {}) {
144
145
  size: D.value.size,
145
146
  classes: { root: h({
146
147
  [Q.value?.corner ?? ""]: L.value,
148
+ [Q.value?.cornerDisabled ?? ""]: L.value && P.value && !N.value,
147
149
  [M.value.corner ?? ""]: !0
148
150
  }) }
149
151
  })), pe = o(() => {
@@ -202,11 +204,11 @@ function b(b, x, S = {}) {
202
204
  "group/field relative flex flex-row items-stretch overflow-hidden": R.value,
203
205
  "group/field relative flex justify-start gap-x-2 items-stretch": !R.value,
204
206
  "transition-all ease-in-out duration-150 outline-none": !0,
205
- "bg-dark-100 dark:bg-dark-800": P.value && !N.value,
206
207
  [X.value?.container ?? ""]: !B.value,
207
208
  [X.value?.containerTextareaLikeInput ?? ""]: V.value,
208
209
  [X.value?.containerTextarea ?? ""]: B.value && !V.value,
209
210
  [Q.value?.container ?? ""]: !0,
211
+ [Q.value?.containerDisabled ?? ""]: P.value && !N.value,
210
212
  [ne.value ?? ""]: !z.value,
211
213
  [ae.value ?? ""]: !0,
212
214
  [re.value ?? ""]: !0,
@@ -2,11 +2,11 @@ import { mergePartBind as e, useBridgeUIComponent as t, useBridgeUIMergedRegistr
2
2
  import { baseFieldBridgeKeys as r, useBaseField as i } from "../../BaseField/composables/useBaseField.js";
3
3
  import { computed as a, nextTick as o, onMounted as ee, ref as s, toValue as c, useAttrs as te } from "vue";
4
4
  import { get as l, isUndefined as ne, omit as re, pick as ie } from "es-toolkit/compat";
5
- import { applyOtpInput as u, applyOtpKeyNavigation as d, applyOtpPaste as f, isOtpComplete as p, joinOtpDigits as m, normalizeOtpValue as h, resolveOtpLength as g, splitOtpValue as _ } from "@bridge-ui/core/Domain";
6
- import { otpFieldColorProps as v, otpFieldRoundedProps as y, otpFieldSizeProps as b, otpFieldVariantProps as x } from "@bridge-ui/core/Tokens";
7
- import { cn as S, getColorToken as ae, mergeBridgeUILayeredClasses as C, splitComponentProps as oe } from "@bridge-ui/core/Utils";
5
+ import { applyOtpInput as ae, applyOtpKeyNavigation as u, applyOtpPaste as d, isOtpComplete as f, joinOtpDigits as p, normalizeOtpValue as m, resolveOtpLength as h, splitOtpValue as g } from "@bridge-ui/core/Domain";
6
+ import { otpFieldColorProps as _, otpFieldRoundedProps as v, otpFieldSizeProps as y, otpFieldVariantProps as b } from "@bridge-ui/core/Tokens";
7
+ import { cn as x, getColorToken as oe, mergeBridgeUILayeredClasses as S, splitComponentProps as se } from "@bridge-ui/core/Utils";
8
8
  //#region src/Components/OtpField/composables/useOtpField.ts
9
- var w = [
9
+ var C = [
10
10
  "mask",
11
11
  "type",
12
12
  "color",
@@ -18,12 +18,12 @@ var w = [
18
18
  "defaultValue",
19
19
  ...r
20
20
  ];
21
- function se(e) {
21
+ function ce(e) {
22
22
  if (!e) return;
23
23
  let { pin: t, input: n, ...r } = e;
24
24
  return r;
25
25
  }
26
- function T(T, E, D = {}, O = {
26
+ function w(w, T, E = {}, D = {
27
27
  length: 6,
28
28
  size: "md",
29
29
  rounded: "md",
@@ -31,139 +31,140 @@ function T(T, E, D = {}, O = {
31
31
  color: "primary",
32
32
  variant: "outline"
33
33
  }) {
34
- let k = te(), A = s([]), j = a(() => oe({
35
- bridgeKeys: w,
34
+ let O = te(), k = s([]), A = a(() => se({
35
+ bridgeKeys: C,
36
36
  props: {
37
- ...k,
38
- ...c(T)
37
+ ...O,
38
+ ...c(w)
39
39
  }
40
- })), { merged: M, entry: N } = t({
41
- libDefaults: O,
40
+ })), { merged: j, entry: M } = t({
41
+ libDefaults: D,
42
42
  chrome: "BaseField",
43
43
  componentName: "OtpField",
44
- props: () => j.value.componentProps
45
- }), P = n({
46
- entry: N,
47
- props: () => j.value.componentProps
48
- }), F = a(() => M.value.customProps), I = a(() => se(M.value.customProps)), L = a(() => ({
49
- ...ie(j.value.componentProps, r),
50
- customProps: I.value,
51
- id: j.value.inheritedAttrs.id,
52
- class: j.value.inheritedAttrs.class,
53
- ...re(j.value.inheritedAttrs, ["class", "id"])
54
- })), R = i(() => L.value, {
44
+ props: () => A.value.componentProps
45
+ }), N = n({
46
+ entry: M,
47
+ props: () => A.value.componentProps
48
+ }), P = a(() => j.value.customProps), F = a(() => ce(j.value.customProps)), I = a(() => ({
49
+ ...ie(A.value.componentProps, r),
50
+ customProps: F.value,
51
+ id: A.value.inheritedAttrs.id,
52
+ class: A.value.inheritedAttrs.class,
53
+ ...re(A.value.inheritedAttrs, ["class", "id"])
54
+ })), L = i(() => I.value, {
55
55
  size: "md",
56
56
  hideErrorMessage: !1
57
57
  }, {
58
58
  componentName: "OtpField",
59
59
  labelHtmlFor: (e) => `${e}-0`
60
- }), { controlId: z, isDisabled: B, isReadonly: V, invalidated: H, ariaDescribedBy: U } = R, W = a(() => g(M.value.length)), G = a(() => M.value.type ?? "numeric"), K = a(() => M.value.variant ?? "outline"), q = a(() => K.value === "underlined"), J = a(() => !ne(E.value)), Y = s(h(c(T).defaultValue, W.value, G.value)), ce = a(() => J.value ? h(E.value, W.value, G.value) : Y.value), X = a(() => _(ce.value, W.value));
60
+ }), { controlId: R, isDisabled: z, isReadonly: B, invalidated: V, ariaDescribedBy: H } = L, U = a(() => h(j.value.length)), W = a(() => j.value.type ?? "numeric"), G = a(() => j.value.variant ?? "outline"), K = a(() => G.value === "underlined"), q = a(() => !ne(T.value)), J = s(m(c(w).defaultValue, U.value, W.value)), le = a(() => q.value ? m(T.value, U.value, W.value) : J.value), Y = a(() => g(le.value, U.value));
61
61
  ee(() => {
62
- if (!M.value.autoFocus || B.value || V.value) return;
63
- let e = X.value.findIndex((e) => e === ""), t = e === -1 ? 0 : e;
64
- A.value[t]?.focus();
62
+ if (!j.value.autoFocus || z.value || B.value) return;
63
+ let e = Y.value.findIndex((e) => e === ""), t = e === -1 ? 0 : e;
64
+ k.value[t]?.focus();
65
65
  });
66
- let Z = (e, t) => {
67
- let n = m(e);
68
- J.value || (Y.value = n), E.value = n, D.onChange?.(n), p(n, W.value) && D.onComplete?.(n), t != null && o(() => {
69
- A.value[t]?.focus(), A.value[t]?.select();
66
+ let X = (e, t) => {
67
+ let n = p(e);
68
+ q.value || (J.value = n), T.value = n, E.onChange?.(n), f(n, U.value) && E.onComplete?.(n), t != null && o(() => {
69
+ k.value[t]?.focus(), k.value[t]?.select();
70
70
  });
71
- }, Q = a(() => {
72
- let e = C(b, N.value?.tokens?.size);
73
- return l(e, M.value.size ?? "md");
74
- }), $ = a(() => {
75
- let e = C(v, N.value?.tokens?.color);
76
- return ae({
71
+ }, Z = a(() => {
72
+ let e = S(y, M.value?.tokens?.size);
73
+ return l(e, j.value.size ?? "md");
74
+ }), Q = a(() => {
75
+ let e = S(_, M.value?.tokens?.color);
76
+ return oe({
77
77
  tokens: e,
78
- color: M.value.color,
79
- invalid: H.value
78
+ color: j.value.color,
79
+ invalid: V.value
80
80
  });
81
- }), le = a(() => {
82
- let e = C(y, N.value?.tokens?.rounded);
83
- return l(e, M.value.rounded ?? "md");
84
81
  }), ue = a(() => {
85
- let e = C(x, N.value?.tokens?.variant);
86
- return l(e, K.value);
82
+ let e = S(v, M.value?.tokens?.rounded);
83
+ return l(e, j.value.rounded ?? "md");
84
+ }), $ = a(() => {
85
+ let e = S(b, M.value?.tokens?.variant);
86
+ return l(e, G.value);
87
87
  });
88
88
  return {
89
- merged: M,
90
- digits: X,
91
- length: W,
92
- pinBind: (t) => e(F.value?.pin, {}, S({
89
+ merged: j,
90
+ digits: Y,
91
+ length: U,
92
+ pinBind: (t) => e(P.value?.pin, {}, x({
93
93
  "relative flex shrink-0 items-center justify-center overflow-hidden": !0,
94
- [Q.value?.pin ?? ""]: !0,
95
- [ue.value?.pin ?? ""]: !0,
96
- [le.value?.pin ?? ""]: !q.value,
97
- [$.value?.pin ?? ""]: !q.value,
98
- [$.value?.underlined ?? ""]: q.value,
99
- "bg-error-50 ring-error-500 dark:bg-error-700/10 dark:ring-error-600": H.value && !q.value,
100
- "border-error-500 dark:border-error-600": H.value && q.value,
101
- [P.value.pin ?? ""]: !0
94
+ [Z.value?.pin ?? ""]: !0,
95
+ [$.value?.pin ?? ""]: !0,
96
+ [$.value?.pinDisabled ?? ""]: z.value && !V.value,
97
+ [ue.value?.pin ?? ""]: !K.value,
98
+ [Q.value?.pin ?? ""]: !K.value,
99
+ [Q.value?.underlined ?? ""]: K.value,
100
+ "bg-error-50 ring-error-500 dark:bg-error-700/10 dark:ring-error-600": V.value && !K.value,
101
+ "border-error-500 dark:border-error-600": V.value && K.value,
102
+ [N.value.pin ?? ""]: !0
102
103
  })),
103
- pinsBind: a(() => e({}, {}, S({
104
+ pinsBind: a(() => e({}, {}, x({
104
105
  "flex flex-wrap items-center": !0,
105
- [R.sizeClasses.value?.group ?? ""]: !0
106
+ [L.sizeClasses.value?.group ?? ""]: !0
106
107
  }))),
107
- baseField: R,
108
+ baseField: L,
108
109
  inputBind: (t) => {
109
- let n = G.value === "numeric" ? "numeric" : "text";
110
+ let n = W.value === "numeric" ? "numeric" : "text";
110
111
  return e({
111
- ...F.value?.input,
112
+ ...P.value?.input,
112
113
  inputmode: n,
113
- maxlength: W.value,
114
- disabled: B.value,
115
- readOnly: V.value,
116
- value: X.value[t] ?? "",
117
- id: `${z.value}-${t}`,
118
- placeholder: M.value.placeholder,
119
- "aria-describedby": U.value,
120
- type: M.value.mask ? "password" : "text",
121
- "aria-invalid": H.value || void 0,
114
+ maxlength: U.value,
115
+ disabled: z.value,
116
+ readOnly: B.value,
117
+ value: Y.value[t] ?? "",
118
+ id: `${R.value}-${t}`,
119
+ placeholder: j.value.placeholder,
120
+ "aria-describedby": H.value,
121
+ type: j.value.mask ? "password" : "text",
122
+ "aria-invalid": V.value || void 0,
122
123
  autocomplete: t === 0 ? "one-time-code" : "off",
123
- "aria-label": `Digit ${t + 1} of ${W.value}`
124
- }, {}, S({
124
+ "aria-label": `Digit ${t + 1} of ${U.value}`
125
+ }, {}, x({
125
126
  "h-full w-full min-w-0 bg-transparent border-0 shadow-none text-center": !0,
126
127
  "text-dark-900 dark:text-dark-100 placeholder:text-dark-400": !0,
127
128
  "outline-none ring-0 focus:outline-none focus:ring-0": !0,
128
129
  "disabled:cursor-not-allowed": !0,
129
- [Q.value?.input ?? ""]: !0,
130
- [P.value.input ?? ""]: !0
130
+ [Z.value?.input ?? ""]: !0,
131
+ [N.value.input ?? ""]: !0
131
132
  }));
132
133
  },
133
134
  setPinRef: (e, t) => {
134
- A.value[e] = t;
135
+ k.value[e] = t;
135
136
  },
136
- inputType: G,
137
+ inputType: W,
137
138
  handlePinInput: (e, t) => {
138
- let n = t.target.value, r = u({
139
+ let n = t.target.value, r = ae({
139
140
  index: e,
140
141
  input: n,
141
- digits: X.value,
142
- type: G.value
142
+ digits: Y.value,
143
+ type: W.value
143
144
  });
144
- Z(r.digits, r.focusIndex);
145
+ X(r.digits, r.focusIndex);
145
146
  },
146
147
  handlePinFocus: (e) => {
147
- A.value[e]?.select();
148
+ k.value[e]?.select();
148
149
  },
149
150
  handlePinPaste: (e, t) => {
150
- let n = t.clipboardData?.getData("text") ?? "", r = f({
151
+ let n = t.clipboardData?.getData("text") ?? "", r = d({
151
152
  index: e,
152
153
  pasted: n,
153
- digits: X.value,
154
- type: G.value
154
+ digits: Y.value,
155
+ type: W.value
155
156
  });
156
- r.focusIndex == null && r.digits.every((e, t) => e === X.value[t]) || (t.preventDefault(), Z(r.digits, r.focusIndex));
157
+ r.focusIndex == null && r.digits.every((e, t) => e === Y.value[t]) || (t.preventDefault(), X(r.digits, r.focusIndex));
157
158
  },
158
159
  handlePinKeyDown: (e, t) => {
159
- let n = d({
160
+ let n = u({
160
161
  index: e,
161
162
  key: t.key,
162
- digits: X.value
163
+ digits: Y.value
163
164
  });
164
- n && (t.preventDefault(), Z(n.digits, n.focusIndex));
165
+ n && (t.preventDefault(), X(n.digits, n.focusIndex));
165
166
  }
166
167
  };
167
168
  }
168
169
  //#endregion
169
- export { w as otpFieldBridgeKeys, T as useOtpField };
170
+ export { C as otpFieldBridgeKeys, w as useOtpField };
@@ -66,7 +66,7 @@ function g(g, _, v, y) {
66
66
  }, P = i(() => {
67
67
  let t = u(f, C.value.rounded ?? "md");
68
68
  return e(T.value?.root, E.value, p({
69
- "flex flex-col overflow-hidden bg-white shadow-lg dark:bg-dark-900": !0,
69
+ "flex flex-col overflow-hidden bg-white shadow-lg dark:bg-dark-800": !0,
70
70
  "w-full": C.value.fill,
71
71
  "w-fit": !C.value.fill,
72
72
  [t]: !0,
@@ -80,7 +80,7 @@ function b(b, x, S, C) {
80
80
  }, G = o(() => {
81
81
  let e = f(g, k.value.rounded ?? "md");
82
82
  return n(j.value?.root, M.value, _({
83
- "flex flex-col overflow-hidden bg-white shadow-lg dark:bg-dark-900": !0,
83
+ "flex flex-col overflow-hidden bg-white shadow-lg dark:bg-dark-800": !0,
84
84
  "w-full": k.value.fill,
85
85
  "w-fit": !k.value.fill,
86
86
  [e]: !0,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "license": "MIT",
4
- "version": "0.17.2",
4
+ "version": "0.17.3",
5
5
  "author": "BridgeUI",
6
6
  "sideEffects": false,
7
7
  "name": "@bridge-ui/vue",
@@ -109,7 +109,7 @@
109
109
  }
110
110
  },
111
111
  "dependencies": {
112
- "@bridge-ui/core": "^0.17.2",
112
+ "@bridge-ui/core": "^0.17.3",
113
113
  "@tailwindcss/typography": "^0.5.20",
114
114
  "clsx": "^2.1.1",
115
115
  "es-toolkit": "^1.52.0",