@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.
- package/dist/Components/CalendarRange/composables/useCalendarRange.js +1 -1
- package/dist/Components/ChartTooltip/composables/useChartTooltip.js +1 -1
- package/dist/Components/ColorPicker/composables/useColorPicker.js +1 -1
- package/dist/Components/DatePicker/composables/useDatePicker.js +1 -1
- package/dist/Components/DateRangePicker/composables/useDateRangePicker.js +1 -1
- package/dist/Components/DateTimePicker/composables/useDateTimePicker.js +1 -1
- package/dist/Components/DateTimeRangePicker/composables/useDateTimeRangePicker.js +1 -1
- package/dist/Components/FormField/composables/useFormField.js +3 -1
- package/dist/Components/OtpField/composables/useOtpField.js +90 -89
- package/dist/Components/TimePicker/composables/useTimePicker.js +1 -1
- package/dist/Components/TimeRangePicker/composables/useTimeRangePicker.js +1 -1
- package/package.json +2 -2
|
@@ -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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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
|
|
6
|
-
import { otpFieldColorProps as
|
|
7
|
-
import { cn as
|
|
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
|
|
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
|
|
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
|
|
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
|
|
35
|
-
bridgeKeys:
|
|
34
|
+
let O = te(), k = s([]), A = a(() => se({
|
|
35
|
+
bridgeKeys: C,
|
|
36
36
|
props: {
|
|
37
|
-
...
|
|
38
|
-
...c(
|
|
37
|
+
...O,
|
|
38
|
+
...c(w)
|
|
39
39
|
}
|
|
40
|
-
})), { merged:
|
|
41
|
-
libDefaults:
|
|
40
|
+
})), { merged: j, entry: M } = t({
|
|
41
|
+
libDefaults: D,
|
|
42
42
|
chrome: "BaseField",
|
|
43
43
|
componentName: "OtpField",
|
|
44
|
-
props: () =>
|
|
45
|
-
}),
|
|
46
|
-
entry:
|
|
47
|
-
props: () =>
|
|
48
|
-
}),
|
|
49
|
-
...ie(
|
|
50
|
-
customProps:
|
|
51
|
-
id:
|
|
52
|
-
class:
|
|
53
|
-
...re(
|
|
54
|
-
})),
|
|
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:
|
|
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 (!
|
|
63
|
-
let e =
|
|
64
|
-
|
|
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
|
|
67
|
-
let n =
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
},
|
|
72
|
-
let e =
|
|
73
|
-
return l(e,
|
|
74
|
-
}),
|
|
75
|
-
let e =
|
|
76
|
-
return
|
|
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:
|
|
79
|
-
invalid:
|
|
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 =
|
|
86
|
-
return l(e,
|
|
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:
|
|
90
|
-
digits:
|
|
91
|
-
length:
|
|
92
|
-
pinBind: (t) => e(
|
|
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
|
-
[
|
|
95
|
-
[
|
|
96
|
-
[
|
|
97
|
-
[
|
|
98
|
-
[
|
|
99
|
-
|
|
100
|
-
"
|
|
101
|
-
|
|
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({}, {},
|
|
104
|
+
pinsBind: a(() => e({}, {}, x({
|
|
104
105
|
"flex flex-wrap items-center": !0,
|
|
105
|
-
[
|
|
106
|
+
[L.sizeClasses.value?.group ?? ""]: !0
|
|
106
107
|
}))),
|
|
107
|
-
baseField:
|
|
108
|
+
baseField: L,
|
|
108
109
|
inputBind: (t) => {
|
|
109
|
-
let n =
|
|
110
|
+
let n = W.value === "numeric" ? "numeric" : "text";
|
|
110
111
|
return e({
|
|
111
|
-
...
|
|
112
|
+
...P.value?.input,
|
|
112
113
|
inputmode: n,
|
|
113
|
-
maxlength:
|
|
114
|
-
disabled:
|
|
115
|
-
readOnly:
|
|
116
|
-
value:
|
|
117
|
-
id: `${
|
|
118
|
-
placeholder:
|
|
119
|
-
"aria-describedby":
|
|
120
|
-
type:
|
|
121
|
-
"aria-invalid":
|
|
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 ${
|
|
124
|
-
}, {},
|
|
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
|
-
[
|
|
130
|
-
[
|
|
130
|
+
[Z.value?.input ?? ""]: !0,
|
|
131
|
+
[N.value.input ?? ""]: !0
|
|
131
132
|
}));
|
|
132
133
|
},
|
|
133
134
|
setPinRef: (e, t) => {
|
|
134
|
-
|
|
135
|
+
k.value[e] = t;
|
|
135
136
|
},
|
|
136
|
-
inputType:
|
|
137
|
+
inputType: W,
|
|
137
138
|
handlePinInput: (e, t) => {
|
|
138
|
-
let n = t.target.value, r =
|
|
139
|
+
let n = t.target.value, r = ae({
|
|
139
140
|
index: e,
|
|
140
141
|
input: n,
|
|
141
|
-
digits:
|
|
142
|
-
type:
|
|
142
|
+
digits: Y.value,
|
|
143
|
+
type: W.value
|
|
143
144
|
});
|
|
144
|
-
|
|
145
|
+
X(r.digits, r.focusIndex);
|
|
145
146
|
},
|
|
146
147
|
handlePinFocus: (e) => {
|
|
147
|
-
|
|
148
|
+
k.value[e]?.select();
|
|
148
149
|
},
|
|
149
150
|
handlePinPaste: (e, t) => {
|
|
150
|
-
let n = t.clipboardData?.getData("text") ?? "", r =
|
|
151
|
+
let n = t.clipboardData?.getData("text") ?? "", r = d({
|
|
151
152
|
index: e,
|
|
152
153
|
pasted: n,
|
|
153
|
-
digits:
|
|
154
|
-
type:
|
|
154
|
+
digits: Y.value,
|
|
155
|
+
type: W.value
|
|
155
156
|
});
|
|
156
|
-
r.focusIndex == null && r.digits.every((e, t) => e ===
|
|
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 =
|
|
160
|
+
let n = u({
|
|
160
161
|
index: e,
|
|
161
162
|
key: t.key,
|
|
162
|
-
digits:
|
|
163
|
+
digits: Y.value
|
|
163
164
|
});
|
|
164
|
-
n && (t.preventDefault(),
|
|
165
|
+
n && (t.preventDefault(), X(n.digits, n.focusIndex));
|
|
165
166
|
}
|
|
166
167
|
};
|
|
167
168
|
}
|
|
168
169
|
//#endregion
|
|
169
|
-
export {
|
|
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-
|
|
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-
|
|
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.
|
|
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.
|
|
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",
|