@soft-stech/bootsman-ui-shadcn 1.3.11 → 1.3.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,11 +9,11 @@ declare function __VLS_template(): {
9
9
  errors: string[];
10
10
  errorMessage: string | undefined;
11
11
  handleInput: import('vee-validate').FieldContext["handleChange"];
12
+ handleBlur: (e?: Event, shouldValidate?: boolean) => void;
12
13
  resetField: (state?: Partial<import('vee-validate').FieldState<unknown>> | undefined) => void;
13
14
  handleReset: () => void;
14
15
  validate: import('vee-validate').FieldValidator<unknown>;
15
16
  handleChange: (e: Event | unknown, shouldValidate?: boolean) => void;
16
- handleBlur: (e?: Event, shouldValidate?: boolean) => void;
17
17
  setTouched: (isTouched: boolean) => void;
18
18
  setErrors: (message: string | string[]) => void;
19
19
  setValue: (value: unknown, shouldValidate?: boolean) => void;
@@ -9,11 +9,11 @@ declare function __VLS_template(): {
9
9
  errors: string[];
10
10
  errorMessage: string | undefined;
11
11
  handleInput: import('vee-validate').FieldContext["handleChange"];
12
+ handleBlur: (e?: Event, shouldValidate?: boolean) => void;
12
13
  resetField: (state?: Partial<import('vee-validate').FieldState<unknown>> | undefined) => void;
13
14
  handleReset: () => void;
14
15
  validate: import('vee-validate').FieldValidator<unknown>;
15
16
  handleChange: (e: Event | unknown, shouldValidate?: boolean) => void;
16
- handleBlur: (e?: Event, shouldValidate?: boolean) => void;
17
17
  setTouched: (isTouched: boolean) => void;
18
18
  setErrors: (message: string | string[]) => void;
19
19
  setValue: (value: unknown, shouldValidate?: boolean) => void;
@@ -9,11 +9,11 @@ declare function __VLS_template(): {
9
9
  errors: string[];
10
10
  errorMessage: string | undefined;
11
11
  handleInput: import('vee-validate').FieldContext["handleChange"];
12
+ handleBlur: (e?: Event, shouldValidate?: boolean) => void;
12
13
  resetField: (state?: Partial<import('vee-validate').FieldState<unknown>> | undefined) => void;
13
14
  handleReset: () => void;
14
15
  validate: import('vee-validate').FieldValidator<unknown>;
15
16
  handleChange: (e: Event | unknown, shouldValidate?: boolean) => void;
16
- handleBlur: (e?: Event, shouldValidate?: boolean) => void;
17
17
  setTouched: (isTouched: boolean) => void;
18
18
  setErrors: (message: string | string[]) => void;
19
19
  setValue: (value: unknown, shouldValidate?: boolean) => void;
@@ -9,11 +9,11 @@ declare function __VLS_template(): {
9
9
  errors: string[];
10
10
  errorMessage: string | undefined;
11
11
  handleInput: import('vee-validate').FieldContext["handleChange"];
12
+ handleBlur: (e?: Event, shouldValidate?: boolean) => void;
12
13
  resetField: (state?: Partial<import('vee-validate').FieldState<unknown>> | undefined) => void;
13
14
  handleReset: () => void;
14
15
  validate: import('vee-validate').FieldValidator<unknown>;
15
16
  handleChange: (e: Event | unknown, shouldValidate?: boolean) => void;
16
- handleBlur: (e?: Event, shouldValidate?: boolean) => void;
17
17
  setTouched: (isTouched: boolean) => void;
18
18
  setErrors: (message: string | string[]) => void;
19
19
  setValue: (value: unknown, shouldValidate?: boolean) => void;
@@ -9,11 +9,11 @@ declare function __VLS_template(): {
9
9
  errors: string[];
10
10
  errorMessage: string | undefined;
11
11
  handleInput: import('vee-validate').FieldContext["handleChange"];
12
+ handleBlur: (e?: Event, shouldValidate?: boolean) => void;
12
13
  resetField: (state?: Partial<import('vee-validate').FieldState<unknown>> | undefined) => void;
13
14
  handleReset: () => void;
14
15
  validate: import('vee-validate').FieldValidator<unknown>;
15
16
  handleChange: (e: Event | unknown, shouldValidate?: boolean) => void;
16
- handleBlur: (e?: Event, shouldValidate?: boolean) => void;
17
17
  setTouched: (isTouched: boolean) => void;
18
18
  setErrors: (message: string | string[]) => void;
19
19
  setValue: (value: unknown, shouldValidate?: boolean) => void;
@@ -9,11 +9,11 @@ declare function __VLS_template(): {
9
9
  errors: string[];
10
10
  errorMessage: string | undefined;
11
11
  handleInput: import('vee-validate').FieldContext["handleChange"];
12
+ handleBlur: (e?: Event, shouldValidate?: boolean) => void;
12
13
  resetField: (state?: Partial<import('vee-validate').FieldState<unknown>> | undefined) => void;
13
14
  handleReset: () => void;
14
15
  validate: import('vee-validate').FieldValidator<unknown>;
15
16
  handleChange: (e: Event | unknown, shouldValidate?: boolean) => void;
16
- handleBlur: (e?: Event, shouldValidate?: boolean) => void;
17
17
  setTouched: (isTouched: boolean) => void;
18
18
  setErrors: (message: string | string[]) => void;
19
19
  setValue: (value: unknown, shouldValidate?: boolean) => void;
@@ -1,14 +1,14 @@
1
- import { d as p, c as f, a as h } from "../../../utils-D2UeooB9.js";
2
- import { defineComponent as u, withDirectives as _, openBlock as s, createElementBlock as c, isRef as k, normalizeClass as V, unref as t, vModelText as w, ref as m, createVNode as v, mergeProps as y, createElementVNode as x, createBlock as i, withCtx as B, createTextVNode as E, toDisplayString as I, createCommentVNode as M } from "vue";
3
- import { useVModel as $, useElementBounding as C } from "@vueuse/core";
4
- import { BuiBadge as N } from "../badge/index.js";
1
+ import { d as m, c as y, a as B } from "../../../utils-D2UeooB9.js";
2
+ import { defineComponent as c, ref as d, withDirectives as V, openBlock as s, createElementBlock as p, isRef as x, normalizeClass as E, unref as t, vModelText as I, createVNode as v, mergeProps as g, createElementVNode as M, createBlock as u, withCtx as $, createTextVNode as C, toDisplayString as N, createCommentVNode as P } from "vue";
3
+ import { useVModel as j, useElementBounding as A } from "@vueuse/core";
4
+ import { BuiBadge as D } from "../badge/index.js";
5
5
  /**
6
6
  * @license lucide-vue-next v0.441.0 - ISC
7
7
  *
8
8
  * This source code is licensed under the ISC license.
9
9
  * See the LICENSE file in the root directory of this source tree.
10
10
  */
11
- const P = p("EyeOffIcon", [
11
+ const F = m("EyeOffIcon", [
12
12
  [
13
13
  "path",
14
14
  {
@@ -32,7 +32,7 @@ const P = p("EyeOffIcon", [
32
32
  * This source code is licensed under the ISC license.
33
33
  * See the LICENSE file in the root directory of this source tree.
34
34
  */
35
- const j = p("EyeIcon", [
35
+ const R = m("EyeIcon", [
36
36
  [
37
37
  "path",
38
38
  {
@@ -41,7 +41,7 @@ const j = p("EyeIcon", [
41
41
  }
42
42
  ],
43
43
  ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
44
- ]), g = /* @__PURE__ */ u({
44
+ ]), h = /* @__PURE__ */ c({
45
45
  __name: "BuiInput",
46
46
  props: {
47
47
  defaultValue: {},
@@ -51,73 +51,82 @@ const j = p("EyeIcon", [
51
51
  },
52
52
  emits: ["update:modelValue"],
53
53
  setup(r, { emit: o }) {
54
- const e = r, a = $(e, "modelValue", o, {
54
+ const e = r, a = j(e, "modelValue", o, {
55
55
  passive: !0,
56
56
  defaultValue: e.defaultValue
57
- });
58
- return (l, d) => _((s(), c("input", {
59
- "onUpdate:modelValue": d[0] || (d[0] = (b) => k(a) ? a.value = b : null),
60
- class: V(t(f)(t(D)({ variant: l.variant }), e.class ?? ""))
61
- }, null, 2)), [
62
- [w, t(a)]
57
+ }), n = d(!1), b = () => {
58
+ n.value = !0;
59
+ }, _ = () => {
60
+ n.value = !1;
61
+ }, k = (l) => {
62
+ (l.key === "Home" || l.key === "End") && n.value && l.stopPropagation();
63
+ };
64
+ return (l, f) => V((s(), p("input", {
65
+ "onUpdate:modelValue": f[0] || (f[0] = (w) => x(a) ? a.value = w : null),
66
+ class: E(t(y)(t(S)({ variant: l.variant }), e.class ?? "")),
67
+ onFocus: b,
68
+ onBlur: _,
69
+ onKeydown: k
70
+ }, null, 34)), [
71
+ [I, t(a)]
63
72
  ]);
64
73
  }
65
- }), A = { class: "relative flex" }, G = /* @__PURE__ */ u({
74
+ }), z = { class: "relative flex" }, L = /* @__PURE__ */ c({
66
75
  inheritAttrs: !1,
67
76
  __name: "BuiPasswordInput",
68
77
  props: {
69
78
  defaultValue: {}
70
79
  },
71
80
  setup(r) {
72
- const e = m(r.defaultValue ?? "password");
73
- function n() {
81
+ const e = d(r.defaultValue ?? "password");
82
+ function i() {
74
83
  e.value === "password" ? e.value = "text" : e.value = "password";
75
84
  }
76
- return (a, l) => (s(), c("div", A, [
77
- v(t(g), y(a.$attrs, {
85
+ return (a, n) => (s(), p("div", z, [
86
+ v(t(h), g(a.$attrs, {
78
87
  type: e.value,
79
- class: t(f)(a.$attrs.class ?? "", "pr-8")
88
+ class: t(y)(a.$attrs.class ?? "", "pr-8")
80
89
  }), null, 16, ["type", "class"]),
81
- x("span", {
82
- onClick: n,
90
+ M("span", {
91
+ onClick: i,
83
92
  class: "absolute right-3 top-0 flex h-full items-center justify-center"
84
93
  }, [
85
- e.value === "password" ? (s(), i(t(j), {
94
+ e.value === "password" ? (s(), u(t(R), {
86
95
  key: 0,
87
96
  class: "h-4 w-4 cursor-pointer opacity-[0.56] hover:opacity-100"
88
- })) : (s(), i(t(P), {
97
+ })) : (s(), u(t(F), {
89
98
  key: 1,
90
99
  class: "h-4 w-4 cursor-pointer opacity-[0.56] hover:opacity-100"
91
100
  }))
92
101
  ])
93
102
  ]));
94
103
  }
95
- }), R = { class: "relative flex" }, z = 16, L = /* @__PURE__ */ u({
104
+ }), K = { class: "relative flex" }, O = 16, q = /* @__PURE__ */ c({
96
105
  inheritAttrs: !1,
97
106
  __name: "BuiBadgedInput",
98
107
  props: {
99
108
  badge: {}
100
109
  },
101
110
  setup(r) {
102
- const o = r, e = m(null), { width: n } = C(e);
103
- return (a, l) => (s(), c("div", R, [
104
- v(t(g), y(a.$attrs, {
105
- style: { paddingRight: t(n) + z + "px" }
111
+ const o = r, e = d(null), { width: i } = A(e);
112
+ return (a, n) => (s(), p("div", K, [
113
+ v(t(h), g(a.$attrs, {
114
+ style: { paddingRight: t(i) + O + "px" }
106
115
  }), null, 16, ["style"]),
107
- o.badge ? (s(), i(t(N), {
116
+ o.badge ? (s(), u(t(D), {
108
117
  key: 0,
109
118
  ref_key: "badgeEl",
110
119
  ref: e,
111
120
  class: "absolute right-3 top-1.5 flex items-center justify-center rounded-sm hover:bg-primary/[0.08] dark:hover:bg-primary/30"
112
121
  }, {
113
- default: B(() => [
114
- E(I(o.badge), 1)
122
+ default: $(() => [
123
+ C(N(o.badge), 1)
115
124
  ]),
116
125
  _: 1
117
- }, 512)) : M("", !0)
126
+ }, 512)) : P("", !0)
118
127
  ]));
119
128
  }
120
- }), D = h(
129
+ }), S = B(
121
130
  "flex h-10 w-full rounded bg-background border px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-30 dark:disabled:opacity-55 aria-[invalid=true]:border-destructive-foreground",
122
131
  {
123
132
  variants: {
@@ -133,8 +142,8 @@ const j = p("EyeIcon", [
133
142
  }
134
143
  );
135
144
  export {
136
- L as BuiBadgedInput,
137
- g as BuiInput,
138
- G as BuiPasswordInput,
139
- D as inputVariants
145
+ q as BuiBadgedInput,
146
+ h as BuiInput,
147
+ L as BuiPasswordInput,
148
+ S as inputVariants
140
149
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soft-stech/bootsman-ui-shadcn",
3
- "version": "1.3.11",
3
+ "version": "1.3.12",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import type { HTMLAttributes } from 'vue'
2
+ import { ref, type HTMLAttributes } from 'vue'
3
3
  import { useVModel } from '@vueuse/core'
4
4
  import { cn } from '@/lib/utils'
5
5
  import { inputVariants } from '.'
@@ -19,8 +19,31 @@ const modelValue = useVModel(props, 'modelValue', emits, {
19
19
  passive: true,
20
20
  defaultValue: props.defaultValue
21
21
  })
22
+
23
+ const isFocused = ref<Boolean>(false)
24
+
25
+ const handleFocus = () => {
26
+ isFocused.value = true
27
+ }
28
+ const handleBlur = () => {
29
+ isFocused.value = false
30
+ }
31
+
32
+ const handleKeyDown = (e: KeyboardEvent) => {
33
+ if(e.key === 'Home' || e.key === 'End') {
34
+ if(isFocused.value) {
35
+ e.stopPropagation();
36
+ }
37
+ }
38
+ }
22
39
  </script>
23
40
 
24
41
  <template>
25
- <input v-model="modelValue" :class="cn(inputVariants({ variant }), props.class ?? '')" />
42
+ <input
43
+ v-model="modelValue"
44
+ :class="cn(inputVariants({ variant }), props.class ?? '')"
45
+ @focus="handleFocus"
46
+ @blur="handleBlur"
47
+ @keydown="handleKeyDown"
48
+ />
26
49
  </template>