@v1nt1248/3nclient-lib 0.3.23 → 0.3.25

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.
@@ -17693,9 +17693,14 @@ var Rl = {
17693
17693
  ui3nEmoji: "_ui3nEmoji_2j41l_1",
17694
17694
  readonly: "_readonly_2j41l_14"
17695
17695
  } }]]), Zl = [
17696
+ "autocomplete",
17696
17697
  "type",
17697
17698
  "placeholder",
17698
- "disabled"
17699
+ "disabled",
17700
+ "readonly",
17701
+ "name",
17702
+ "maxlength",
17703
+ "minlength"
17699
17704
  ], Ql = /* @__PURE__ */ Q(/* @__PURE__ */ d({
17700
17705
  __name: "ui3n-input",
17701
17706
  props: {
@@ -17712,8 +17717,14 @@ var Rl = {
17712
17717
  type: Boolean,
17713
17718
  default: !1
17714
17719
  },
17715
- icon: { default: "" },
17716
- iconColor: { default: "" },
17720
+ readonly: {
17721
+ type: Boolean,
17722
+ default: !1
17723
+ },
17724
+ name: {},
17725
+ maxlength: {},
17726
+ minlength: {},
17727
+ autocomplete: { default: "off" },
17717
17728
  rules: { default: () => [] },
17718
17729
  validateAtStartup: {
17719
17730
  type: Boolean,
@@ -17748,152 +17759,164 @@ var Rl = {
17748
17759
  "update:valid"
17749
17760
  ],
17750
17761
  setup(e, { expose: t, emit: n }) {
17751
- M((e) => ({ v39c82ea0: _.value }));
17752
- let r = e, l = n, u = C(null), d = C(""), f = C(!1), p = C(!1), m = C(""), _ = i(() => r.disabled ? "var(--color-icon-control-primary-disabled)" : r.iconColor || "var(--color-icon-control-primary-default)"), v = i(() => r.displayStateMode === "success" && r.displayStateWithIcon && !p.value), y = i(() => !r.disabled && r.clearable && !!d.value && !v.value), S = i(() => !!m.value || !!(r.displayStateMode && r.displayStateMessage)), w = i(() => !!m.value || r.displayStateMode === "error" && !!r.displayStateMessage), T = i(() => r.displayStateMode === "success" && !!r.displayStateMessage);
17753
- function E(e) {
17762
+ let r = e, l = n, u = N(), d = C(null), f = C(""), p = C(!1), m = C(!1), _ = C(""), v = i(() => !!u["prepend-icon"]), y = i(() => !!u["append-icon"]), S = i(() => r.displayStateMode === "success" && r.displayStateWithIcon && !m.value), w = i(() => !r.disabled && r.clearable && !!f.value && !S.value), E = i(() => S.value || w.value || y.value), O = i(() => !!_.value || !!(r.displayStateMode && r.displayStateMessage)), k = i(() => !!_.value || r.displayStateMode === "error" && !!r.displayStateMessage), A = i(() => r.displayStateMode === "success" && !!r.displayStateMessage);
17763
+ function j(e) {
17754
17764
  return e.target.value;
17755
17765
  }
17756
- function O(e) {
17766
+ function M(e) {
17757
17767
  let t = [];
17758
17768
  for (let n of r.rules) {
17759
17769
  if (typeof n != "function") continue;
17760
17770
  let r = n(e);
17761
17771
  typeof r == "string" ? t.push(r) : r || t.push("Invalid");
17762
17772
  }
17763
- m.value = t.join(". "), (f.value || r.validateAtStartup) && l("update:valid", t.length === 0);
17773
+ _.value = t.join(". "), (p.value || r.validateAtStartup) && l("update:valid", t.length === 0);
17764
17774
  }
17765
- function k(e) {
17766
- p.value = !0, l("focus", e);
17775
+ function P(e) {
17776
+ m.value = !0, l("focus", e);
17767
17777
  }
17768
- function A(e) {
17778
+ function F(e) {
17769
17779
  h(() => {
17770
- p.value = !1, l("blur", e);
17780
+ m.value = !1, l("blur", e);
17771
17781
  });
17772
17782
  }
17773
- function j(e) {
17774
- let t = E(e);
17775
- O(t), l("change", t);
17783
+ function L(e) {
17784
+ let t = j(e);
17785
+ M(t), l("change", t);
17776
17786
  }
17777
- function N(e) {
17778
- let t = E(e);
17779
- d.value = t, f.value = !0, O(t), l("update:modelValue", t), l("input", t);
17787
+ function R(e) {
17788
+ let t = j(e);
17789
+ f.value = t, p.value = !0, M(t), l("update:modelValue", t), l("input", t);
17780
17790
  }
17781
- function P(e) {
17791
+ function V(e) {
17782
17792
  let { altKey: t, ctrlKey: n, metaKey: r, shiftKey: i } = e;
17783
- f.value = !0, O(d.value), l("enter", {
17784
- value: d.value,
17793
+ p.value = !0, M(f.value), l("enter", {
17794
+ value: f.value,
17785
17795
  altKey: t,
17786
17796
  ctrlKey: n,
17787
17797
  metaKey: r,
17788
17798
  shiftKey: i
17789
17799
  });
17790
17800
  }
17791
- function F(e) {
17792
- f.value = !0, O(d.value), l("escape", e);
17801
+ function H(e) {
17802
+ p.value = !0, M(f.value), l("escape", e);
17793
17803
  }
17794
- function L(e) {
17804
+ function ee(e) {
17795
17805
  l("keydown", e);
17796
17806
  }
17797
- function R() {
17798
- d.value = "", f.value = !1, m.value = "", u.value && (u.value.value = "", u.value.focus()), l("update:modelValue", ""), l("input", ""), l("change", ""), l("clear"), l("update:valid", !0);
17807
+ function te() {
17808
+ f.value = "", p.value = !1, _.value = "", d.value && (d.value.value = "", d.value.focus()), l("update:modelValue", ""), l("input", ""), l("change", ""), l("clear"), l("update:valid", !0);
17799
17809
  }
17800
17810
  return t({
17801
- isDirty: f,
17802
- isFocused: p,
17803
- clearValue: R
17811
+ inputElement: d,
17812
+ isDirty: p,
17813
+ isFocused: m,
17814
+ clearValue: te
17804
17815
  }), b(() => {
17805
- d.value = r.modelValue ?? "", u.value && (u.value.value = d.value, r.autofocus && u.value.focus(), l("init", u.value)), r.validateAtStartup && (f.value = !0, O(d.value));
17816
+ f.value = r.modelValue ?? "", d.value && (d.value.value = f.value, r.autofocus && d.value.focus(), l("init", d.value)), r.validateAtStartup && (p.value = !0, M(f.value));
17806
17817
  }), I(() => r.modelValue, (e) => {
17807
17818
  let t = e ?? "";
17808
- t !== d.value && (d.value = t, u.value && (u.value.value = t), O(t));
17819
+ t !== f.value && (f.value = t, d.value && (d.value.value = t), M(t));
17809
17820
  }), (t, n) => (x(), s("div", { class: g([
17810
17821
  t.$style.ui3nInput,
17811
17822
  e.size === "large" && t.$style.large,
17812
17823
  e.label && t.$style.withLabel,
17813
17824
  e.hideBottomSpace && t.$style.withoutBottomSpace,
17814
- e.icon && t.$style.withIcon,
17815
- e.clearable && d.value && t.$style.clearable,
17816
17825
  e.disabled && t.$style.disabled,
17817
- (!!m.value || e.displayStateMode === "error") && t.$style.error,
17826
+ (!!_.value || e.displayStateMode === "error") && t.$style.error,
17818
17827
  e.displayStateMode === "success" && t.$style.success
17819
17828
  ]) }, [
17820
17829
  e.label ? (x(), s("label", {
17821
17830
  key: 0,
17822
17831
  class: g(t.$style.ui3nInputLabel)
17823
17832
  }, D(e.label), 3)) : o("", !0),
17824
- c("input", {
17825
- ref_key: "inputElement",
17826
- ref: u,
17827
- autocomplete: "off",
17828
- type: e.type,
17829
- placeholder: e.placeholder,
17830
- disabled: e.disabled,
17831
- class: g(t.$style.ui3nInputField),
17832
- onInput: N,
17833
- onKeydown: [
17834
- z(P, ["enter"]),
17835
- z(F, ["esc"]),
17836
- L
17837
- ],
17838
- onFocusin: k,
17839
- onFocusout: A,
17840
- onChange: j
17841
- }, null, 42, Zl),
17842
- e.icon ? (x(), a(Hl, {
17833
+ c("div", { class: g([
17834
+ t.$style.inputWrapper,
17835
+ v.value && t.$style.withPrepend,
17836
+ E.value && t.$style.withAppend
17837
+ ]) }, [
17838
+ v.value ? (x(), s("div", {
17839
+ key: 0,
17840
+ class: g(t.$style.prependIconSlot)
17841
+ }, [T(t.$slots, "prepend-icon")], 2)) : o("", !0),
17842
+ c("input", {
17843
+ ref_key: "inputElement",
17844
+ ref: d,
17845
+ autocomplete: e.autocomplete,
17846
+ type: e.type,
17847
+ placeholder: e.placeholder,
17848
+ disabled: e.disabled,
17849
+ readonly: e.readonly,
17850
+ name: e.name,
17851
+ maxlength: e.maxlength,
17852
+ minlength: e.minlength,
17853
+ class: g(t.$style.ui3nInputField),
17854
+ onInput: R,
17855
+ onKeydown: [
17856
+ z(V, ["enter"]),
17857
+ z(H, ["esc"]),
17858
+ ee
17859
+ ],
17860
+ onFocus: P,
17861
+ onBlur: F,
17862
+ onChange: L
17863
+ }, null, 42, Zl),
17864
+ E.value ? (x(), s("div", {
17865
+ key: 1,
17866
+ class: g(t.$style.appendIconSlot)
17867
+ }, [
17868
+ S.value ? (x(), a(Hl, {
17869
+ key: 0,
17870
+ icon: "round-check-circle-outline",
17871
+ size: 16,
17872
+ color: "var(--success-content-default)",
17873
+ class: g(t.$style.appendSlotItem)
17874
+ }, null, 8, ["class"])) : o("", !0),
17875
+ w.value ? (x(), a(Gl, {
17876
+ key: 1,
17877
+ type: "icon",
17878
+ size: "small",
17879
+ color: "transparent",
17880
+ icon: "round-close",
17881
+ "icon-size": "16",
17882
+ "icon-color": "var(--color-icon-control-accent-default)",
17883
+ class: g(t.$style.appendSlotItem),
17884
+ onMousedown: n[0] ||= B(() => {}, ["prevent"]),
17885
+ onTouchstart: n[1] ||= B(() => {}, ["prevent"]),
17886
+ onClick: te
17887
+ }, null, 8, ["class"])) : o("", !0),
17888
+ y.value ? T(t.$slots, "append-icon", { key: 2 }) : o("", !0)
17889
+ ], 2)) : o("", !0)
17890
+ ], 2),
17891
+ O.value ? (x(), s("div", {
17843
17892
  key: 1,
17844
- icon: e.icon,
17845
- size: 16,
17846
- class: g([t.$style.ui3nInputIcon, e.disabled && t.$style.ui3nInputIconDisabled])
17847
- }, null, 8, ["icon", "class"])) : o("", !0),
17848
- v.value ? (x(), a(Hl, {
17849
- key: 2,
17850
- icon: "round-check-circle-outline",
17851
- size: 16,
17852
- color: "var(--success-content-default)",
17853
- class: g(t.$style.ui3nInputSuccessIcon)
17854
- }, null, 8, ["class"])) : o("", !0),
17855
- y.value ? (x(), a(Gl, {
17856
- key: 3,
17857
- type: "icon",
17858
- size: "small",
17859
- color: "transparent",
17860
- icon: "round-close",
17861
- "icon-size": "16",
17862
- "icon-color": "var(--color-icon-control-accent-default)",
17863
- class: g(t.$style.clearBtn),
17864
- onMousedown: n[0] ||= B(() => {}, ["prevent"]),
17865
- onTouchstart: n[1] ||= B(() => {}, ["prevent"]),
17866
- onClick: R
17867
- }, null, 8, ["class"])) : o("", !0),
17868
- S.value ? (x(), s("div", {
17869
- key: 4,
17870
17893
  class: g([
17871
17894
  t.$style.ui3nInputFieldMessage,
17872
- w.value && t.$style.ui3nInputErrorMessage,
17873
- T.value && t.$style.ui3nInputSuccessMessage
17895
+ k.value && t.$style.ui3nInputErrorMessage,
17896
+ A.value && t.$style.ui3nInputSuccessMessage
17874
17897
  ])
17875
- }, D(m.value || e.displayStateMessage), 3)) : o("", !0)
17898
+ }, D(_.value || e.displayStateMessage), 3)) : o("", !0)
17876
17899
  ], 2));
17877
17900
  }
17878
17901
  }), [["__cssModules", { $style: {
17879
- ui3nInput: "_ui3nInput_m8cvd_1",
17880
- withLabel: "_withLabel_m8cvd_11",
17881
- large: "_large_m8cvd_14",
17882
- clearBtn: "_clearBtn_m8cvd_21",
17883
- withIcon: "_withIcon_m8cvd_24",
17884
- ui3nInputIcon: "_ui3nInputIcon_m8cvd_24",
17885
- withoutBottomSpace: "_withoutBottomSpace_m8cvd_33",
17886
- ui3nInputField: "_ui3nInputField_m8cvd_36",
17887
- ui3nInputLabel: "_ui3nInputLabel_m8cvd_50",
17888
- ui3nInputIconDisabled: "_ui3nInputIconDisabled_m8cvd_98",
17889
- ui3nInputFieldMessage: "_ui3nInputFieldMessage_m8cvd_109",
17890
- ui3nInputErrorMessage: "_ui3nInputErrorMessage_m8cvd_120",
17891
- ui3nInputSuccessMessage: "_ui3nInputSuccessMessage_m8cvd_124",
17892
- clearable: "_clearable_m8cvd_128",
17893
- error: "_error_m8cvd_142",
17894
- success: "_success_m8cvd_149",
17895
- ui3nInputSuccessIcon: "_ui3nInputSuccessIcon_m8cvd_153",
17896
- disabled: "_disabled_m8cvd_159"
17902
+ ui3nInput: "_ui3nInput_11ztm_1",
17903
+ withLabel: "_withLabel_11ztm_13",
17904
+ large: "_large_11ztm_18",
17905
+ withoutBottomSpace: "_withoutBottomSpace_11ztm_30",
17906
+ inputWrapper: "_inputWrapper_11ztm_33",
17907
+ ui3nInputField: "_ui3nInputField_11ztm_36",
17908
+ ui3nInputLabel: "_ui3nInputLabel_11ztm_44",
17909
+ prependIconSlot: "_prependIconSlot_11ztm_97",
17910
+ appendIconSlot: "_appendIconSlot_11ztm_104",
17911
+ withPrepend: "_withPrepend_11ztm_112",
17912
+ withAppend: "_withAppend_11ztm_116",
17913
+ appendSlotItem: "_appendSlotItem_11ztm_120",
17914
+ ui3nInputFieldMessage: "_ui3nInputFieldMessage_11ztm_124",
17915
+ ui3nInputErrorMessage: "_ui3nInputErrorMessage_11ztm_135",
17916
+ ui3nInputSuccessMessage: "_ui3nInputSuccessMessage_11ztm_139",
17917
+ error: "_error_11ztm_143",
17918
+ success: "_success_11ztm_150",
17919
+ disabled: "_disabled_11ztm_154"
17897
17920
  } }]]), $l = /* @__PURE__ */ W(((e, t) => {
17898
17921
  var n = Ei(), r = ca(), i = aa(), a = "[object String]";
17899
17922
  function o(e) {
@@ -18833,9 +18856,11 @@ var zu = ["id"], Bu = /* @__PURE__ */ Q(/* @__PURE__ */ d({
18833
18856
  }
18834
18857
  return b(() => {
18835
18858
  u.value && (u.value.style.setProperty("--ui3n-dialog-confirm-button-color", n.confirmButtonColor), u.value.style.setProperty("--ui3n-dialog-cancel-button-color", n.cancelButtonColor), u.value.style.setProperty("--ui3n-dialog-confirm-background-color", n.confirmButtonBackground), u.value.style.setProperty("--ui3n-dialog-cancel-background-color", n.cancelButtonBackground), h(() => {
18836
- u.value.focus(), setTimeout(() => {
18837
- let e = u.value.getBoundingClientRect();
18838
- f.value.initialLeft = e.left, f.value.initialTop = e.top;
18859
+ u.value && u.value.focus(), setTimeout(() => {
18860
+ if (u.value) {
18861
+ let e = u.value.getBoundingClientRect();
18862
+ f.value.initialLeft = e.left, f.value.initialTop = e.top;
18863
+ }
18839
18864
  }, 100);
18840
18865
  }));
18841
18866
  }), (t, i) => (x(), s("div", m({
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@v1nt1248/3nclient-lib",
3
3
  "license": "AGPL-3.0-or-later",
4
4
  "author": "v1nt1248",
5
- "version": "0.3.23",
5
+ "version": "0.3.25",
6
6
  "description": "Library for 3NWeb clients",
7
7
  "type": "module",
8
8
  "files": [
@@ -10,7 +10,7 @@ import type { Ui3nDropFilesProps, Ui3nDropFilesEmits, Ui3nDropFilesSlots } from
10
10
  import Ui3nEmoji from './ui3n-emoji/ui3n-emoji.vue';
11
11
  import type { Ui3nEmojiProps, Ui3nEmojiEmits } from './ui3n-emoji/types';
12
12
  import Ui3nInput from './ui3n-input/ui3n-input.vue';
13
- import type { Ui3nInputProps, Ui3nInputEmits } from './ui3n-input/types';
13
+ import type { Ui3nInputProps, Ui3nInputEmits, Ui3nInputSlots, Ui3nInputExpose } from './ui3n-input/types';
14
14
  import Ui3nInputFile from './ui3n-input-file/ui3n-input-file.vue';
15
15
  import type { Ui3nInputFileProps, Ui3nInputFileEmits } from './ui3n-input-file/types';
16
16
  import Ui3nText from './ui3n-text/ui3n-text.vue';
@@ -142,6 +142,8 @@ export {
142
142
  Ui3nInput,
143
143
  Ui3nInputProps,
144
144
  Ui3nInputEmits,
145
+ Ui3nInputSlots,
146
+ Ui3nInputExpose,
145
147
  Ui3nInputFile,
146
148
  Ui3nInputFileProps,
147
149
  Ui3nInputFileEmits,
@@ -112,12 +112,14 @@
112
112
  dialogElement.value.style.setProperty('--ui3n-dialog-cancel-background-color', props.cancelButtonBackground);
113
113
 
114
114
  nextTick(() => {
115
- dialogElement.value!.focus();
115
+ dialogElement.value && dialogElement.value.focus();
116
116
 
117
117
  setTimeout(() => {
118
- const dialogClientRect = dialogElement.value!.getBoundingClientRect();
119
- dragData.value.initialLeft = dialogClientRect.left;
120
- dragData.value.initialTop = dialogClientRect.top;
118
+ if (dialogElement.value) {
119
+ const dialogClientRect = dialogElement.value.getBoundingClientRect();
120
+ dragData.value.initialLeft = dialogClientRect.left;
121
+ dragData.value.initialTop = dialogClientRect.top;
122
+ }
121
123
  }, 100);
122
124
  });
123
125
  }
@@ -134,12 +136,12 @@
134
136
  v-on="
135
137
  draggable
136
138
  ? {
137
- dragstart: onDragstart,
138
- mousedown: onMousedown,
139
- mouseup: onMouseup,
140
- mousemove: onMousemove,
141
- keydown: onKeydown,
142
- }
139
+ dragstart: onDragstart,
140
+ mousedown: onMousedown,
141
+ mouseup: onMouseup,
142
+ mousemove: onMousemove,
143
+ keydown: onKeydown,
144
+ }
143
145
  : { keydown: onKeydown }
144
146
  "
145
147
  >
@@ -1,3 +1,5 @@
1
+ import type { Ref, VNode } from 'vue';
2
+
1
3
  export interface Ui3nInputProps {
2
4
  /**
3
5
  * Input value
@@ -32,13 +34,27 @@ export interface Ui3nInputProps {
32
34
  */
33
35
  autofocus?: boolean;
34
36
  /**
35
- * Input icon
37
+ * Whether input is readonly
38
+ * @default false
39
+ */
40
+ readonly?: boolean;
41
+ /**
42
+ * Input name attribute (for use in native forms)
43
+ */
44
+ name?: string;
45
+ /**
46
+ * Maximum length of input value
36
47
  */
37
- icon?: string;
48
+ maxlength?: number;
38
49
  /**
39
- * Input icon color
50
+ * Minimum length of input value
40
51
  */
41
- iconColor?: string;
52
+ minlength?: number;
53
+ /**
54
+ * Autocomplete attribute
55
+ * @default 'off'
56
+ */
57
+ autocomplete?: string;
42
58
  /**
43
59
  * Validation rules
44
60
  */
@@ -128,3 +144,33 @@ export interface Ui3nInputEmits {
128
144
  */
129
145
  (event: 'update:valid', value: boolean): void;
130
146
  }
147
+
148
+ export interface Ui3nInputSlots {
149
+ /**
150
+ * Slot for prepend icon (displayed at the start of the input)
151
+ */
152
+ 'prepend-icon'?: () => VNode[];
153
+ /**
154
+ * Slot for append icon (displayed at the end of the input)
155
+ */
156
+ 'append-icon'?: () => VNode[];
157
+ }
158
+
159
+ export interface Ui3nInputExpose {
160
+ /**
161
+ * Reference to the input DOM element
162
+ */
163
+ inputElement: Ref<HTMLInputElement | null>;
164
+ /**
165
+ * Whether the input has been modified
166
+ */
167
+ isDirty: Ref<boolean>;
168
+ /**
169
+ * Whether the input is currently focused
170
+ */
171
+ isFocused: Ref<boolean>;
172
+ /**
173
+ * Clear the input value
174
+ */
175
+ clearValue: () => void;
176
+ }