@soft-stech/bootsman-ui-shadcn 2.0.29 → 2.0.30
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/input/BuiInput.vue.d.ts +1 -0
- package/dist/components/input/BuiPasswordInput.vue.d.ts +1 -0
- package/dist/components/input/index.js +62 -54
- package/package.json +1 -1
- package/src/components/input/BuiInput.vue +6 -0
- package/src/components/input/BuiPasswordInput.vue +7 -1
- package/src/stories/BuiInput.stories.ts +16 -1
|
@@ -9,6 +9,7 @@ type __VLS_Props = {
|
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
placeholder?: string;
|
|
11
11
|
type?: string;
|
|
12
|
+
disableAutocomplete?: boolean;
|
|
12
13
|
};
|
|
13
14
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
14
15
|
"update:modelValue": (payload: string | number) => any;
|
|
@@ -2,6 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
defaultValue?: 'password' | 'text';
|
|
3
3
|
showPasswordTranslation?: string;
|
|
4
4
|
hidePasswordTranslation?: string;
|
|
5
|
+
disableAutocomplete?: boolean;
|
|
5
6
|
};
|
|
6
7
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
7
8
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { h as B, F as
|
|
2
|
-
import { defineComponent as x, inject as
|
|
3
|
-
import { useVModel as J, useElementBounding as
|
|
1
|
+
import { h as B, F as j, g as w, _ as N, j as O } from "../../utils-0oqGu8T-.js";
|
|
2
|
+
import { defineComponent as x, inject as S, toRef as z, ref as v, useTemplateRef as X, createElementBlock as _, withDirectives as E, openBlock as d, createBlock as g, createCommentVNode as R, createElementVNode as b, unref as a, normalizeClass as k, isRef as F, vModelText as G, withCtx as y, createVNode as n, vModelDynamic as H, computed as $, mergeProps as T, createTextVNode as K, toDisplayString as L, mergeModels as Y, useModel as q, watch as I, normalizeStyle as M } from "vue";
|
|
3
|
+
import { useVModel as J, useElementBounding as D } from "@vueuse/core";
|
|
4
4
|
import { c as Q, d as P } from "../../colorUtils-BgA4kYw8.js";
|
|
5
5
|
import { BuiBadge as W } from "../badge/index.js";
|
|
6
6
|
import "vee-validate";
|
|
@@ -8,14 +8,14 @@ import { _ as Z } from "../../BuiPopover.vue_vue_type_script_setup_true_lang-C21
|
|
|
8
8
|
import { _ as ee } from "../../BuiPopoverTrigger.vue_vue_type_script_setup_true_lang-DRd7CSVn.js";
|
|
9
9
|
import { _ as ae } from "../../BuiPopoverContent.vue_vue_type_script_setup_true_lang-C_C9SYpz.js";
|
|
10
10
|
import { BuiColorPicker as te } from "../color-picker/index.js";
|
|
11
|
-
import { X as
|
|
11
|
+
import { X as oe } from "../../x-Cbjb1tT_.js";
|
|
12
12
|
/**
|
|
13
13
|
* @license lucide-vue-next v0.544.0 - ISC
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the ISC license.
|
|
16
16
|
* See the LICENSE file in the root directory of this source tree.
|
|
17
17
|
*/
|
|
18
|
-
const
|
|
18
|
+
const le = B("eye-off", [
|
|
19
19
|
[
|
|
20
20
|
"path",
|
|
21
21
|
{
|
|
@@ -70,7 +70,7 @@ const re = B("palette", [
|
|
|
70
70
|
]), ne = {
|
|
71
71
|
key: 0,
|
|
72
72
|
class: "group relative flex flex-row items-center"
|
|
73
|
-
}, de = ["readonly", "disabled", "placeholder"], ie = ["readonly", "disabled", "placeholder", "type"], C = /* @__PURE__ */ x({
|
|
73
|
+
}, de = ["readonly", "disabled", "placeholder"], ie = ["readonly", "disabled", "placeholder", "type", "autocomplete", "data-1p-ignore", "data-lpignore", "data-protonpass-ignore", "data-bwignore"], C = /* @__PURE__ */ x({
|
|
74
74
|
__name: "BuiInput",
|
|
75
75
|
props: {
|
|
76
76
|
defaultValue: {},
|
|
@@ -80,30 +80,31 @@ const re = B("palette", [
|
|
|
80
80
|
readonly: { type: [Boolean, String] },
|
|
81
81
|
disabled: { type: Boolean },
|
|
82
82
|
placeholder: {},
|
|
83
|
-
type: {}
|
|
83
|
+
type: {},
|
|
84
|
+
disableAutocomplete: { type: Boolean }
|
|
84
85
|
},
|
|
85
86
|
emits: ["update:modelValue"],
|
|
86
|
-
setup(i, { emit:
|
|
87
|
-
const e = i, t = J(e, "modelValue",
|
|
87
|
+
setup(i, { emit: l }) {
|
|
88
|
+
const e = i, t = J(e, "modelValue", l, {
|
|
88
89
|
passive: !0,
|
|
89
90
|
defaultValue: e.defaultValue
|
|
90
|
-
}), u =
|
|
91
|
-
|
|
91
|
+
}), u = S(j, z(!1)), o = v(!1), s = X("searchInput"), c = () => {
|
|
92
|
+
o.value = !0;
|
|
92
93
|
}, r = () => {
|
|
93
|
-
|
|
94
|
+
o.value = !1;
|
|
94
95
|
}, f = (m) => {
|
|
95
|
-
(m.key === "Home" || m.key === "End") &&
|
|
96
|
-
},
|
|
96
|
+
(m.key === "Home" || m.key === "End") && o.value && m.stopPropagation();
|
|
97
|
+
}, U = () => {
|
|
97
98
|
s.value && (s.value.focus(), t.value = "");
|
|
98
99
|
};
|
|
99
|
-
return (m,
|
|
100
|
-
E(
|
|
100
|
+
return (m, h) => e.type === "search" ? (d(), _("div", ne, [
|
|
101
|
+
E(b("input", {
|
|
101
102
|
ref_key: "searchInput",
|
|
102
103
|
ref: s,
|
|
103
|
-
"onUpdate:modelValue":
|
|
104
|
+
"onUpdate:modelValue": h[0] || (h[0] = (V) => F(t) ? t.value = V : null),
|
|
104
105
|
class: k(
|
|
105
|
-
a(
|
|
106
|
-
a(
|
|
106
|
+
a(w)(
|
|
107
|
+
a(A)({ variant: m.variant }),
|
|
107
108
|
e.class ?? "",
|
|
108
109
|
"pr-6",
|
|
109
110
|
!e.variant || e.variant === "default" ? "group-hover:border-primary" : ""
|
|
@@ -119,28 +120,33 @@ const re = B("palette", [
|
|
|
119
120
|
}, null, 42, de), [
|
|
120
121
|
[G, a(t)]
|
|
121
122
|
]),
|
|
122
|
-
a(t) && a(t).toString().length > 0 ? (d(), g(
|
|
123
|
+
a(t) && a(t).toString().length > 0 ? (d(), g(N, {
|
|
123
124
|
key: 0,
|
|
124
125
|
variant: "none",
|
|
125
126
|
class: "hover:text-primary text-foreground absolute top-2 right-2 h-fit w-fit p-[1px]",
|
|
126
|
-
onClick:
|
|
127
|
+
onClick: U
|
|
127
128
|
}, {
|
|
128
129
|
default: y(() => [
|
|
129
|
-
n(a(
|
|
130
|
+
n(a(oe), {
|
|
130
131
|
size: 14,
|
|
131
132
|
class: "pointer-events-none shrink-0"
|
|
132
133
|
})
|
|
133
134
|
]),
|
|
134
135
|
_: 1
|
|
135
|
-
})) :
|
|
136
|
-
])) : E((d(),
|
|
136
|
+
})) : R("", !0)
|
|
137
|
+
])) : E((d(), _("input", {
|
|
137
138
|
key: 1,
|
|
138
|
-
"onUpdate:modelValue":
|
|
139
|
-
class: k(a(
|
|
139
|
+
"onUpdate:modelValue": h[1] || (h[1] = (V) => F(t) ? t.value = V : null),
|
|
140
|
+
class: k(a(w)(a(A)({ variant: m.variant }), e.class ?? "")),
|
|
140
141
|
readonly: a(u) || e.readonly,
|
|
141
142
|
disabled: e.disabled,
|
|
142
143
|
placeholder: e.placeholder,
|
|
143
144
|
type: e.type || "text",
|
|
145
|
+
autocomplete: e.disableAutocomplete ? "off" : void 0,
|
|
146
|
+
"data-1p-ignore": e.disableAutocomplete ? !0 : void 0,
|
|
147
|
+
"data-lpignore": e.disableAutocomplete ? "true" : void 0,
|
|
148
|
+
"data-protonpass-ignore": e.disableAutocomplete ? "true" : void 0,
|
|
149
|
+
"data-bwignore": e.disableAutocomplete ? "1" : void 0,
|
|
144
150
|
onFocus: c,
|
|
145
151
|
onBlur: r,
|
|
146
152
|
onKeydown: f
|
|
@@ -154,20 +160,22 @@ const re = B("palette", [
|
|
|
154
160
|
props: {
|
|
155
161
|
defaultValue: {},
|
|
156
162
|
showPasswordTranslation: {},
|
|
157
|
-
hidePasswordTranslation: {}
|
|
163
|
+
hidePasswordTranslation: {},
|
|
164
|
+
disableAutocomplete: { type: Boolean }
|
|
158
165
|
},
|
|
159
166
|
setup(i) {
|
|
160
|
-
const
|
|
167
|
+
const l = i, e = v(l.defaultValue ?? "password");
|
|
161
168
|
function p() {
|
|
162
169
|
e.value === "password" ? e.value = "text" : e.value = "password";
|
|
163
170
|
}
|
|
164
|
-
const t = $(() =>
|
|
165
|
-
return (
|
|
166
|
-
n(a(C),
|
|
171
|
+
const t = $(() => l.showPasswordTranslation ?? "Show password"), u = $(() => l.hidePasswordTranslation ?? "Hide password");
|
|
172
|
+
return (o, s) => (d(), _("div", ue, [
|
|
173
|
+
n(a(C), T(o.$attrs, {
|
|
167
174
|
type: e.value,
|
|
168
|
-
class: a(
|
|
169
|
-
|
|
170
|
-
|
|
175
|
+
class: a(w)(o.$attrs.class ?? "", "pr-8"),
|
|
176
|
+
"disable-autocomplete": l.disableAutocomplete
|
|
177
|
+
}), null, 16, ["type", "class", "disable-autocomplete"]),
|
|
178
|
+
n(N, {
|
|
171
179
|
onClick: p,
|
|
172
180
|
variant: "none",
|
|
173
181
|
class: "text-muted-foreground hover:text-foreground absolute top-0 right-3 flex h-full w-fit items-center justify-center p-0",
|
|
@@ -178,7 +186,7 @@ const re = B("palette", [
|
|
|
178
186
|
e.value === "password" ? (d(), g(a(se), {
|
|
179
187
|
key: 0,
|
|
180
188
|
class: "pointer-events-none h-4 w-4 shrink-0 cursor-pointer"
|
|
181
|
-
})) : (d(), g(a(
|
|
189
|
+
})) : (d(), g(a(le), {
|
|
182
190
|
key: 1,
|
|
183
191
|
class: "pointer-events-none h-4 w-4 shrink-0 cursor-pointer"
|
|
184
192
|
}))
|
|
@@ -194,22 +202,22 @@ const re = B("palette", [
|
|
|
194
202
|
badge: {}
|
|
195
203
|
},
|
|
196
204
|
setup(i) {
|
|
197
|
-
const
|
|
198
|
-
return (t, u) => (d(),
|
|
199
|
-
n(a(C),
|
|
205
|
+
const l = i, e = v(null), { width: p } = D(e);
|
|
206
|
+
return (t, u) => (d(), _("div", ce, [
|
|
207
|
+
n(a(C), T(t.$attrs, {
|
|
200
208
|
style: { paddingRight: a(p) + pe + "px" }
|
|
201
209
|
}), null, 16, ["style"]),
|
|
202
|
-
|
|
210
|
+
l.badge ? (d(), g(W, {
|
|
203
211
|
key: 0,
|
|
204
212
|
ref_key: "badgeEl",
|
|
205
213
|
ref: e,
|
|
206
214
|
class: "hover:bg-primary/8 dark:hover:bg-primary/30 absolute top-1 right-2 flex items-center justify-center rounded-sm"
|
|
207
215
|
}, {
|
|
208
216
|
default: y(() => [
|
|
209
|
-
K(L(
|
|
217
|
+
K(L(l.badge), 1)
|
|
210
218
|
]),
|
|
211
219
|
_: 1
|
|
212
|
-
}, 512)) :
|
|
220
|
+
}, 512)) : R("", !0)
|
|
213
221
|
]));
|
|
214
222
|
}
|
|
215
223
|
}), fe = { class: "nowrap text-foreground relative flex w-32 flex-row font-medium uppercase" }, me = 12, Fe = /* @__PURE__ */ x({
|
|
@@ -225,31 +233,31 @@ const re = B("palette", [
|
|
|
225
233
|
}),
|
|
226
234
|
emits: ["update:modelValue"],
|
|
227
235
|
setup(i) {
|
|
228
|
-
const
|
|
229
|
-
return I(
|
|
230
|
-
Q.test(
|
|
236
|
+
const l = i, e = q(i, "modelValue", void 0), p = v(null), { width: t } = D(p), u = () => e.value && P.test(e.value) ? e.value : l.defaultValue && P.test(l.defaultValue) ? l.defaultValue : "#FFFFFF", o = v(u().substring(1)), s = v(u());
|
|
237
|
+
return I(o, () => {
|
|
238
|
+
Q.test(o.value) && (e.value = `#${o.value}`, s.value = `#${o.value}`);
|
|
231
239
|
}), I(s, () => {
|
|
232
|
-
e.value = s.value,
|
|
240
|
+
e.value = s.value, o.value = s.value.substring(1);
|
|
233
241
|
}), (c, r) => (d(), g(a(Z), null, {
|
|
234
242
|
default: y(() => [
|
|
235
243
|
n(a(ee), null, {
|
|
236
244
|
default: y(() => [
|
|
237
|
-
|
|
238
|
-
|
|
245
|
+
b("div", fe, [
|
|
246
|
+
b("div", {
|
|
239
247
|
ref_key: "paletteBadge",
|
|
240
248
|
ref: p,
|
|
241
|
-
class: k(a(
|
|
249
|
+
class: k(a(w)("absolute top-1.5 left-2 flex flex-row items-center gap-1", c.ui?.badgeClass))
|
|
242
250
|
}, [
|
|
243
251
|
n(a(re), { class: "h-4 w-4 shrink-0" }),
|
|
244
|
-
|
|
252
|
+
b("div", {
|
|
245
253
|
class: "h-4 w-4 rounded-sm",
|
|
246
254
|
style: M({ backgroundColor: s.value })
|
|
247
255
|
}, null, 4),
|
|
248
|
-
r[2] || (r[2] =
|
|
256
|
+
r[2] || (r[2] = b("div", { class: "text-foreground/[.56] font-bold" }, "#", -1))
|
|
249
257
|
], 2),
|
|
250
258
|
n(C, {
|
|
251
|
-
modelValue:
|
|
252
|
-
"onUpdate:modelValue": r[0] || (r[0] = (f) =>
|
|
259
|
+
modelValue: o.value,
|
|
260
|
+
"onUpdate:modelValue": r[0] || (r[0] = (f) => o.value = f),
|
|
253
261
|
id: c.id,
|
|
254
262
|
style: M({ paddingLeft: a(t) + me + "px" }),
|
|
255
263
|
disabled: c.disabled,
|
|
@@ -278,7 +286,7 @@ const re = B("palette", [
|
|
|
278
286
|
_: 1
|
|
279
287
|
}));
|
|
280
288
|
}
|
|
281
|
-
}),
|
|
289
|
+
}), A = O(
|
|
282
290
|
"flex h-8 w-full rounded-sm bg-background border px-2 py-1 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-30 dark:disabled:opacity-55 read-only:opacity-30 dark:read-only:opacity-55 aria-invalid:border-destructive-foreground",
|
|
283
291
|
{
|
|
284
292
|
variants: {
|
|
@@ -298,5 +306,5 @@ export {
|
|
|
298
306
|
Fe as BuiColorInput,
|
|
299
307
|
C as BuiInput,
|
|
300
308
|
Ce as BuiPasswordInput,
|
|
301
|
-
|
|
309
|
+
A as inputVariants
|
|
302
310
|
};
|
package/package.json
CHANGED
|
@@ -16,6 +16,7 @@ const props = defineProps<{
|
|
|
16
16
|
disabled?: boolean
|
|
17
17
|
placeholder?: string
|
|
18
18
|
type?: string
|
|
19
|
+
disableAutocomplete?: boolean
|
|
19
20
|
}>()
|
|
20
21
|
|
|
21
22
|
const emits = defineEmits<{
|
|
@@ -94,6 +95,11 @@ const handleClear = () => {
|
|
|
94
95
|
:disabled="props.disabled"
|
|
95
96
|
:placeholder="props.placeholder"
|
|
96
97
|
:type="props.type || 'text'"
|
|
98
|
+
:autocomplete="props.disableAutocomplete ? 'off' : undefined"
|
|
99
|
+
:data-1p-ignore="props.disableAutocomplete ? true : undefined"
|
|
100
|
+
:data-lpignore="props.disableAutocomplete ? 'true' : undefined"
|
|
101
|
+
:data-protonpass-ignore="props.disableAutocomplete ? 'true' : undefined"
|
|
102
|
+
:data-bwignore="props.disableAutocomplete ? '1' : undefined"
|
|
97
103
|
@focus="handleFocus"
|
|
98
104
|
@blur="handleBlur"
|
|
99
105
|
@keydown="handleKeyDown"
|
|
@@ -9,6 +9,7 @@ const props = defineProps<{
|
|
|
9
9
|
defaultValue?: 'password' | 'text'
|
|
10
10
|
showPasswordTranslation?: string
|
|
11
11
|
hidePasswordTranslation?: string
|
|
12
|
+
disableAutocomplete?: boolean
|
|
12
13
|
}>()
|
|
13
14
|
|
|
14
15
|
defineOptions({
|
|
@@ -30,7 +31,12 @@ const hidePasswordText = computed(() => props.hidePasswordTranslation ?? 'Hide p
|
|
|
30
31
|
|
|
31
32
|
<template>
|
|
32
33
|
<div class="relative flex">
|
|
33
|
-
<BuiInput
|
|
34
|
+
<BuiInput
|
|
35
|
+
v-bind="$attrs"
|
|
36
|
+
:type="type"
|
|
37
|
+
:class="cn($attrs.class ?? '', 'pr-8')"
|
|
38
|
+
:disable-autocomplete="props.disableAutocomplete"
|
|
39
|
+
/>
|
|
34
40
|
<BuiButton
|
|
35
41
|
@click="togglePasswordShow"
|
|
36
42
|
variant="none"
|
|
@@ -46,7 +46,22 @@ export const Password: Story = {
|
|
|
46
46
|
template: `
|
|
47
47
|
<div class="grid w-full max-w-sm items-center gap-1.5">
|
|
48
48
|
<BuiLabel for="password">Password</BuiLabel>
|
|
49
|
-
<BuiPasswordInput v-bind="args" id="password" placeholder="Password"/>
|
|
49
|
+
<BuiPasswordInput v-bind="args" id="password" placeholder="Password" />
|
|
50
|
+
</div>
|
|
51
|
+
`
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const PasswordDisableAutofill: Story = {
|
|
56
|
+
render: (args) => ({
|
|
57
|
+
components: { BuiPasswordInput, BuiLabel },
|
|
58
|
+
setup() {
|
|
59
|
+
return { args }
|
|
60
|
+
},
|
|
61
|
+
template: `
|
|
62
|
+
<div class="grid w-full max-w-sm items-center gap-1.5">
|
|
63
|
+
<BuiLabel for="password">Password</BuiLabel>
|
|
64
|
+
<BuiPasswordInput v-bind="args" id="password" placeholder="Password" disable-autocomplete />
|
|
50
65
|
</div>
|
|
51
66
|
`
|
|
52
67
|
})
|