@nmorph/nmorph-ui-kit 2.2.37 → 2.2.38

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 (52) hide show
  1. package/dist/components/data/nmorph-card/NmorphCard.vue2.js +19 -16
  2. package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue2.js +67 -65
  3. package/dist/components/form/nmorph-checkbox/NmorphCheckbox.css +1 -1
  4. package/dist/components/form/nmorph-checkbox/NmorphCheckbox.vue2.js +28 -26
  5. package/dist/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue2.js +25 -20
  6. package/dist/components/form/nmorph-color-picker/NmorphColorPicker.vue2.js +43 -42
  7. package/dist/components/form/nmorph-date-picker/NmorphDatePicker.vue2.js +52 -40
  8. package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue.js +20 -16
  9. package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue2.js +113 -86
  10. package/dist/components/form/nmorph-form/NmorphForm.vue2.js +9 -9
  11. package/dist/components/form/nmorph-form/components/nmorph-form-item/NmorphFormItem.vue2.js +33 -24
  12. package/dist/components/form/nmorph-form/use-form-item-input.js +29 -8
  13. package/dist/components/form/nmorph-number-input/NmorphNumberInput.vue2.js +41 -35
  14. package/dist/components/form/nmorph-otp-input/NmorphOTPInput.vue2.js +65 -61
  15. package/dist/components/form/nmorph-radio/NmorphRadio.css +1 -1
  16. package/dist/components/form/nmorph-radio-group/NmorphRadioGroup.vue2.js +24 -22
  17. package/dist/components/form/nmorph-select/NmorphSelect.css +1 -1
  18. package/dist/components/form/nmorph-select/NmorphSelect.vue2.js +91 -81
  19. package/dist/components/form/nmorph-select-button/NmorphSelectButton.vue2.js +28 -26
  20. package/dist/components/form/nmorph-slider/NmorphSlider.vue2.js +49 -48
  21. package/dist/components/form/nmorph-switch/NmorphSwitch.vue2.js +37 -36
  22. package/dist/components/form/nmorph-text-input/NmorphTextInput.css +1 -1
  23. package/dist/components/form/nmorph-text-input/NmorphTextInput.vue.js +1 -1
  24. package/dist/components/form/nmorph-text-input/NmorphTextInput.vue2.js +34 -30
  25. package/dist/components/form/nmorph-textarea/NmorphTextarea.vue.js +1 -1
  26. package/dist/components/form/nmorph-textarea/NmorphTextarea.vue2.js +29 -25
  27. package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue.js +1 -1
  28. package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue2.js +69 -68
  29. package/dist/hooks/use-field-validation.js +71 -42
  30. package/dist/hooks/use-form-validation.js +62 -24
  31. package/dist/index.umd.js +26 -26
  32. package/dist/package.json.js +1 -1
  33. package/dist/src/components/basic/nmorph-button/NmorphButton.vue.d.ts +1 -1
  34. package/dist/src/components/basic/nmorph-link/NmorphLink.vue.d.ts +1 -1
  35. package/dist/src/components/data/nmorph-avatar/NmorphAvatar.vue.d.ts +1 -1
  36. package/dist/src/components/data/nmorph-badge/NmorphBadge.vue.d.ts +1 -1
  37. package/dist/src/components/data/nmorph-empty/NmorphEmpty.vue.d.ts +1 -1
  38. package/dist/src/components/data/nmorph-progress/NmorphProgress.vue.d.ts +1 -1
  39. package/dist/src/components/data/nmorph-table/NmorphTable.vue.d.ts +1 -1
  40. package/dist/src/components/feedback/nmorph-callout/NmorphCallout.vue.d.ts +1 -1
  41. package/dist/src/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue.d.ts +2 -2
  42. package/dist/src/components/form/nmorph-date-picker/NmorphDatePicker.vue.d.ts +2 -2
  43. package/dist/src/components/form/nmorph-file-upload/NmorphFileUpload.vue.d.ts +6 -3
  44. package/dist/src/components/form/nmorph-file-upload/types.d.ts +4 -0
  45. package/dist/src/components/form/nmorph-form/types.d.ts +15 -5
  46. package/dist/src/components/form/nmorph-form/use-form-item-input.d.ts +10 -0
  47. package/dist/src/components/form/nmorph-radio-group/NmorphRadioGroup.vue.d.ts +2 -2
  48. package/dist/src/hooks/use-field-validation.d.ts +15 -0
  49. package/dist/src/hooks/use-form-validation.d.ts +5 -0
  50. package/dist/style.css +1 -1
  51. package/dist/utils/common.js +6 -7
  52. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
1
  import './NmorphSlider.css';
2
- import { defineComponent as k, computed as m, ref as o, watch as E, onMounted as A, onUnmounted as G } from "vue";
3
- import { useModifiers as J } from "../../../utils/create-modifiers.js";
4
- import { toCssSize as I } from "../../../utils/common.js";
5
- import { useFormItemInput as K } from "../nmorph-form/use-form-item-input.js";
6
- import Q from "../../feedback/nmorph-tooltip/NmorphTooltip.vue.js";
7
- const se = /* @__PURE__ */ k({
2
+ import { defineComponent as G, computed as m, ref as o, watch as E, onMounted as J, onUnmounted as K } from "vue";
3
+ import { useModifiers as Q } from "../../../utils/create-modifiers.js";
4
+ import { toCssSize as H } from "../../../utils/common.js";
5
+ import { useFormItemInput as Y, useFormItemModel as Z } from "../nmorph-form/use-form-item-input.js";
6
+ import ee from "../../feedback/nmorph-tooltip/NmorphTooltip.vue.js";
7
+ const de = /* @__PURE__ */ G({
8
8
  __name: "NmorphSlider",
9
9
  props: {
10
10
  modelValue: { type: Number, required: !1, default: 0 },
@@ -23,41 +23,42 @@ const se = /* @__PURE__ */ k({
23
23
  tabindex: { type: Number, required: !1 }
24
24
  },
25
25
  emits: ["update:model-value"],
26
- setup(H, { expose: L, emit: M }) {
27
- L();
28
- const e = H, { id: N, name: T, tabindex: S } = K(e), _ = m(
29
- () => J({
26
+ setup(L, { expose: N, emit: T }) {
27
+ N();
28
+ const e = L, { id: S, name: _, tabindex: C } = Y(e), F = m(
29
+ () => Q({
30
30
  nmorph: [],
31
31
  "nmorph-slider": [e.disabled && "disabled"]
32
32
  })
33
- ), w = m(() => `${e.thumbWidth}px`), p = o(e.showTooltip), g = M, n = o(e.modelValue), c = o(null);
33
+ ), g = m(() => `${e.thumbWidth}px`), p = o(e.showTooltip), x = T, { modelValue: c, updateModelValue: y } = Z(
34
+ e,
35
+ (t) => x("update:model-value", t),
36
+ 0
37
+ ), n = o(c.value), f = o(null);
34
38
  E(n, () => {
35
- g("update:model-value", n.value);
36
- }), E(
37
- () => e.modelValue,
38
- (t) => {
39
- n.value = t;
40
- }
41
- );
42
- const x = o(null), C = m(() => {
43
- const t = l.value - l.value, r = e.max - e.min + t, u = (n.value - e.min) / r * 100, a = c.value?.clientWidth || 0, d = e.thumbWidth / a * 100, D = d / 2;
44
- let X = u - D;
45
- const P = `${Math.max(0, Math.min(100 - d, X))}%`, W = a / 100, $ = e.thumbWidth / 2 / W, q = (x.value?.tooltipBody.clientWidth ?? 24) / 2 / W, j = q === 1 / 0 ? 1.714 : q, U = `${parseFloat(P) + $ - j}%`;
39
+ y(n.value);
40
+ }), E(c, (t) => {
41
+ n.value = t;
42
+ });
43
+ const P = o(null), z = m(() => {
44
+ const t = l.value - l.value, r = e.max - e.min + t, u = (n.value - e.min) / r * 100, a = f.value?.clientWidth || 0, d = e.thumbWidth / a * 100, $ = d / 2;
45
+ let j = u - $;
46
+ const q = `${Math.max(0, Math.min(100 - d, j))}%`, I = a / 100, U = e.thumbWidth / 2 / I, M = (P.value?.tooltipBody.clientWidth ?? 24) / 2 / I, k = M === 1 / 0 ? 1.714 : M, A = `${parseFloat(q) + U - k}%`;
46
47
  return {
47
- thumb: P,
48
- tooltip: U
48
+ thumb: q,
49
+ tooltip: A
49
50
  };
50
- }), l = o(0), f = o(0), h = () => {
51
- l.value = window.innerWidth, f.value = window.innerHeight;
51
+ }), l = o(0), h = o(0), v = () => {
52
+ l.value = window.innerWidth, h.value = window.innerHeight;
52
53
  };
53
- A(() => {
54
- typeof window < "u" && (l.value = window.innerWidth, f.value = window.innerHeight, window.addEventListener("resize", h));
55
- }), G(() => {
56
- typeof window < "u" && (document.removeEventListener("pointermove", s), document.removeEventListener("pointerup", i), document.removeEventListener("pointercancel", i), window.removeEventListener("resize", h));
54
+ J(() => {
55
+ typeof window < "u" && (l.value = window.innerWidth, h.value = window.innerHeight, window.addEventListener("resize", v));
56
+ }), K(() => {
57
+ typeof window < "u" && (document.removeEventListener("pointermove", s), document.removeEventListener("pointerup", i), document.removeEventListener("pointercancel", i), window.removeEventListener("resize", v));
57
58
  });
58
- const v = (t) => {
59
- b.value = !1;
60
- const r = c.value?.getBoundingClientRect();
59
+ const b = (t) => {
60
+ w.value = !1;
61
+ const r = f.value?.getBoundingClientRect();
61
62
  let u = 0;
62
63
  if (r) {
63
64
  const a = t - r.left, d = r.width;
@@ -65,30 +66,30 @@ const se = /* @__PURE__ */ k({
65
66
  }
66
67
  n.value = Math.round(n.value / e.step) * e.step, n.value = Math.max(e.min, Math.min(e.max, n.value));
67
68
  }, s = (t) => {
68
- t.preventDefault(), v(t.clientX);
69
+ t.preventDefault(), b(t.clientX);
69
70
  }, i = () => {
70
- document.removeEventListener("pointermove", s), document.removeEventListener("pointerup", i), document.removeEventListener("pointercancel", i), b.value = !0;
71
- }, z = (t) => {
72
- e.disabled || t.pointerType === "mouse" && t.button !== 0 || (t.preventDefault(), v(t.clientX), document.addEventListener("pointermove", s), document.addEventListener("pointerup", i), document.addEventListener("pointercancel", i));
73
- }, F = o(null), O = () => {
71
+ document.removeEventListener("pointermove", s), document.removeEventListener("pointerup", i), document.removeEventListener("pointercancel", i), w.value = !0;
72
+ }, O = (t) => {
73
+ e.disabled || t.pointerType === "mouse" && t.button !== 0 || (t.preventDefault(), b(t.clientX), document.addEventListener("pointermove", s), document.addEventListener("pointerup", i), document.addEventListener("pointercancel", i));
74
+ }, V = o(null), B = () => {
74
75
  e.showTooltip && (p.value = !0);
75
- }, V = () => {
76
+ }, R = () => {
76
77
  e.showTooltip && (p.value = !1);
77
- }, B = (t) => {
78
+ }, D = (t) => {
78
79
  const r = t.target;
79
80
  n.value = Number(r.value);
80
- }, b = o(!0), R = m(() => ({
81
- "--nmorph-slider-thumb-width": w.value,
82
- ...e.sliderHeight !== void 0 && { "--slider-height": I(e.sliderHeight) },
81
+ }, w = o(!0), X = m(() => ({
82
+ "--nmorph-slider-thumb-width": g.value,
83
+ ...e.sliderHeight !== void 0 && { "--slider-height": H(e.sliderHeight) },
83
84
  ...e.valueFixedContainerHeight !== void 0 && {
84
- "--value-fixed-container-height": I(e.valueFixedContainerHeight)
85
+ "--value-fixed-container-height": H(e.valueFixedContainerHeight)
85
86
  }
86
- })), y = { props: e, id: N, name: T, tabindex: S, modifiers: _, thumbWidthCss: w, tooltipVisible: p, emit: g, thumbValue: n, sliderContainer: c, tooltipRootRef: x, thumbXPercentPosition: C, windowWidth: l, windowHeight: f, resizeWindowHandler: h, updateThumbValue: v, pointerMove: s, pointerUp: i, pointerDownHandler: z, sliderFirst: F, handleMouseEnter: O, handleMouseLeave: V, nativeInputHandler: B, transitionEnabled: b, styles: R, get NmorphTooltip() {
87
- return Q;
87
+ })), W = { props: e, id: S, name: _, tabindex: C, modifiers: F, thumbWidthCss: g, tooltipVisible: p, emit: x, modelValue: c, updateModelValue: y, thumbValue: n, sliderContainer: f, tooltipRootRef: P, thumbXPercentPosition: z, windowWidth: l, windowHeight: h, resizeWindowHandler: v, updateThumbValue: b, pointerMove: s, pointerUp: i, pointerDownHandler: O, sliderFirst: V, handleMouseEnter: B, handleMouseLeave: R, nativeInputHandler: D, transitionEnabled: w, styles: X, get NmorphTooltip() {
88
+ return ee;
88
89
  } };
89
- return Object.defineProperty(y, "__isScriptSetup", { enumerable: !1, value: !0 }), y;
90
+ return Object.defineProperty(W, "__isScriptSetup", { enumerable: !1, value: !0 }), W;
90
91
  }
91
92
  });
92
93
  export {
93
- se as default
94
+ de as default
94
95
  };
@@ -1,11 +1,11 @@
1
1
  import './NmorphSwitch.css';
2
- import { defineComponent as q, ref as i, computed as n, watch as N } from "vue";
3
- import { useModifiers as V } from "../../../utils/create-modifiers.js";
4
- import { toCssSize as a } from "../../../utils/common.js";
5
- import { useFormItemInput as _ } from "../nmorph-form/use-form-item-input.js";
6
- import w from "../../basic/nmorph-icon/NmorphIcon.vue.js";
7
- import H from "../../../assets/icons/loader.svg.js";
8
- const M = /* @__PURE__ */ q({
2
+ import { defineComponent as V, ref as u, computed as f, watch as _ } from "vue";
3
+ import { useModifiers as w } from "../../../utils/create-modifiers.js";
4
+ import { toCssSize as o } from "../../../utils/common.js";
5
+ import { useFormItemInput as I, useFormItemModel as H } from "../nmorph-form/use-form-item-input.js";
6
+ import B from "../../basic/nmorph-icon/NmorphIcon.vue.js";
7
+ import x from "../../../assets/icons/loader.svg.js";
8
+ const j = /* @__PURE__ */ V({
9
9
  __name: "NmorphSwitch",
10
10
  props: {
11
11
  modelValue: { type: [Boolean, String, Number], required: !1, default: !1 },
@@ -23,47 +23,48 @@ const M = /* @__PURE__ */ q({
23
23
  tabindex: { type: Number, required: !1 }
24
24
  },
25
25
  emits: ["update:model-value"],
26
- setup(s, { expose: f, emit: m }) {
27
- const e = s, { id: p, name: c, tabindex: h } = _(e), u = m, r = i(!1), v = () => {
28
- r.value = !0;
29
- }, g = () => {
30
- r.value = !1;
31
- }, b = n(
32
- () => V({
26
+ setup(m, { expose: p, emit: c }) {
27
+ const e = m, { id: h, name: v, tabindex: g } = I(e), l = c, { modelValue: i, updateModelValue: d } = H(
28
+ e,
29
+ (r) => l("update:model-value", r),
30
+ !1
31
+ ), a = u(!1), b = () => {
32
+ a.value = !0;
33
+ }, y = () => {
34
+ a.value = !1;
35
+ }, S = f(
36
+ () => w({
33
37
  "nmorph-switch": [
34
38
  e.disabled && "disabled",
35
39
  t.value ? "on" : "off",
36
40
  e.loading && "loading",
37
- r.value && "focus"
41
+ a.value && "focus"
38
42
  ]
39
43
  })
40
- ), t = i(e.modelValue === e.activeValue), y = () => {
44
+ ), t = u(i.value === e.activeValue), q = () => {
41
45
  if (e.disabled) return;
42
46
  t.value = !t.value;
43
- const o = t.value ? e.activeValue : e.inactiveValue;
44
- u("update:model-value", o);
45
- }, l = i(null);
46
- f({ inputDOMRef: l });
47
- const S = n(() => ({
48
- ...e.width !== void 0 && { "--width": a(e.width) },
49
- ...e.height !== void 0 && { "--height": a(e.height) },
50
- ...e.offset !== void 0 && { "--offset": a(e.offset) },
51
- ...e.thumbHeight !== void 0 && { "--thumb-height": a(e.thumbHeight) }
47
+ const r = t.value ? e.activeValue : e.inactiveValue;
48
+ d(r);
49
+ }, s = u(null);
50
+ p({ inputDOMRef: s });
51
+ const N = f(() => ({
52
+ ...e.width !== void 0 && { "--width": o(e.width) },
53
+ ...e.height !== void 0 && { "--height": o(e.height) },
54
+ ...e.offset !== void 0 && { "--offset": o(e.offset) },
55
+ ...e.thumbHeight !== void 0 && { "--thumb-height": o(e.thumbHeight) }
52
56
  }));
53
- N(
54
- () => e.modelValue,
55
- (o) => {
56
- t.value = o === e.activeValue;
57
- }
58
- );
59
- const d = { props: e, id: p, name: c, tabindex: h, emit: u, focus: r, focusHandler: v, blurHandler: g, modifiers: b, initialValue: t, changeHandler: y, inputDOMRef: l, styles: S, get NmorphIcon() {
60
- return w;
57
+ _(i, (r) => {
58
+ t.value = r === e.activeValue;
59
+ });
60
+ const n = { props: e, id: h, name: v, tabindex: g, emit: l, modelValue: i, updateModelValue: d, focus: a, focusHandler: b, blurHandler: y, modifiers: S, initialValue: t, changeHandler: q, inputDOMRef: s, styles: N, get NmorphIcon() {
61
+ return B;
61
62
  }, get NmorphIconLoaderDots() {
62
- return H;
63
+ return x;
63
64
  } };
64
- return Object.defineProperty(d, "__isScriptSetup", { enumerable: !1, value: !0 }), d;
65
+ return Object.defineProperty(n, "__isScriptSetup", { enumerable: !1, value: !0 }), n;
65
66
  }
66
67
  });
67
68
  export {
68
- M as default
69
+ j as default
69
70
  };
@@ -1 +1 @@
1
- .nmorph-text-input{--prepend-icon-indent: 8px;--prepend-icon-size: 14px;display:flex;flex:1 1 auto;flex-direction:column;align-items:flex-start;min-width:0}.nmorph-text-input__input-side{position:relative;display:flex;justify-content:flex-end;align-items:center;width:100%}.nmorph-text-input__prepend-icon{position:absolute;left:0;z-index:1;display:flex;justify-content:center;align-items:center;width:var(--prepend-icon-size);min-width:var(--prepend-icon-size);height:var(--prepend-icon-size);min-height:var(--prepend-icon-size);margin-left:var(--prepend-icon-indent);pointer-events:none}.nmorph-text-input__prepend-icon svg,.nmorph-text-input__prepend-icon .nmorph-icon,.nmorph-text-input__prepend-icon .nmorph-icon__content{width:100%;min-width:100%;height:100%;min-height:100%}.nmorph-text-input__prepend-icon svg{fill:var(--nmorph-text-color);stroke-width:0}.nmorph-text-input__prepend-icon path{stroke:var(--nmorph-text-color)}.nmorph-text-input input{width:100%;height:var(--height);text-indent:var(--nmorph-text-input-indentation);border:none;border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-inset)}.nmorph-text-input--with-action input{padding-right:calc(var(--height) + var(--indentation-03))}.nmorph-text-input input:focus{background:var(--nmorph-accent-color);outline:none;box-shadow:var(--nmorph-shadow-outset)}.nmorph-text-input.nmorph--focused .nmorph-text-input__prepend-icon svg{fill:var(--nmorph-focus-text-color)}.nmorph-text-input.nmorph--focused .nmorph-text-input__prepend-icon path{stroke:var(--nmorph-focus-text-color)}.nmorph-text-input input:-webkit-autofill,.nmorph-text-input input:-webkit-autofill:hover,.nmorph-text-input input:-webkit-autofill:active{caret-color:var(--nmorph-text-color);box-shadow:var(--nmorph-shadow-inset),inset 0 0 0 1000px var(--nmorph-main-color);-webkit-text-fill-color:var(--nmorph-text-color)}.nmorph-text-input input:-webkit-autofill:focus{caret-color:var(--nmorph-focus-text-color);outline:none;box-shadow:var(--nmorph-shadow-outset),inset 0 0 0 1000px var(--nmorph-accent-color);-webkit-text-fill-color:var(--nmorph-focus-text-color)}.nmorph-text-input input:disabled{cursor:not-allowed;opacity:.6}.nmorph-text-input__password-btn{position:absolute;right:0;height:100%}.nmorph-text-input__password-btn .nmorph-button__content{padding:var(--indentation-03)}.nmorph-text-input.nmorph-button.nmorph--thin-component .nmorph-text-input__password-btn{margin-top:var(--indentation-00)}.nmorph-text-input.nmorph-button.nmorph--thin-component .nmorph-text-input__password-btn .nmorph-button{--height: var(--thin-component)}.nmorph-text-input.nmorph-button.nmorph--focused .nmorph-text-input__password-btn .nmorph-icon{--color: var(--nmorph-white-color)}.nmorph-text-input.nmorph-button.nmorph--focused .nmorph-text-input__password-btn .nmorph-button:not(:disabled,[loading=true]):hover .nmorph-icon{--color: var(--nmorph-white-color)}
1
+ .nmorph-text-input{--prepend-icon-indent: 8px;--prepend-icon-size: 14px;display:flex;flex:1 1 auto;flex-direction:column;align-items:flex-start;min-width:0}.nmorph-text-input__input-side{position:relative;display:flex;justify-content:flex-end;align-items:center;width:100%}.nmorph-text-input__prepend-icon{position:absolute;left:0;z-index:1;display:flex;justify-content:center;align-items:center;width:var(--prepend-icon-size);min-width:var(--prepend-icon-size);height:var(--prepend-icon-size);min-height:var(--prepend-icon-size);margin-left:var(--prepend-icon-indent);pointer-events:none}.nmorph-text-input__prepend-icon svg,.nmorph-text-input__prepend-icon .nmorph-icon,.nmorph-text-input__prepend-icon .nmorph-icon__content{width:100%;min-width:100%;height:100%;min-height:100%}.nmorph-text-input__prepend-icon svg{fill:var(--nmorph-text-color);stroke-width:0}.nmorph-text-input__prepend-icon path{stroke:var(--nmorph-text-color)}.nmorph-text-input input{width:100%;height:var(--height);text-indent:var(--nmorph-text-input-indentation);background:var(--nmorph-main-color);border:none;border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-inset)}.nmorph-text-input--with-action input{padding-right:calc(var(--height) + var(--indentation-03))}.nmorph-text-input input:focus{background:var(--nmorph-accent-color);outline:none;box-shadow:var(--nmorph-shadow-outset)}.nmorph-text-input.nmorph--focused .nmorph-text-input__prepend-icon svg{fill:var(--nmorph-focus-text-color)}.nmorph-text-input.nmorph--focused .nmorph-text-input__prepend-icon path{stroke:var(--nmorph-focus-text-color)}.nmorph-text-input input:-webkit-autofill,.nmorph-text-input input:-webkit-autofill:hover,.nmorph-text-input input:-webkit-autofill:active{caret-color:var(--nmorph-text-color);box-shadow:var(--nmorph-shadow-inset),inset 0 0 0 1000px var(--nmorph-main-color);-webkit-text-fill-color:var(--nmorph-text-color)}.nmorph-text-input input:-webkit-autofill:focus{caret-color:var(--nmorph-focus-text-color);outline:none;box-shadow:var(--nmorph-shadow-outset),inset 0 0 0 1000px var(--nmorph-accent-color);-webkit-text-fill-color:var(--nmorph-focus-text-color)}.nmorph-text-input input:disabled{cursor:not-allowed;opacity:.6}.nmorph-text-input__password-btn{position:absolute;right:0;height:100%}.nmorph-text-input__password-btn .nmorph-button__content{padding:var(--indentation-03)}.nmorph-text-input.nmorph-button.nmorph--thin-component .nmorph-text-input__password-btn{margin-top:var(--indentation-00)}.nmorph-text-input.nmorph-button.nmorph--thin-component .nmorph-text-input__password-btn .nmorph-button{--height: var(--thin-component)}.nmorph-text-input.nmorph-button.nmorph--focused .nmorph-text-input__password-btn .nmorph-icon{--color: var(--nmorph-white-color)}.nmorph-text-input.nmorph-button.nmorph--focused .nmorph-text-input__password-btn .nmorph-button:not(:disabled,[loading=true]):hover .nmorph-icon{--color: var(--nmorph-white-color)}
@@ -29,7 +29,7 @@ function B(p, o, N, e, C, I) {
29
29
  type: e.type,
30
30
  placeholder: e.props.placeholder,
31
31
  disabled: e.props.disabled,
32
- value: e.props.modelValue
32
+ value: e.modelValue
33
33
  }, e.props.inputAttrs, {
34
34
  onInput: e.handleInput,
35
35
  onFocus: e.handleFocus,
@@ -1,14 +1,14 @@
1
1
  import './NmorphTextInput.css';
2
- import { defineComponent as C, useSlots as E, computed as n, ref as l } from "vue";
2
+ import { defineComponent as E, useSlots as F, computed as r, ref as u } from "vue";
3
3
  import { NmorphComponentHeight as O } from "../../../types/index.js";
4
- import { useModifiers as j } from "../../../utils/create-modifiers.js";
5
- import { useFormItemInput as F } from "../nmorph-form/use-form-item-input.js";
6
- import H from "../../../assets/icons/eye-blocked.svg.js";
7
- import M from "../../../assets/icons/eye.svg.js";
8
- import A from "../../basic/nmorph-button/NmorphButton.vue.js";
9
- import D from "../../basic/nmorph-icon/NmorphIcon.vue.js";
10
- import R from "../../../assets/icons/error.svg.js";
11
- const W = /* @__PURE__ */ C({
4
+ import { useModifiers as V } from "../../../utils/create-modifiers.js";
5
+ import { useFormItemInput as j, useFormItemModel as H } from "../nmorph-form/use-form-item-input.js";
6
+ import A from "../../../assets/icons/eye-blocked.svg.js";
7
+ import D from "../../../assets/icons/eye.svg.js";
8
+ import R from "../../basic/nmorph-button/NmorphButton.vue.js";
9
+ import T from "../../basic/nmorph-icon/NmorphIcon.vue.js";
10
+ import z from "../../../assets/icons/error.svg.js";
11
+ const Z = /* @__PURE__ */ E({
12
12
  __name: "NmorphTextInput",
13
13
  props: {
14
14
  placeholder: { type: String, required: !1, default: "" },
@@ -25,37 +25,41 @@ const W = /* @__PURE__ */ C({
25
25
  tabindex: { type: Number, required: !1 }
26
26
  },
27
27
  emits: ["update:model-value", "focus", "blur", "on-enter", "keydown"],
28
- setup(f, { expose: m, emit: h }) {
29
- const s = E(), e = f, { id: y, name: b, autocomplete: v, tabindex: g } = F(e), q = n(
30
- () => j({
28
+ setup(h, { expose: y, emit: b }) {
29
+ const p = F(), e = h, n = b, { id: v, name: g, autocomplete: q, tabindex: I } = j(e), { modelValue: w, updateModelValue: l } = H(
30
+ e,
31
+ (s) => n("update:model-value", s),
32
+ ""
33
+ ), x = r(
34
+ () => V({
31
35
  nmorph: [O[e.height], a.value && "focused"],
32
36
  "nmorph-text-input": [e.typePassword && "password", (e.typePassword || e.clearable) && "with-action"]
33
37
  })
34
- ), w = (P) => {
35
- const k = P.target;
36
- r("update:model-value", k.value);
37
- }, t = l(!1), x = () => {
38
- e.clearable ? r("update:model-value", "") : t.value = !t.value;
39
- }, I = n(() => e.typePassword && !t.value && !e.clearable ? "password" : "text"), a = l(!1), N = () => {
40
- r("focus"), a.value = !0;
41
- }, _ = () => {
42
- r("blur"), a.value = !1;
43
- }, o = l(null), u = () => {
38
+ ), N = (s) => {
39
+ const C = s.target;
40
+ l(C.value);
41
+ }, t = u(!1), _ = () => {
42
+ e.clearable ? l("") : t.value = !t.value;
43
+ }, S = r(() => e.typePassword && !t.value && !e.clearable ? "password" : "text"), a = u(!1), B = () => {
44
+ n("focus"), a.value = !0;
45
+ }, P = () => {
46
+ n("blur"), a.value = !1;
47
+ }, o = u(null), i = () => {
44
48
  o.value?.focus();
45
- }, p = () => {
49
+ }, d = () => {
46
50
  o.value?.blur();
47
- }, i = () => {
51
+ }, c = () => {
48
52
  o.value?.select();
49
53
  };
50
- m({ inputDOMRef: o, focus: u, blur: p, select: i });
51
- const r = h, S = n(() => e.clearable ? R : t.value ? H : M), d = n(() => e.indentation || (s["prepend-icon"] ? "28px" : "8px")), B = n(() => ({ "--nmorph-text-input-indentation": d.value })), c = { slots: s, props: e, id: y, name: b, autocomplete: v, tabindex: g, modifiers: q, handleInput: w, showPassword: t, actionButtonClickHandler: x, type: I, focused: a, handleFocus: N, handleBlur: _, inputDOMRef: o, focus: u, blur: p, select: i, emit: r, actionIcon: S, indentation: d, styles: B, get NmorphIcon() {
52
- return D;
54
+ y({ inputDOMRef: o, focus: i, blur: d, select: c });
55
+ const M = r(() => e.clearable ? z : t.value ? A : D), m = r(() => e.indentation || (p["prepend-icon"] ? "28px" : "8px")), k = r(() => ({ "--nmorph-text-input-indentation": m.value })), f = { slots: p, props: e, emit: n, id: v, name: g, autocomplete: q, tabindex: I, modelValue: w, updateModelValue: l, modifiers: x, handleInput: N, showPassword: t, actionButtonClickHandler: _, type: S, focused: a, handleFocus: B, handleBlur: P, inputDOMRef: o, focus: i, blur: d, select: c, actionIcon: M, indentation: m, styles: k, get NmorphIcon() {
56
+ return T;
53
57
  }, get NmorphButton() {
54
- return A;
58
+ return R;
55
59
  } };
56
- return Object.defineProperty(c, "__isScriptSetup", { enumerable: !1, value: !0 }), c;
60
+ return Object.defineProperty(f, "__isScriptSetup", { enumerable: !1, value: !0 }), f;
57
61
  }
58
62
  });
59
63
  export {
60
- W as default
64
+ Z as default
61
65
  };
@@ -21,7 +21,7 @@ function f(x, o, h, e, b, y) {
21
21
  class: "nmorph-native-input",
22
22
  placeholder: e.props.placeholder,
23
23
  disabled: e.props.disabled,
24
- value: e.props.modelValue,
24
+ value: e.modelValue,
25
25
  rows: e.rows
26
26
  }, e.props.textareaAttrs, {
27
27
  onInput: e.handleInput,
@@ -1,9 +1,9 @@
1
1
  import './NmorphTextarea.css';
2
- import { defineComponent as F, ref as h, computed as l, watch as B, onMounted as I, nextTick as T } from "vue";
3
- import { NmorphComponentHeight as O } from "../../../types/index.js";
4
- import { useModifiers as V } from "../../../utils/create-modifiers.js";
5
- import { useFormItemInput as j } from "../nmorph-form/use-form-item-input.js";
6
- const Y = /* @__PURE__ */ F({
2
+ import { defineComponent as B, ref as g, computed as l, watch as T, onMounted as V, nextTick as O } from "vue";
3
+ import { NmorphComponentHeight as j } from "../../../types/index.js";
4
+ import { useModifiers as k } from "../../../utils/create-modifiers.js";
5
+ import { useFormItemInput as P, useFormItemModel as A } from "../nmorph-form/use-form-item-input.js";
6
+ const G = /* @__PURE__ */ B({
7
7
  __name: "NmorphTextarea",
8
8
  props: {
9
9
  placeholder: { type: String, required: !1, default: "" },
@@ -23,45 +23,49 @@ const Y = /* @__PURE__ */ F({
23
23
  tabindex: { type: Number, required: !1 }
24
24
  },
25
25
  emits: ["update:model-value", "focus", "blur", "on-enter", "keydown"],
26
- setup(y, { expose: g, emit: x }) {
27
- const e = y, n = x, { id: b, name: w, autocomplete: q, tabindex: v } = j(e), a = h(null), s = h(!1), S = l(
28
- () => V({
29
- nmorph: [O[e.height], s.value && "focused"],
26
+ setup(x, { expose: b, emit: w }) {
27
+ const e = x, n = w, { id: q, name: v, autocomplete: S, tabindex: _ } = P(e), { modelValue: i, updateModelValue: u } = A(
28
+ e,
29
+ (t) => n("update:model-value", t),
30
+ ""
31
+ ), a = g(null), s = g(!1), z = l(
32
+ () => k({
33
+ nmorph: [j[e.height], s.value && "focused"],
30
34
  "nmorph-textarea": [e.disabled && "disabled", e.autoSize && "auto-size"]
31
35
  })
32
- ), i = (t) => {
36
+ ), d = (t) => {
33
37
  const o = window.getComputedStyle(t);
34
38
  return parseFloat(o.paddingTop) + parseFloat(o.paddingBottom);
35
39
  }, r = async () => {
36
40
  if (!e.autoSize) return;
37
- await T();
41
+ await O();
38
42
  const t = a.value;
39
43
  if (!t) return;
40
44
  t.style.height = "auto";
41
- const o = window.getComputedStyle(t), N = parseFloat(o.lineHeight) || 20, c = e.maxRows ? e.maxRows * N + i(t) : 1 / 0, C = Math.min(t.scrollHeight, c);
42
- t.style.height = `${C}px`, t.style.overflowY = t.scrollHeight > c ? "auto" : "hidden";
43
- }, _ = (t) => {
45
+ const o = window.getComputedStyle(t), C = parseFloat(o.lineHeight) || 20, y = e.maxRows ? e.maxRows * C + d(t) : 1 / 0, I = Math.min(t.scrollHeight, y);
46
+ t.style.height = `${I}px`, t.style.overflowY = t.scrollHeight > y ? "auto" : "hidden";
47
+ }, M = (t) => {
44
48
  const o = t.target;
45
- n("update:model-value", o.value), r();
46
- }, z = () => {
47
- n("focus"), s.value = !0;
49
+ u(o.value), r();
48
50
  }, H = () => {
51
+ n("focus"), s.value = !0;
52
+ }, R = () => {
49
53
  n("blur"), s.value = !1;
50
- }, u = () => {
54
+ }, p = () => {
51
55
  a.value?.focus();
52
- }, d = () => {
56
+ }, m = () => {
53
57
  a.value?.blur();
54
- }, p = () => {
58
+ }, f = () => {
55
59
  a.value?.select();
56
60
  };
57
- B(() => e.modelValue, r), I(r), g({ textareaDOMRef: a, focus: u, blur: d, select: p, resizeToContent: r });
58
- const f = l(() => Math.max(e.minRows, 1)), R = l(() => Math.max(e.rows, f.value)), M = l(() => ({
61
+ T(i, r), V(r), b({ textareaDOMRef: a, focus: p, blur: m, select: f, resizeToContent: r });
62
+ const c = l(() => Math.max(e.minRows, 1)), F = l(() => Math.max(e.rows, c.value)), N = l(() => ({
59
63
  "--nmorph-textarea-resize": e.autoSize ? "none" : e.resize,
60
64
  "--nmorph-textarea-indentation": e.indentation
61
- })), m = { props: e, emit: n, id: b, name: w, autocomplete: q, tabindex: v, textareaDOMRef: a, focused: s, modifiers: S, getVerticalPadding: i, resizeToContent: r, handleInput: _, handleFocus: z, handleBlur: H, focus: u, blur: d, select: p, minRows: f, rows: R, styles: M };
62
- return Object.defineProperty(m, "__isScriptSetup", { enumerable: !1, value: !0 }), m;
65
+ })), h = { props: e, emit: n, id: q, name: v, autocomplete: S, tabindex: _, modelValue: i, updateModelValue: u, textareaDOMRef: a, focused: s, modifiers: z, getVerticalPadding: d, resizeToContent: r, handleInput: M, handleFocus: H, handleBlur: R, focus: p, blur: m, select: f, minRows: c, rows: F, styles: N };
66
+ return Object.defineProperty(h, "__isScriptSetup", { enumerable: !1, value: !0 }), h;
63
67
  }
64
68
  });
65
69
  export {
66
- Y as default
70
+ G as default
67
71
  };
@@ -47,7 +47,7 @@ function I(S, a, z, e, B, D) {
47
47
  autocomplete: e.autocomplete,
48
48
  type: "time",
49
49
  step: e.inputStep,
50
- value: e.props.modelValue || "",
50
+ value: e.modelValue || "",
51
51
  disabled: e.props.disabled,
52
52
  onInput: e.nativeInputHandler
53
53
  }, null, 40, w),