@soft-stech/bootsman-ui-shadcn 1.4.0 → 1.4.1

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,7 +1,7 @@
1
- import { c as u, d as n } from "../../../utils-BiLiPt4t.js";
2
- import { defineComponent as d, withDirectives as c, openBlock as f, createElementBlock as m, isRef as p, normalizeClass as v, unref as a, vModelText as b } from "vue";
3
- import { useVModel as g } from "@vueuse/core";
4
- const y = /* @__PURE__ */ d({
1
+ import { c as f, d as m } from "../../../utils-BiLiPt4t.js";
2
+ import { defineComponent as p, ref as v, withDirectives as b, openBlock as g, createElementBlock as V, isRef as x, normalizeClass as k, unref as r, vModelText as y } from "vue";
3
+ import { useVModel as w } from "@vueuse/core";
4
+ const A = /* @__PURE__ */ p({
5
5
  __name: "BuiTextarea",
6
6
  props: {
7
7
  defaultValue: {},
@@ -9,19 +9,28 @@ const y = /* @__PURE__ */ d({
9
9
  modelValue: {}
10
10
  },
11
11
  emits: ["update:modelValue"],
12
- setup(s, { emit: i }) {
13
- const r = s, e = g(r, "modelValue", i, {
12
+ setup(n, { emit: l }) {
13
+ const t = n, o = w(t, "modelValue", l, {
14
14
  passive: !0,
15
- defaultValue: r.defaultValue
16
- });
17
- return (t, o) => c((f(), m("textarea", {
18
- "onUpdate:modelValue": o[0] || (o[0] = (l) => p(e) ? e.value = l : null),
19
- class: v(a(u)(a(V)({ variant: t.variant }), t.$attrs.class ?? ""))
20
- }, null, 2)), [
21
- [b, a(e)]
15
+ defaultValue: t.defaultValue
16
+ }), a = v(!1), u = () => {
17
+ a.value = !0;
18
+ }, i = () => {
19
+ a.value = !1;
20
+ }, d = (e) => {
21
+ (e.key === "Home" || e.key === "End" || e.key === "ArrowUp" || e.key === "ArrowDown") && a.value && e.stopPropagation();
22
+ };
23
+ return (e, s) => b((g(), V("textarea", {
24
+ "onUpdate:modelValue": s[0] || (s[0] = (c) => x(o) ? o.value = c : null),
25
+ class: k(r(f)(r(B)({ variant: e.variant }), e.$attrs.class ?? "")),
26
+ onFocus: u,
27
+ onBlur: i,
28
+ onKeydown: d
29
+ }, null, 34)), [
30
+ [y, r(o)]
22
31
  ]);
23
32
  }
24
- }), V = n(
33
+ }), B = m(
25
34
  "flex min-h-[80px] w-full rounded border bg-background px-3 py-2 text-sm ring-offset-background 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",
26
35
  {
27
36
  variants: {
@@ -37,6 +46,6 @@ const y = /* @__PURE__ */ d({
37
46
  }
38
47
  );
39
48
  export {
40
- y as BuiTextarea,
41
- V as textareaVariants
49
+ A as BuiTextarea,
50
+ B as textareaVariants
42
51
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soft-stech/bootsman-ui-shadcn",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { ref } from 'vue'
2
3
  import { useVModel } from '@vueuse/core'
3
4
  import { cn } from '@/lib/utils'
4
5
  import { textareaVariants } from '.'
@@ -17,8 +18,31 @@ const modelValue = useVModel(props, 'modelValue', emits, {
17
18
  passive: true,
18
19
  defaultValue: props.defaultValue
19
20
  })
21
+
22
+ const isFocused = ref<Boolean>(false)
23
+
24
+ const handleFocus = () => {
25
+ isFocused.value = true
26
+ }
27
+ const handleBlur = () => {
28
+ isFocused.value = false
29
+ }
30
+
31
+ const handleKeyDown = (e: KeyboardEvent) => {
32
+ if (e.key === 'Home' || e.key === 'End' || e.key === 'ArrowUp' || e.key === 'ArrowDown') {
33
+ if (isFocused.value) {
34
+ e.stopPropagation()
35
+ }
36
+ }
37
+ }
20
38
  </script>
21
39
 
22
40
  <template>
23
- <textarea v-model="modelValue" :class="cn(textareaVariants({ variant }), $attrs.class ?? '')" />
41
+ <textarea
42
+ v-model="modelValue"
43
+ :class="cn(textareaVariants({ variant }), $attrs.class ?? '')"
44
+ @focus="handleFocus"
45
+ @blur="handleBlur"
46
+ @keydown="handleKeyDown"
47
+ />
24
48
  </template>