@indielayer/ui 1.14.5 → 1.15.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.
Files changed (56) hide show
  1. package/docs/pages/component/avatar/usage.vue +1 -1
  2. package/docs/pages/component/input/usage.vue +22 -8
  3. package/docs/pages/component/table/selectable.vue +1 -1
  4. package/docs/pages/component/table/virtual.vue +2 -1
  5. package/docs/pages/component/tag/usage.vue +1 -1
  6. package/docs/pages/component/textarea/usage.vue +22 -8
  7. package/lib/components/avatar/Avatar.vue2.js +20 -19
  8. package/lib/components/avatar/theme/Avatar.base.theme.js +9 -12
  9. package/lib/components/datepicker/Datepicker.vue.js +1 -1
  10. package/lib/components/drawer/Drawer.vue.js +66 -60
  11. package/lib/components/input/Input.vue.d.ts +8 -0
  12. package/lib/components/input/Input.vue.js +84 -69
  13. package/lib/components/inputFooter/InputFooter.vue.d.ts +13 -2
  14. package/lib/components/inputFooter/InputFooter.vue.js +35 -19
  15. package/lib/components/inputFooter/theme/InputFooter.base.theme.js +3 -1
  16. package/lib/components/inputFooter/theme/InputFooter.carbon.theme.js +3 -1
  17. package/lib/components/popover/Popover.vue.d.ts +1 -1
  18. package/lib/components/select/Select.vue.d.ts +38 -10
  19. package/lib/components/select/Select.vue.js +210 -200
  20. package/lib/components/table/Table.vue.d.ts +55 -19
  21. package/lib/components/table/Table.vue.js +256 -214
  22. package/lib/components/table/TableCell.vue.d.ts +9 -0
  23. package/lib/components/table/TableCell.vue.js +45 -21
  24. package/lib/components/table/TableHeader.vue.js +14 -14
  25. package/lib/components/table/theme/TableCell.base.theme.js +3 -3
  26. package/lib/components/tag/Tag.vue.d.ts +3 -0
  27. package/lib/components/tag/Tag.vue.js +37 -35
  28. package/lib/components/textarea/Textarea.vue.d.ts +19 -3
  29. package/lib/components/textarea/Textarea.vue.js +102 -76
  30. package/lib/components/textarea/theme/Textarea.base.theme.js +2 -1
  31. package/lib/components/textarea/theme/Textarea.carbon.theme.js +2 -1
  32. package/lib/components/upload/Upload.vue.js +91 -86
  33. package/lib/index.js +1 -1
  34. package/lib/index.umd.js +4 -4
  35. package/lib/version.d.ts +1 -1
  36. package/lib/version.js +1 -1
  37. package/package.json +1 -1
  38. package/src/components/avatar/Avatar.vue +2 -2
  39. package/src/components/avatar/theme/Avatar.base.theme.ts +0 -5
  40. package/src/components/datepicker/Datepicker.vue +6 -1
  41. package/src/components/drawer/Drawer.vue +13 -2
  42. package/src/components/input/Input.vue +27 -2
  43. package/src/components/inputFooter/InputFooter.vue +35 -3
  44. package/src/components/inputFooter/theme/InputFooter.base.theme.ts +2 -0
  45. package/src/components/inputFooter/theme/InputFooter.carbon.theme.ts +2 -0
  46. package/src/components/select/Select.vue +21 -8
  47. package/src/components/table/Table.vue +170 -48
  48. package/src/components/table/TableCell.vue +23 -0
  49. package/src/components/table/TableHeader.vue +2 -2
  50. package/src/components/table/theme/TableCell.base.theme.ts +20 -11
  51. package/src/components/tag/Tag.vue +8 -3
  52. package/src/components/textarea/Textarea.vue +69 -30
  53. package/src/components/textarea/theme/Textarea.base.theme.ts +2 -0
  54. package/src/components/textarea/theme/Textarea.carbon.theme.ts +2 -0
  55. package/src/components/upload/Upload.vue +12 -2
  56. package/src/version.ts +1 -1
@@ -1,12 +1,12 @@
1
- import { defineComponent as d, computed as c, openBlock as m, createElementBlock as u, normalizeStyle as p, unref as n, normalizeClass as f, renderSlot as h } from "vue";
2
- import { useTheme as g } from "../../composables/useTheme.js";
3
- const o = {
1
+ import { defineComponent as h, computed as f, openBlock as o, createElementBlock as m, normalizeClass as n, unref as l, normalizeStyle as c, createBlock as g, resolveDynamicComponent as v, mergeProps as y, withCtx as b, createElementVNode as w, renderSlot as p } from "vue";
2
+ import { useTheme as S } from "../../composables/useTheme.js";
3
+ const i = {
4
4
  textAlign: [null, "left", "center", "right", "justify"],
5
5
  verticalAlign: [null, "baseline", "bottom", "middle", "text-bottom", "text-top", "top"]
6
- }, v = {
6
+ }, C = {
7
7
  textAlign: {
8
8
  type: String,
9
- validator: (e) => o.textAlign.includes(e)
9
+ validator: (a) => i.textAlign.includes(a)
10
10
  },
11
11
  truncate: Boolean,
12
12
  dense: Boolean,
@@ -14,28 +14,52 @@ const o = {
14
14
  verticalAlign: {
15
15
  type: String,
16
16
  default: "middle",
17
- validator: (e) => o.verticalAlign.includes(e)
18
- }
19
- }, b = {
17
+ validator: (a) => i.verticalAlign.includes(a)
18
+ },
19
+ to: [String, Object],
20
+ href: String,
21
+ target: String
22
+ }, k = {
20
23
  name: "XTableCell",
21
- validators: o
22
- }, w = /* @__PURE__ */ d({
23
- ...b,
24
- props: v,
25
- setup(e) {
26
- const t = e, l = c(() => typeof t.width == "number" ? `${t.width}px` : t.width), { styles: a, classes: i, className: r } = g("TableCell", {}, t);
27
- return (s, x) => (m(), u("td", {
28
- style: p([n(a), { width: l.value, minWidth: l.value, maxWidth: l.value }]),
29
- class: f([
24
+ validators: i
25
+ }, N = /* @__PURE__ */ h({
26
+ ...k,
27
+ props: C,
28
+ setup(a) {
29
+ const r = a, t = f(() => typeof r.width == "number" ? `${r.width}px` : r.width), { styles: s, classes: d, className: u } = S("TableCell", {}, r);
30
+ return (e, A) => e.to || e.href ? (o(), m("td", {
31
+ key: 0,
32
+ class: n(["relative", l(u)]),
33
+ style: c([{ width: t.value, minWidth: t.value, maxWidth: t.value }])
34
+ }, [
35
+ (o(), g(v(e.to ? "router-link" : "a"), y(e.href ? { href: e.href } : {}, {
36
+ target: e.target,
37
+ to: e.to,
38
+ style: l(s),
39
+ class: l(d).wrapper
40
+ }), {
41
+ default: b(() => [
42
+ w("div", {
43
+ class: n([e.truncate ? "truncate" : ""])
44
+ }, [
45
+ p(e.$slots, "default")
46
+ ], 2)
47
+ ]),
48
+ _: 3
49
+ }, 16, ["target", "to", "style", "class"]))
50
+ ], 6)) : (o(), m("td", {
51
+ key: 1,
52
+ style: c([l(s), { width: t.value, minWidth: t.value, maxWidth: t.value }]),
53
+ class: n([
30
54
  "relative",
31
- n(r),
32
- n(i).wrapper
55
+ l(u),
56
+ l(d).wrapper
33
57
  ])
34
58
  }, [
35
- h(s.$slots, "default")
59
+ p(e.$slots, "default")
36
60
  ], 6));
37
61
  }
38
62
  });
39
63
  export {
40
- w as default
64
+ N as default
41
65
  };
@@ -1,7 +1,7 @@
1
- import { defineComponent as g, openBlock as o, createElementBlock as n, normalizeStyle as k, unref as s, normalizeClass as a, createElementVNode as r, renderSlot as v, createBlock as c, createCommentVNode as p, Fragment as m } from "vue";
2
- import { useTheme as h } from "../../composables/useTheme.js";
3
- import b from "../tooltip/ToggleTip.vue.js";
4
- const x = { class: "flex items-center gap-1" }, B = {
1
+ import { defineComponent as g, openBlock as o, createElementBlock as n, normalizeStyle as k, unref as s, normalizeClass as i, createElementVNode as r, renderSlot as c, createBlock as h, createCommentVNode as p, Fragment as m } from "vue";
2
+ import { useTheme as v } from "../../composables/useTheme.js";
3
+ import x from "../tooltip/ToggleTip.vue.js";
4
+ const b = { class: "flex items-center gap-1" }, B = {
5
5
  key: 2,
6
6
  d: "m3 9l4-4l4 4M7 5v14m14-4l-4 4l-4-4m4 4V5"
7
7
  }, d = {
@@ -23,28 +23,28 @@ const x = { class: "flex items-center gap-1" }, B = {
23
23
  ...C,
24
24
  props: A,
25
25
  setup(l) {
26
- const u = l, { styles: y, classes: i, className: f } = h("TableHeader", {}, u);
26
+ const u = l, { styles: y, classes: a, className: f } = v("TableHeader", {}, u);
27
27
  return (e, t) => (o(), n("th", {
28
28
  style: k(s(y)),
29
- class: a([s(f), s(i).th, "group/th"])
29
+ class: i([s(f), s(a).th, "group/th"])
30
30
  }, [
31
31
  r("div", {
32
- class: a(s(i).header)
32
+ class: i(s(a).header)
33
33
  }, [
34
- r("div", x, [
35
- v(e.$slots, "default"),
36
- e.tooltip ? (o(), c(b, {
34
+ r("div", b, [
35
+ c(e.$slots, "default"),
36
+ e.tooltip ? (o(), h(x, {
37
37
  key: 0,
38
38
  content: e.tooltip
39
39
  }, null, 8, ["content"])) : p("", !0)
40
40
  ]),
41
41
  e.sortable ? (o(), n("svg", {
42
42
  key: 0,
43
- class: a(["shrink-0", [
44
- s(i).sortIcon,
43
+ class: i(["shrink-0", [
44
+ s(a).sortIcon,
45
45
  e.textAlign === "right" ? "-mr-4 -translate-x-4" : "-ml-4 translate-x-4",
46
- [e.sort && [1, -1].includes(e.sort) ? "" : "invisible group-hover/th:visible"],
47
- [e.sort !== -1 && e.sort !== 1 ? "text-secondary-400 dark:text-secondary-500" : "text-primary-700 dark:text-primary-400"]
46
+ [e.sort && [1, -1].includes(e.sort) ? "" : "group-hover/th:text-secondary-500 dark:group-hover/th:text-secondary-400"],
47
+ [e.sort !== -1 && e.sort !== 1 ? "text-secondary-400 dark:text-secondary-500" : "text-primary-500 dark:text-primary-400"]
48
48
  ]]),
49
49
  width: "24",
50
50
  height: "24",
@@ -1,8 +1,8 @@
1
1
  const i = {
2
2
  classes: {
3
- wrapper: ({ props: e }) => {
4
- const t = ["px-3"];
5
- return t.push(e.dense ? "h-9 py-0.5" : "h-11 py-1"), e.textAlign === "left" ? t.push("text-left") : e.textAlign === "center" ? t.push("text-center") : e.textAlign === "right" ? t.push("text-right") : e.textAlign === "justify" && t.push("text-justify"), e.verticalAlign === "baseline" ? t.push("align-baseline") : e.verticalAlign === "bottom" ? t.push("align-bottom") : e.verticalAlign === "middle" ? t.push("align-middle") : e.verticalAlign === "text-bottom" ? t.push("align-text-bottom") : e.verticalAlign === "text-top" ? t.push("align-text-top") : e.verticalAlign === "top" && t.push("align-top"), e.truncate && t.push("truncate"), t;
3
+ wrapper: ({ props: t }) => {
4
+ const e = ["px-3"];
5
+ return e.push(t.dense ? "h-9 py-0.5" : "h-11 py-1"), t.to || t.href ? (e.push("flex items-center"), t.textAlign === "left" ? e.push("justify-start") : t.textAlign === "center" ? e.push("justify-center") : t.textAlign === "right" ? e.push("justify-end") : t.textAlign === "justify" && e.push("justify-center")) : (t.textAlign === "left" ? e.push("text-left") : t.textAlign === "center" ? e.push("text-center") : t.textAlign === "right" ? e.push("text-right") : t.textAlign === "justify" && e.push("text-justify"), t.verticalAlign === "baseline" ? e.push("align-baseline") : t.verticalAlign === "bottom" ? e.push("align-bottom") : t.verticalAlign === "middle" ? e.push("align-middle") : t.verticalAlign === "text-bottom" ? e.push("align-text-bottom") : t.verticalAlign === "text-top" ? e.push("align-text-top") : t.verticalAlign === "top" && e.push("align-top")), t.truncate && e.push("truncate"), e;
6
6
  }
7
7
  }
8
8
  }, l = i;
@@ -10,6 +10,7 @@ declare const tagProps: {
10
10
  outlined: BooleanConstructor;
11
11
  filled: BooleanConstructor;
12
12
  disabled: BooleanConstructor;
13
+ to: (ObjectConstructor | StringConstructor)[];
13
14
  color: {
14
15
  readonly type: StringConstructor;
15
16
  readonly default: string | undefined;
@@ -34,6 +35,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
34
35
  outlined: BooleanConstructor;
35
36
  filled: BooleanConstructor;
36
37
  disabled: BooleanConstructor;
38
+ to: (ObjectConstructor | StringConstructor)[];
37
39
  color: {
38
40
  readonly type: StringConstructor;
39
41
  readonly default: string | undefined;
@@ -53,6 +55,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
53
55
  outlined: BooleanConstructor;
54
56
  filled: BooleanConstructor;
55
57
  disabled: BooleanConstructor;
58
+ to: (ObjectConstructor | StringConstructor)[];
56
59
  color: {
57
60
  readonly type: StringConstructor;
58
61
  readonly default: string | undefined;
@@ -1,15 +1,15 @@
1
- import { defineComponent as g, computed as v, openBlock as l, createBlock as b, resolveDynamicComponent as x, normalizeClass as s, unref as r, normalizeStyle as k, withCtx as y, createElementVNode as t, renderSlot as n, createElementBlock as z, createVNode as B, createCommentVNode as C } from "vue";
2
- import { useColors as h } from "../../composables/useColors.js";
1
+ import { defineComponent as k, computed as l, useAttrs as x, openBlock as n, createBlock as h, resolveDynamicComponent as y, normalizeClass as t, unref as r, normalizeStyle as z, withCtx as B, createElementVNode as s, renderSlot as i, createElementBlock as C, createVNode as S, withModifiers as _, createCommentVNode as w } from "vue";
2
+ import { useColors as N } from "../../composables/useColors.js";
3
3
  import { useCommon as d } from "../../composables/useCommon.js";
4
- import { useTheme as _ } from "../../composables/useTheme.js";
5
- import { closeIcon as N } from "../../common/icons.js";
6
- import S from "../icon/Icon.vue.js";
7
- const $ = { class: "flex items-center gap-2" }, w = { class: "truncate" }, T = {
4
+ import { useTheme as T } from "../../composables/useTheme.js";
5
+ import { closeIcon as $ } from "../../common/icons.js";
6
+ import V from "../icon/Icon.vue.js";
7
+ const E = { class: "flex items-center gap-2" }, I = { class: "truncate" }, j = {
8
8
  key: 0,
9
9
  class: "absolute right-1.5 top-0 h-full flex items-center"
10
- }, V = {
10
+ }, A = {
11
11
  ...d.props(),
12
- ...h.props("secondary"),
12
+ ...N.props("secondary"),
13
13
  tag: {
14
14
  type: String,
15
15
  default: "span"
@@ -18,54 +18,56 @@ const $ = { class: "flex items-center gap-2" }, w = { class: "truncate" }, T = {
18
18
  removable: Boolean,
19
19
  outlined: Boolean,
20
20
  filled: Boolean,
21
- disabled: Boolean
22
- }, E = {
21
+ disabled: Boolean,
22
+ to: [String, Object]
23
+ }, D = {
23
24
  name: "XTag",
24
25
  validators: {
25
26
  ...d.validators()
26
27
  }
27
- }, A = /* @__PURE__ */ g({
28
- ...E,
29
- props: V,
28
+ }, G = /* @__PURE__ */ k({
29
+ ...D,
30
+ props: A,
30
31
  emits: ["remove"],
31
- setup(i) {
32
- const o = i, m = v(() => o.size === "xs" ? "xs" : o.size === "sm" ? "sm" : o.size === "lg" ? "md" : o.size === "xl" ? "lg" : "sm"), { styles: c, classes: u, className: p } = _("Tag", {}, o);
33
- return (e, a) => (l(), b(x(e.tag), {
34
- class: s([
32
+ setup(c) {
33
+ const o = c, m = l(() => o.size === "xs" ? "xs" : o.size === "sm" ? "sm" : o.size === "lg" ? "md" : o.size === "xl" ? "lg" : "sm"), u = x(), p = l(() => u.href ? "a" : o.to ? "router-link" : o.tag), { styles: f, classes: g, className: v } = T("Tag", {}, o);
34
+ return (e, a) => (n(), h(y(p.value), {
35
+ to: e.to,
36
+ class: t([
35
37
  "text-[color:var(--x-tag-text)] dark:text-[color:var(--x-tag-dark-text)] border relative",
36
38
  [
37
- r(p),
38
- r(u).wrapper,
39
+ r(v),
40
+ r(g).wrapper,
39
41
  e.outlined ? "border-[color:var(--x-tag-border)] dark:border-[color:var(--x-tag-dark-border)]" : "!border-transparent bg-[color:var(--x-tag-bg)] dark:bg-[color:var(--x-tag-dark-bg)]",
40
42
  e.rounded ? "rounded-full" : "rounded"
41
43
  ]
42
44
  ]),
43
- style: k(r(c))
45
+ style: z(r(f))
44
46
  }, {
45
- default: y(() => [
46
- t("span", {
47
- class: s(["max-w-full", { "pr-4": e.removable }])
47
+ default: B(() => [
48
+ s("span", {
49
+ class: t(["max-w-full", { "pr-4": e.removable }])
48
50
  }, [
49
- t("div", $, [
50
- n(e.$slots, "prefix"),
51
- t("div", w, [
52
- n(e.$slots, "default")
51
+ s("div", E, [
52
+ i(e.$slots, "prefix"),
53
+ s("div", I, [
54
+ i(e.$slots, "default")
53
55
  ])
54
56
  ]),
55
- e.removable ? (l(), z("div", T, [
56
- B(S, {
57
+ e.removable ? (n(), C("div", j, [
58
+ S(V, {
57
59
  size: m.value,
58
- icon: r(N),
59
- class: s(["cursor-pointer transition-colors duration-150", [e.disabled ? "text-secondary-400" : "hover:text-secondary-500"]]),
60
- onClick: a[0] || (a[0] = (f) => !e.disabled && e.$emit("remove", f))
60
+ icon: r($),
61
+ class: t(["cursor-pointer transition-colors duration-150", [e.disabled ? "text-secondary-400" : "hover:text-secondary-500"]]),
62
+ onClick: a[0] || (a[0] = _((b) => !e.disabled && e.$emit("remove", b), ["prevent"]))
61
63
  }, null, 8, ["size", "icon", "class"])
62
- ])) : C("", !0)
64
+ ])) : w("", !0)
63
65
  ], 2)
64
66
  ]),
65
67
  _: 3
66
- }, 8, ["style", "class"]));
68
+ }, 8, ["to", "style", "class"]));
67
69
  }
68
70
  });
69
71
  export {
70
- A as default
72
+ G as default
71
73
  };
@@ -18,6 +18,8 @@ declare const textareaProps: {
18
18
  preventEnter: BooleanConstructor;
19
19
  block: BooleanConstructor;
20
20
  resizable: BooleanConstructor;
21
+ showCounter: BooleanConstructor;
22
+ clearable: BooleanConstructor;
21
23
  modelValue: {
22
24
  readonly type: import("vue").PropType<string | number | boolean | object | any[] | undefined>;
23
25
  readonly default: undefined;
@@ -54,13 +56,13 @@ declare const textareaProps: {
54
56
  };
55
57
  };
56
58
  export type TextareaProps = ExtractPublicPropTypes<typeof textareaProps>;
57
- type InternalClasses = 'wrapper' | 'input';
59
+ type InternalClasses = 'wrapper' | 'input' | 'icon';
58
60
  type InternalExtraData = {
59
61
  errorInternal: Ref<boolean>;
60
62
  };
61
63
  export interface TextareaTheme extends ThemeComponent<TextareaProps, InternalClasses, InternalExtraData> {
62
64
  }
63
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
65
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
64
66
  dir: {
65
67
  type: StringConstructor;
66
68
  default: string;
@@ -78,6 +80,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
78
80
  preventEnter: BooleanConstructor;
79
81
  block: BooleanConstructor;
80
82
  resizable: BooleanConstructor;
83
+ showCounter: BooleanConstructor;
84
+ clearable: BooleanConstructor;
81
85
  modelValue: {
82
86
  readonly type: import("vue").PropType<string | number | boolean | object | any[] | undefined>;
83
87
  readonly default: undefined;
@@ -136,6 +140,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
136
140
  preventEnter: BooleanConstructor;
137
141
  block: BooleanConstructor;
138
142
  resizable: BooleanConstructor;
143
+ showCounter: BooleanConstructor;
144
+ clearable: BooleanConstructor;
139
145
  modelValue: {
140
146
  readonly type: import("vue").PropType<string | number | boolean | object | any[] | undefined>;
141
147
  readonly default: undefined;
@@ -185,10 +191,20 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
185
191
  hideFooter: boolean;
186
192
  rules: unknown[];
187
193
  skipFormRegistry: boolean;
194
+ clearable: boolean;
188
195
  dir: string;
196
+ showCounter: boolean;
189
197
  rows: string | number;
190
198
  adjustToText: boolean;
191
199
  preventEnter: boolean;
192
200
  resizable: boolean;
193
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
201
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
202
+ prefix?(_: {}): any;
203
+ suffix?(_: {}): any;
204
+ }>;
194
205
  export default _default;
206
+ type __VLS_WithTemplateSlots<T, S> = T & {
207
+ new (): {
208
+ $slots: S;
209
+ };
210
+ };
@@ -1,17 +1,19 @@
1
- import { defineComponent as q, useAttrs as R, computed as A, ref as F, watch as H, openBlock as u, createBlock as p, normalizeStyle as K, unref as r, normalizeClass as L, withCtx as O, createElementVNode as $, mergeProps as D, toHandlers as W, withKeys as X, createCommentVNode as G } from "vue";
2
- import { useResizeObserver as J, useEventListener as M } from "../../node_modules/.pnpm/@vueuse_core@11.1.0_vue@3.5.10_typescript@5.2.2_/node_modules/@vueuse/core/index.js";
3
- import { useCSS as Q } from "../../composables/useCSS.js";
4
- import { useTheme as U } from "../../composables/useTheme.js";
5
- import { useCommon as f } from "../../composables/useCommon.js";
6
- import { useColors as Y } from "../../composables/useColors.js";
7
- import { useInputtable as a } from "../../composables/useInputtable.js";
8
- import { useInteractive as c } from "../../composables/useInteractive.js";
9
- import Z from "../label/Label.vue.js";
10
- import _ from "../inputFooter/InputFooter.vue.js";
11
- const ee = ["id", "disabled", "max", "maxlength", "min", "dir", "rows", "minlength", "name", "placeholder", "readonly", "value"], re = {
12
- ...f.props(),
13
- ...c.props(),
14
- ...a.props(),
1
+ import { defineComponent as O, useAttrs as D, computed as i, ref as W, watch as X, openBlock as u, createBlock as m, normalizeStyle as G, unref as r, normalizeClass as h, withCtx as J, createElementVNode as b, renderSlot as g, mergeProps as M, toHandlers as Q, withKeys as U, createCommentVNode as v } from "vue";
2
+ import { useResizeObserver as Y, useEventListener as Z } from "../../node_modules/.pnpm/@vueuse_core@11.1.0_vue@3.5.10_typescript@5.2.2_/node_modules/@vueuse/core/index.js";
3
+ import { useCSS as _ } from "../../composables/useCSS.js";
4
+ import { useTheme as ee } from "../../composables/useTheme.js";
5
+ import { useCommon as y } from "../../composables/useCommon.js";
6
+ import { useColors as re } from "../../composables/useColors.js";
7
+ import { useInputtable as d } from "../../composables/useInputtable.js";
8
+ import { useInteractive as w } from "../../composables/useInteractive.js";
9
+ import oe from "../label/Label.vue.js";
10
+ import te from "../inputFooter/InputFooter.vue.js";
11
+ import ne from "../icon/Icon.vue.js";
12
+ import { closeIcon as se } from "../../common/icons.js";
13
+ const le = { class: "relative" }, ae = ["id", "disabled", "max", "maxlength", "min", "dir", "rows", "minlength", "name", "placeholder", "readonly", "value"], ie = {
14
+ ...y.props(),
15
+ ...w.props(),
16
+ ...d.props(),
15
17
  dir: {
16
18
  type: String,
17
19
  default: "ltr"
@@ -28,88 +30,112 @@ const ee = ["id", "disabled", "max", "maxlength", "min", "dir", "rows", "minleng
28
30
  adjustToText: Boolean,
29
31
  preventEnter: Boolean,
30
32
  block: Boolean,
31
- resizable: Boolean
32
- }, oe = {
33
+ resizable: Boolean,
34
+ showCounter: Boolean,
35
+ clearable: Boolean
36
+ }, ue = {
33
37
  name: "XTextarea",
34
38
  validators: {
35
- ...f.validators()
39
+ ...y.validators()
36
40
  }
37
- }, ce = /* @__PURE__ */ q({
38
- ...oe,
39
- props: re,
40
- emits: a.emits(),
41
- setup(h, { expose: b, emit: g }) {
42
- const t = h, y = g, i = R(), v = A(() => Object.keys(i).reduce((e, s) => (s.startsWith("data-") && (e[s] = i[s]), e), {})), o = F(null);
43
- J(o, n), typeof window < "u" && M(window, "resize", n), H([() => t.modelValue, () => t.size], () => {
44
- setTimeout(n);
41
+ }, ze = /* @__PURE__ */ O({
42
+ ...ue,
43
+ props: ie,
44
+ emits: d.emits(),
45
+ setup(S, { expose: C, emit: k }) {
46
+ const o = S, z = k, p = D(), B = i(() => Object.keys(p).reduce((e, n) => (n.startsWith("data-") && (e[n] = p[n]), e), {})), t = W(null);
47
+ Y(t, s), typeof window < "u" && Z(window, "resize", s), X([() => o.modelValue, () => o.size], () => {
48
+ setTimeout(s);
45
49
  });
46
- const w = Q("textarea"), S = Y().getPalette("primary"), k = w.get("border", S[400]);
47
- function N() {
48
- n();
50
+ const I = _("textarea"), N = re().getPalette("primary"), T = I.get("border", N[400]);
51
+ function E() {
52
+ s();
49
53
  }
50
- function T(e) {
51
- t.preventEnter && e.preventDefault(), e.stopPropagation();
54
+ function V(e) {
55
+ o.preventEnter && e.preventDefault(), e.stopPropagation();
52
56
  }
53
- function n() {
54
- t.adjustToText && o.value && (o.value.style.height = "1px", o.value.style.height = 2 + o.value.scrollHeight + "px");
57
+ function s() {
58
+ o.adjustToText && t.value && (t.value.style.height = "1px", t.value.style.height = 2 + t.value.scrollHeight + "px");
55
59
  }
56
- const { focus: m, blur: z } = c(o), {
60
+ const { focus: c, blur: $ } = w(t), {
57
61
  errorInternal: l,
58
- hideFooterInternal: C,
59
- isInsideForm: B,
60
- inputListeners: E,
61
- reset: I,
62
- validate: V,
63
- setError: x
64
- } = a(t, { focus: m, emit: y }), { styles: P, classes: d, className: j } = U("Textarea", {}, t, { errorInternal: l });
65
- return b({ focus: m, blur: z, reset: I, validate: V, setError: x }), (e, s) => (u(), p(Z, {
66
- style: K(r(P)),
62
+ hideFooterInternal: x,
63
+ isInsideForm: P,
64
+ inputListeners: j,
65
+ reset: f,
66
+ validate: q,
67
+ setError: L
68
+ } = d(o, { focus: c, emit: z }), R = i(() => {
69
+ const e = o.modelValue;
70
+ return e ? String(e).length : 0;
71
+ }), A = i(() => o.clearable && o.modelValue !== "");
72
+ function F(e) {
73
+ return typeof e > "u" || e === null;
74
+ }
75
+ const { styles: H, classes: a, className: K } = ee("Textarea", {}, o, { errorInternal: l });
76
+ return C({ focus: c, blur: $, reset: f, validate: q, setError: L }), (e, n) => (u(), m(oe, {
77
+ style: G(r(H)),
67
78
  block: e.block,
68
79
  disabled: e.disabled,
69
80
  required: e.required,
70
- "is-inside-form": r(B),
81
+ "is-inside-form": r(P),
71
82
  label: e.label,
72
- class: L([
73
- r(j),
74
- r(d).wrapper
83
+ class: h([
84
+ r(K),
85
+ r(a).wrapper
75
86
  ]),
76
87
  tooltip: e.tooltip
77
88
  }, {
78
- default: O(() => [
79
- $("textarea", D({
80
- id: e.id,
81
- ref_key: "elRef",
82
- ref: o,
83
- class: ["", [
84
- r(d).input,
85
- r(l) ? "border-error-500 dark:border-error-400 focus:outline-error-500" : "focus:outline-[color:var(--x-textarea-border)]"
86
- ]],
87
- style: r(k),
88
- disabled: e.disabled,
89
- max: e.max,
90
- maxlength: e.maxlength,
91
- min: e.min,
92
- dir: e.dir,
93
- rows: e.rows,
94
- minlength: e.minlength,
95
- name: e.name,
96
- placeholder: e.placeholder,
97
- readonly: e.readonly,
98
- value: typeof e.modelValue < "u" ? String(e.modelValue) : ""
99
- }, v.value, W(r(E), !0), {
100
- onKeydown: X(T, ["enter"]),
101
- onInput: N
102
- }), null, 16, ee),
103
- r(C) ? G("", !0) : (u(), p(_, {
89
+ default: J(() => [
90
+ b("div", le, [
91
+ g(e.$slots, "prefix"),
92
+ b("textarea", M({
93
+ id: e.id,
94
+ ref_key: "elRef",
95
+ ref: t,
96
+ class: ["", [
97
+ r(a).input,
98
+ r(l) ? "border-error-500 dark:border-error-400 focus:outline-error-500" : "focus:outline-[color:var(--x-textarea-border)]"
99
+ ]],
100
+ style: r(T),
101
+ disabled: e.disabled,
102
+ max: e.max,
103
+ maxlength: e.maxlength,
104
+ min: e.min,
105
+ dir: e.dir,
106
+ rows: e.rows,
107
+ minlength: e.minlength,
108
+ name: e.name,
109
+ placeholder: e.placeholder,
110
+ readonly: e.readonly,
111
+ value: F(e.modelValue) ? "" : String(e.modelValue)
112
+ }, B.value, Q(r(j), !0), {
113
+ onKeydown: U(V, ["enter"]),
114
+ onInput: E
115
+ }), null, 16, ae),
116
+ g(e.$slots, "suffix", {}, () => [
117
+ A.value ? (u(), m(ne, {
118
+ key: 0,
119
+ size: e.size,
120
+ icon: r(se),
121
+ class: h(["right-2 cursor-pointer", r(a).icon]),
122
+ onClick: n[0] || (n[0] = (de) => r(f)())
123
+ }, null, 8, ["size", "icon", "class"])) : v("", !0)
124
+ ])
125
+ ]),
126
+ r(x) ? v("", !0) : (u(), m(te, {
104
127
  key: 0,
105
128
  error: r(l),
106
- helper: e.helper
107
- }, null, 8, ["error", "helper"]))
129
+ helper: e.helper,
130
+ "character-count": R.value,
131
+ "max-characters": e.maxlength,
132
+ "show-counter": e.showCounter
133
+ }, null, 8, ["error", "helper", "character-count", "max-characters", "show-counter"]))
108
134
  ]),
109
- _: 1
135
+ _: 3
110
136
  }, 8, ["style", "block", "disabled", "required", "is-inside-form", "label", "class", "tooltip"]));
111
137
  }
112
138
  });
113
139
  export {
114
- ce as default
140
+ ze as default
115
141
  };
@@ -4,7 +4,8 @@ const a = {
4
4
  input: ({ props: s, data: r }) => {
5
5
  const e = ["appearance-none block w-full placeholder-secondary-400 dark:placeholder-secondary-500 outline-transparent outline outline-2 outline-offset-[-1px] transition duration-150 ease-in-out border-secondary-300 dark:border-secondary-700 border shadow-sm rounded-md"];
6
6
  return s.resizable || e.push("resize-none"), !r.errorInternal && !s.disabled && e.push("hover:border-secondary-400 dark:hover:border-secondary-500"), s.size === "xs" ? e.push("px-2 py-1 text-xs") : s.size === "sm" ? e.push("px-2 py-1.5 text-sm") : s.size === "lg" ? e.push("px-4 py-3 text-lg") : s.size === "xl" ? e.push("px-5 py-4 text-xl") : e.push("px-3 py-2"), e.push(s.disabled ? "bg-secondary-100 dark:bg-secondary-700 text-secondary-400 dark:text-secondary-600 cursor-not-allowed" : "bg-white dark:bg-secondary-800 text-secondary-700 dark:text-secondary-200"), e;
7
- }
7
+ },
8
+ icon: "text-secondary-600 dark:text-secondary-300 absolute my-auto inset-y-0"
8
9
  }
9
10
  }, t = a;
10
11
  export {
@@ -4,7 +4,8 @@ const a = {
4
4
  input: ({ props: r, data: s }) => {
5
5
  const e = ["resize-none appearance-none block w-full placeholder-secondary-400 dark:placeholder-secondary-500 outline-transparent outline outline-2 outline-offset-[-1px] transition duration-150 ease-in-out border-secondary-300 dark:border-secondary-700 border-b text-sm px-4"];
6
6
  return !s.errorInternal && !r.disabled && e.push("hover:border-secondary-400 dark:hover:border-secondary-500"), r.size === "xs" || r.size === "sm" ? e.push("py-1.5") : r.size === "lg" || r.size === "xl" ? e.push("py-3.5") : e.push("py-2.5"), r.disabled ? e.push("bg-secondary-100 dark:bg-secondary-900 text-secondary-300 cursor-not-allowed") : r.readonly ? e.push("bg-white dark:bg-secondary-900 text-secondary-700") : e.push("bg-secondary-50 dark:bg-secondary-800 text-secondary-700 dark:text-secondary-200"), e;
7
- }
7
+ },
8
+ icon: "text-secondary-600 dark:text-secondary-300 absolute my-auto inset-y-0"
8
9
  }
9
10
  }, n = a;
10
11
  export {