@nmorph/nmorph-ui-kit 2.2.36 → 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 (114) hide show
  1. package/dist/components/basic/nmorph-button/NmorphButton.vue2.js +8 -8
  2. package/dist/components/basic/nmorph-icon/NmorphIcon.vue2.js +3 -3
  3. package/dist/components/basic/nmorph-layout/NmorphLayout.vue2.js +14 -13
  4. package/dist/components/basic/nmorph-link/NmorphLink.vue2.js +1 -1
  5. package/dist/components/basic/nmorph-scroll/NmorphScroll.css +1 -0
  6. package/dist/components/basic/nmorph-scroll/NmorphScroll.vue.js +6 -4
  7. package/dist/components/basic/nmorph-scroll/NmorphScroll.vue2.js +1 -0
  8. package/dist/components/basic/nmorph-space/NmorphSpace.vue2.js +15 -19
  9. package/dist/components/data/nmorph-avatar/NmorphAvatar.css +1 -1
  10. package/dist/components/data/nmorph-avatar/NmorphAvatar.vue2.js +5 -5
  11. package/dist/components/data/nmorph-badge/NmorphBadge.vue2.js +37 -36
  12. package/dist/components/data/nmorph-calendar/NmorphCalendar.vue2.js +41 -40
  13. package/dist/components/data/nmorph-card/NmorphCard.vue2.js +19 -15
  14. package/dist/components/data/nmorph-collapse/components/nmorph-collapse-item/NmorphCollapseItem.vue2.js +5 -9
  15. package/dist/components/data/nmorph-empty/NmorphEmpty.vue.js +3 -3
  16. package/dist/components/data/nmorph-empty/NmorphEmpty.vue2.js +17 -14
  17. package/dist/components/data/nmorph-image/NmorphImage.css +1 -0
  18. package/dist/components/data/nmorph-image/NmorphImage.vue.js +14 -12
  19. package/dist/components/data/nmorph-image/NmorphImage.vue2.js +3 -2
  20. package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue2.js +36 -35
  21. package/dist/components/data/nmorph-pagination/NmorphPagination.vue2.js +1 -1
  22. package/dist/components/data/nmorph-progress/NmorphProgress.vue2.js +19 -18
  23. package/dist/components/data/nmorph-qr-code/NmorphQRCode.vue2.js +20 -19
  24. package/dist/components/data/nmorph-skeleton/NmorphSkeleton.vue2.js +1 -1
  25. package/dist/components/data/nmorph-table/NmorphTable.vue2.js +39 -43
  26. package/dist/components/data/nmorph-virtual-list/NmorphVirtualList.vue2.js +34 -33
  27. package/dist/components/feedback/nmorph-alert/NmorphAlert.vue2.js +1 -1
  28. package/dist/components/feedback/nmorph-callout/NmorphCallout.vue2.js +7 -6
  29. package/dist/components/feedback/nmorph-dialog/NmorphDialog.css +1 -1
  30. package/dist/components/feedback/nmorph-dialog/NmorphDialog.vue.js +25 -20
  31. package/dist/components/feedback/nmorph-dialog/NmorphDialog.vue2.js +37 -37
  32. package/dist/components/feedback/nmorph-drawer/NmorphDrawer.vue2.js +22 -21
  33. package/dist/components/feedback/nmorph-tooltip/NmorphTooltip.vue2.js +26 -25
  34. package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue2.js +65 -71
  35. package/dist/components/form/nmorph-checkbox/NmorphCheckbox.css +1 -1
  36. package/dist/components/form/nmorph-checkbox/NmorphCheckbox.vue2.js +30 -28
  37. package/dist/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue2.js +25 -20
  38. package/dist/components/form/nmorph-color-picker/NmorphColorPicker.vue2.js +43 -42
  39. package/dist/components/form/nmorph-date-picker/NmorphDatePicker.vue2.js +53 -40
  40. package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue.js +20 -16
  41. package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue2.js +113 -86
  42. package/dist/components/form/nmorph-form/NmorphForm.vue2.js +9 -9
  43. package/dist/components/form/nmorph-form/components/nmorph-form-item/NmorphFormItem.vue2.js +33 -24
  44. package/dist/components/form/nmorph-form/components/nmorph-form-item/inner-components/nmorph-error-box/NmorphErrorBox.vue2.js +1 -1
  45. package/dist/components/form/nmorph-form/use-form-item-input.js +29 -8
  46. package/dist/components/form/nmorph-number-input/NmorphNumberInput.vue2.js +42 -39
  47. package/dist/components/form/nmorph-otp-input/NmorphOTPInput.vue2.js +66 -62
  48. package/dist/components/form/nmorph-radio/NmorphRadio.css +1 -1
  49. package/dist/components/form/nmorph-radio/NmorphRadio.vue2.js +1 -1
  50. package/dist/components/form/nmorph-radio-group/NmorphRadioGroup.vue2.js +24 -22
  51. package/dist/components/form/nmorph-select/NmorphSelect.css +1 -1
  52. package/dist/components/form/nmorph-select/NmorphSelect.vue2.js +83 -81
  53. package/dist/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue2.js +4 -4
  54. package/dist/components/form/nmorph-select-button/NmorphSelectButton.vue2.js +28 -25
  55. package/dist/components/form/nmorph-select-button/components/nmorph-select-button-item/NmorphSelectButtonItem.vue2.js +1 -1
  56. package/dist/components/form/nmorph-slider/NmorphSlider.vue2.js +51 -49
  57. package/dist/components/form/nmorph-switch/NmorphSwitch.vue2.js +35 -33
  58. package/dist/components/form/nmorph-text-input/NmorphTextInput.css +1 -0
  59. package/dist/components/form/nmorph-text-input/NmorphTextInput.vue.js +5 -3
  60. package/dist/components/form/nmorph-text-input/NmorphTextInput.vue2.js +37 -35
  61. package/dist/components/form/nmorph-textarea/NmorphTextarea.vue.js +1 -1
  62. package/dist/components/form/nmorph-textarea/NmorphTextarea.vue2.js +30 -26
  63. package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue.js +1 -1
  64. package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue2.js +68 -66
  65. package/dist/components/navigation/nmorph-backtop/NmorphBacktop.vue2.js +1 -1
  66. package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue2.js +32 -31
  67. package/dist/components/navigation/nmorph-tabs/NmorphTabs.vue2.js +1 -1
  68. package/dist/components/others/nmorph-overlay/NmorphOverlay.vue2.js +1 -1
  69. package/dist/hooks/use-common-styles.js +18 -278
  70. package/dist/hooks/use-field-validation.js +71 -42
  71. package/dist/hooks/use-form-validation.js +62 -24
  72. package/dist/hooks/use-virtual-list.js +38 -32
  73. package/dist/index.umd.js +26 -286
  74. package/dist/package.json.js +1 -1
  75. package/dist/src/components/basic/nmorph-button/NmorphButton.vue.d.ts +2 -2
  76. package/dist/src/components/basic/nmorph-link/NmorphLink.vue.d.ts +1 -1
  77. package/dist/src/components/data/nmorph-avatar/NmorphAvatar.vue.d.ts +1 -1
  78. package/dist/src/components/data/nmorph-badge/NmorphBadge.vue.d.ts +1 -1
  79. package/dist/src/components/data/nmorph-collapse/components/nmorph-collapse-item/NmorphCollapseItem.vue.d.ts +1 -1
  80. package/dist/src/components/data/nmorph-empty/NmorphEmpty.vue.d.ts +1 -1
  81. package/dist/src/components/data/nmorph-pagination/NmorphPagination.vue.d.ts +1 -1
  82. package/dist/src/components/data/nmorph-progress/NmorphProgress.vue.d.ts +1 -1
  83. package/dist/src/components/data/nmorph-table/NmorphTable.vue.d.ts +1 -1
  84. package/dist/src/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.d.ts +1 -1
  85. package/dist/src/components/feedback/nmorph-callout/NmorphCallout.vue.d.ts +1 -1
  86. package/dist/src/components/feedback/nmorph-dialog/NmorphDialog.vue.d.ts +4 -4
  87. package/dist/src/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.d.ts +1 -1
  88. package/dist/src/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue.d.ts +3 -3
  89. package/dist/src/components/form/nmorph-color-picker/NmorphColorPicker.vue.d.ts +1 -1
  90. package/dist/src/components/form/nmorph-date-picker/NmorphDatePicker.vue.d.ts +3 -3
  91. package/dist/src/components/form/nmorph-file-upload/NmorphFileUpload.vue.d.ts +6 -3
  92. package/dist/src/components/form/nmorph-file-upload/types.d.ts +4 -0
  93. package/dist/src/components/form/nmorph-form/components/nmorph-form-item/NmorphFormItem.vue.d.ts +1 -1
  94. package/dist/src/components/form/nmorph-form/components/nmorph-form-item/inner-components/nmorph-error-box/NmorphErrorBox.vue.d.ts +1 -1
  95. package/dist/src/components/form/nmorph-form/types.d.ts +15 -5
  96. package/dist/src/components/form/nmorph-form/use-form-item-input.d.ts +10 -0
  97. package/dist/src/components/form/nmorph-number-input/NmorphNumberInput.vue.d.ts +1 -1
  98. package/dist/src/components/form/nmorph-otp-input/NmorphOTPInput.vue.d.ts +1 -1
  99. package/dist/src/components/form/nmorph-radio-group/NmorphRadioGroup.vue.d.ts +3 -3
  100. package/dist/src/components/form/nmorph-select/NmorphSelect.vue.d.ts +1 -1
  101. package/dist/src/components/form/nmorph-select-button/NmorphSelectButton.vue.d.ts +1 -1
  102. package/dist/src/components/form/nmorph-text-input/NmorphTextInput.vue.d.ts +1 -1
  103. package/dist/src/components/form/nmorph-textarea/NmorphTextarea.vue.d.ts +1 -1
  104. package/dist/src/components/form/nmorph-time-picker/NmorphTimePicker.vue.d.ts +1 -1
  105. package/dist/src/hooks/use-field-validation.d.ts +15 -0
  106. package/dist/src/hooks/use-form-validation.d.ts +5 -0
  107. package/dist/src/hooks/use-virtual-list.d.ts +6 -0
  108. package/dist/src/types/index.d.ts +2 -1
  109. package/dist/src/utils/common.d.ts +5 -0
  110. package/dist/src/utils/create-modifiers.d.ts +4 -2
  111. package/dist/style.css +1 -1
  112. package/dist/utils/common.js +9 -3
  113. package/dist/utils/create-modifiers.js +6 -6
  114. package/package.json +1 -1
@@ -1,8 +1,10 @@
1
1
  import './NmorphSelectButton.css';
2
- import { defineComponent as c, ref as S, watch as g, computed as o, provide as n } from "vue";
3
- import { useModifiers as y } from "../../../utils/create-modifiers.js";
4
- import b from "./components/nmorph-select-button-item/NmorphSelectButtonItem.vue.js";
5
- const _ = /* @__PURE__ */ c({
2
+ import { defineComponent as g, ref as y, watch as b, computed as u, provide as n } from "vue";
3
+ import { useModifiers as v } from "../../../utils/create-modifiers.js";
4
+ import { toCssSize as s } from "../../../utils/common.js";
5
+ import { useFormItemModel as h } from "../nmorph-form/use-form-item-input.js";
6
+ import q from "./components/nmorph-select-button-item/NmorphSelectButtonItem.vue.js";
7
+ const F = /* @__PURE__ */ g({
6
8
  __name: "NmorphSelectButton",
7
9
  props: {
8
10
  modelValue: { type: String, required: !1, default: "" },
@@ -19,33 +21,34 @@ const _ = /* @__PURE__ */ c({
19
21
  tabindex: { type: Number, required: !1 }
20
22
  },
21
23
  emits: ["update:model-value"],
22
- setup(u, { expose: s, emit: m }) {
23
- s();
24
- const e = u, l = m, i = S(e.modelValue);
25
- g(
26
- () => e.modelValue,
27
- (t) => {
28
- i.value = t;
29
- }
30
- );
31
- const f = o(
32
- () => y({
33
- "nmorph-select-button": [`${e.disabled && "disabled"}`, `${e.fill && "fill"}`, e.height]
24
+ setup(m, { expose: f, emit: p }) {
25
+ f();
26
+ const e = m, l = p, { modelValue: r, updateModelValue: a } = h(
27
+ e,
28
+ (t) => l("update:model-value", t),
29
+ ""
30
+ ), i = y(r.value);
31
+ b(r, (t) => {
32
+ i.value = t;
33
+ });
34
+ const c = u(
35
+ () => v({
36
+ "nmorph-select-button": [e.disabled && "disabled", e.fill && "fill", e.height]
34
37
  })
35
- ), r = (t) => typeof t == "number" ? `${t}px` : t, p = o(() => ({
36
- ...e.trackPadding !== void 0 && { "--track-padding": r(e.trackPadding) },
37
- ...e.itemSize !== void 0 && { "--item-size": r(e.itemSize) },
38
+ ), S = u(() => ({
39
+ ...e.trackPadding !== void 0 && { "--track-padding": s(e.trackPadding) },
40
+ ...e.itemSize !== void 0 && { "--item-size": s(e.itemSize) },
38
41
  ...e.itemFontSize !== void 0 && { "--item-font-size": e.itemFontSize }
39
- })), a = (t) => {
40
- e.disabled || (i.value = t, l("update:model-value", t));
42
+ })), o = (t) => {
43
+ e.disabled || (i.value = t, a(t));
41
44
  };
42
- n("select-button-selected-value", i), n("select-button-change-handler", a);
43
- const d = { props: e, emit: l, initialValue: i, modifiers: f, getCssSize: r, styles: p, changeHandler: a, get NmorphSelectButtonItem() {
44
- return b;
45
+ n("select-button-selected-value", i), n("select-button-change-handler", o);
46
+ const d = { props: e, emit: l, modelValue: r, updateModelValue: a, initialValue: i, modifiers: c, styles: S, changeHandler: o, get NmorphSelectButtonItem() {
47
+ return q;
45
48
  } };
46
49
  return Object.defineProperty(d, "__isScriptSetup", { enumerable: !1, value: !0 }), d;
47
50
  }
48
51
  });
49
52
  export {
50
- _ as default
53
+ F as default
51
54
  };
@@ -22,7 +22,7 @@ const v = /* @__PURE__ */ c({
22
22
  s({ inputDOMRef: n });
23
23
  const l = d(() => r?.value === e.value), u = d(
24
24
  () => f({
25
- "nmorph-select-button-item": [`${l.value && "checked"}`, `${e.disabled && "disabled"}`]
25
+ "nmorph-select-button-item": [l.value && "checked", e.disabled && "disabled"]
26
26
  })
27
27
  ), a = { selectedValue: r, changeHandler: t, props: e, inputDOMRef: n, checked: l, modifiers: u, clickHandler: () => {
28
28
  e.disabled || t && t(e.value);
@@ -1,9 +1,10 @@
1
1
  import './NmorphSlider.css';
2
- import { defineComponent as k, computed as m, ref as o, watch as I, onMounted as A, onUnmounted as G } from "vue";
3
- import { useModifiers as J } from "../../../utils/create-modifiers.js";
4
- import { useFormItemInput as K } from "../nmorph-form/use-form-item-input.js";
5
- import Q from "../../feedback/nmorph-tooltip/NmorphTooltip.vue.js";
6
- 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({
7
8
  __name: "NmorphSlider",
8
9
  props: {
9
10
  modelValue: { type: Number, required: !1, default: 0 },
@@ -22,72 +23,73 @@ const se = /* @__PURE__ */ k({
22
23
  tabindex: { type: Number, required: !1 }
23
24
  },
24
25
  emits: ["update:model-value"],
25
- setup(H, { expose: L, emit: M }) {
26
- L();
27
- const e = H, { id: N, name: T, tabindex: S } = K(e), _ = m(
28
- () => 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({
29
30
  nmorph: [],
30
- "nmorph-slider": [`${e.disabled && "disabled"}`]
31
+ "nmorph-slider": [e.disabled && "disabled"]
31
32
  })
32
- ), g = m(() => `${e.thumbWidth}px`), p = o(e.showTooltip), x = M, n = o(e.modelValue), c = o(null);
33
- I(n, () => {
34
- x("update:model-value", n.value);
35
- }), I(
36
- () => e.modelValue,
37
- (t) => {
38
- n.value = t;
39
- }
40
- );
41
- const y = o(null), C = m(() => {
42
- const t = s.value - s.value, r = e.max - e.min + t, u = (n.value - e.min) / r * 100, a = c.value?.clientWidth || 0, d = e.thumbWidth / a * 100, R = d / 2;
43
- let D = u - R;
44
- const W = `${Math.max(0, Math.min(100 - d, D))}%`, q = a / 100, X = e.thumbWidth / 2 / q, E = (y.value?.tooltipBody.clientWidth ?? 24) / 2 / q, j = E === 1 / 0 ? 1.714 : E, U = `${parseFloat(W) + X - j}%`;
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);
38
+ E(n, () => {
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}%`;
45
47
  return {
46
- thumb: W,
47
- tooltip: U
48
+ thumb: q,
49
+ tooltip: A
48
50
  };
49
- }), s = o(0), f = o(0), h = () => {
50
- s.value = window.innerWidth, f.value = window.innerHeight;
51
+ }), l = o(0), h = o(0), v = () => {
52
+ l.value = window.innerWidth, h.value = window.innerHeight;
51
53
  };
52
- A(() => {
53
- typeof window < "u" && (s.value = window.innerWidth, f.value = window.innerHeight, window.addEventListener("resize", h));
54
- }), G(() => {
55
- typeof window < "u" && (document.removeEventListener("pointermove", l), 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));
56
58
  });
57
- const v = (t) => {
58
- b.value = !1;
59
- const r = c.value?.getBoundingClientRect();
59
+ const b = (t) => {
60
+ w.value = !1;
61
+ const r = f.value?.getBoundingClientRect();
60
62
  let u = 0;
61
63
  if (r) {
62
64
  const a = t - r.left, d = r.width;
63
65
  u = Math.max(0, Math.min(1, a / d)), n.value = e.min + u * (e.max - e.min);
64
66
  }
65
67
  n.value = Math.round(n.value / e.step) * e.step, n.value = Math.max(e.min, Math.min(e.max, n.value));
66
- }, l = (t) => {
67
- t.preventDefault(), v(t.clientX);
68
+ }, s = (t) => {
69
+ t.preventDefault(), b(t.clientX);
68
70
  }, i = () => {
69
- document.removeEventListener("pointermove", l), document.removeEventListener("pointerup", i), document.removeEventListener("pointercancel", i), b.value = !0;
70
- }, z = (t) => {
71
- e.disabled || t.pointerType === "mouse" && t.button !== 0 || (t.preventDefault(), v(t.clientX), document.addEventListener("pointermove", l), document.addEventListener("pointerup", i), document.addEventListener("pointercancel", i));
72
- }, 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 = () => {
73
75
  e.showTooltip && (p.value = !0);
74
- }, V = () => {
76
+ }, R = () => {
75
77
  e.showTooltip && (p.value = !1);
76
- }, B = (t) => {
78
+ }, D = (t) => {
77
79
  const r = t.target;
78
80
  n.value = Number(r.value);
79
- }, b = o(!0), w = (t) => typeof t == "number" ? `${t}px` : t, $ = m(() => ({
81
+ }, w = o(!0), X = m(() => ({
80
82
  "--nmorph-slider-thumb-width": g.value,
81
- ...e.sliderHeight !== void 0 && { "--slider-height": w(e.sliderHeight) },
83
+ ...e.sliderHeight !== void 0 && { "--slider-height": H(e.sliderHeight) },
82
84
  ...e.valueFixedContainerHeight !== void 0 && {
83
- "--value-fixed-container-height": w(e.valueFixedContainerHeight)
85
+ "--value-fixed-container-height": H(e.valueFixedContainerHeight)
84
86
  }
85
- })), P = { props: e, id: N, name: T, tabindex: S, modifiers: _, thumbWidthCss: g, tooltipVisible: p, emit: x, thumbValue: n, sliderContainer: c, tooltipRootRef: y, thumbXPercentPosition: C, windowWidth: s, windowHeight: f, resizeWindowHandler: h, updateThumbValue: v, pointerMove: l, pointerUp: i, pointerDownHandler: z, sliderFirst: F, handleMouseEnter: O, handleMouseLeave: V, nativeInputHandler: B, transitionEnabled: b, getCssSize: w, styles: $, get NmorphTooltip() {
86
- 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;
87
89
  } };
88
- return Object.defineProperty(P, "__isScriptSetup", { enumerable: !1, value: !0 }), P;
90
+ return Object.defineProperty(W, "__isScriptSetup", { enumerable: !1, value: !0 }), W;
89
91
  }
90
92
  });
91
93
  export {
92
- se as default
94
+ de as default
93
95
  };
@@ -1,10 +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 { useFormItemInput as _ } from "../nmorph-form/use-form-item-input.js";
5
- import w from "../../basic/nmorph-icon/NmorphIcon.vue.js";
6
- import H from "../../../assets/icons/loader.svg.js";
7
- const C = /* @__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({
8
9
  __name: "NmorphSwitch",
9
10
  props: {
10
11
  modelValue: { type: [Boolean, String, Number], required: !1, default: !1 },
@@ -22,47 +23,48 @@ const C = /* @__PURE__ */ q({
22
23
  tabindex: { type: Number, required: !1 }
23
24
  },
24
25
  emits: ["update:model-value"],
25
- setup(s, { expose: f, emit: m }) {
26
- const e = s, { id: p, name: c, tabindex: h } = _(e), u = m, a = i(!1), g = () => {
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 = () => {
27
32
  a.value = !0;
28
- }, v = () => {
33
+ }, y = () => {
29
34
  a.value = !1;
30
- }, b = n(
31
- () => V({
35
+ }, S = f(
36
+ () => w({
32
37
  "nmorph-switch": [
33
- `${e.disabled && "disabled"}`,
34
- `${r.value ? "on" : "off"}`,
35
- `${e.loading && "loading"}`,
36
- `${a.value && "focus"}`
38
+ e.disabled && "disabled",
39
+ t.value ? "on" : "off",
40
+ e.loading && "loading",
41
+ a.value && "focus"
37
42
  ]
38
43
  })
39
- ), r = i(e.modelValue === e.activeValue), y = () => {
44
+ ), t = u(i.value === e.activeValue), q = () => {
40
45
  if (e.disabled) return;
41
- r.value = !r.value;
42
- const t = r.value ? e.activeValue : e.inactiveValue;
43
- u("update:model-value", t);
44
- }, l = i(null);
45
- f({ inputDOMRef: l });
46
- const o = (t) => typeof t == "number" ? `${t}px` : t, S = n(() => ({
46
+ t.value = !t.value;
47
+ const r = t.value ? e.activeValue : e.inactiveValue;
48
+ d(r);
49
+ }, s = u(null);
50
+ p({ inputDOMRef: s });
51
+ const N = f(() => ({
47
52
  ...e.width !== void 0 && { "--width": o(e.width) },
48
53
  ...e.height !== void 0 && { "--height": o(e.height) },
49
54
  ...e.offset !== void 0 && { "--offset": o(e.offset) },
50
55
  ...e.thumbHeight !== void 0 && { "--thumb-height": o(e.thumbHeight) }
51
56
  }));
52
- N(
53
- () => e.modelValue,
54
- (t) => {
55
- r.value = t === e.activeValue;
56
- }
57
- );
58
- const d = { props: e, id: p, name: c, tabindex: h, emit: u, focus: a, focusHandler: g, blurHandler: v, modifiers: b, initialValue: r, changeHandler: y, inputDOMRef: l, getCssSize: o, styles: S, get NmorphIcon() {
59
- 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;
60
62
  }, get NmorphIconLoaderDots() {
61
- return H;
63
+ return x;
62
64
  } };
63
- return Object.defineProperty(d, "__isScriptSetup", { enumerable: !1, value: !0 }), d;
65
+ return Object.defineProperty(n, "__isScriptSetup", { enumerable: !1, value: !0 }), n;
64
66
  }
65
67
  });
66
68
  export {
67
- C as default
69
+ j as default
68
70
  };
@@ -0,0 +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);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)}
@@ -1,5 +1,7 @@
1
+ import './NmorphTextInput.css';
1
2
  import s from "./NmorphTextInput.vue2.js";
2
3
  import { openBlock as n, createElementBlock as r, normalizeStyle as m, normalizeClass as c, createElementVNode as i, renderSlot as h, createCommentVNode as l, mergeProps as f, withKeys as y, createBlock as d, withModifiers as _, withCtx as a, createVNode as u, resolveDynamicComponent as b } from "vue";
4
+ /* empty css */
3
5
  import x from "../../../_virtual/_plugin-vue_export-helper.js";
4
6
  const v = { class: "nmorph-text-input__input-side" }, k = {
5
7
  key: 0,
@@ -27,7 +29,7 @@ function B(p, o, N, e, C, I) {
27
29
  type: e.type,
28
30
  placeholder: e.props.placeholder,
29
31
  disabled: e.props.disabled,
30
- value: e.props.modelValue
32
+ value: e.modelValue
31
33
  }, e.props.inputAttrs, {
32
34
  onInput: e.handleInput,
33
35
  onFocus: e.handleFocus,
@@ -64,7 +66,7 @@ function B(p, o, N, e, C, I) {
64
66
  /* CLASS, STYLE */
65
67
  );
66
68
  }
67
- const M = /* @__PURE__ */ x(s, [["render", B], ["__file", "/builds/ketjo/nmorph/library/src/components/form/nmorph-text-input/NmorphTextInput.vue"]]);
69
+ const z = /* @__PURE__ */ x(s, [["render", B], ["__file", "/builds/ketjo/nmorph/library/src/components/form/nmorph-text-input/NmorphTextInput.vue"]]);
68
70
  export {
69
- M as default
71
+ z as default
70
72
  };
@@ -1,13 +1,14 @@
1
- import { defineComponent as C, useSlots as E, computed as n, ref as l } from "vue";
1
+ import './NmorphTextInput.css';
2
+ import { defineComponent as E, useSlots as F, computed as r, ref as u } from "vue";
2
3
  import { NmorphComponentHeight as O } from "../../../types/index.js";
3
- import { useModifiers as $ } from "../../../utils/create-modifiers.js";
4
- import { useFormItemInput as j } from "../nmorph-form/use-form-item-input.js";
5
- import F from "../../../assets/icons/eye-blocked.svg.js";
6
- import H from "../../../assets/icons/eye.svg.js";
7
- import M from "../../basic/nmorph-button/NmorphButton.vue.js";
8
- import A from "../../basic/nmorph-icon/NmorphIcon.vue.js";
9
- import D from "../../../assets/icons/error.svg.js";
10
- const U = /* @__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({
11
12
  __name: "NmorphTextInput",
12
13
  props: {
13
14
  placeholder: { type: String, required: !1, default: "" },
@@ -24,40 +25,41 @@ const U = /* @__PURE__ */ C({
24
25
  tabindex: { type: Number, required: !1 }
25
26
  },
26
27
  emits: ["update:model-value", "focus", "blur", "on-enter", "keydown"],
27
- setup(f, { expose: m, emit: h }) {
28
- const s = E(), e = f, { id: y, name: b, autocomplete: v, tabindex: g } = j(e), q = n(
29
- () => $({
30
- nmorph: [O[e.height], `${a.value && "focused"}`],
31
- "nmorph-text-input": [
32
- `${e.typePassword && "password"}`,
33
- `${(e.typePassword || e.clearable) && "with-action"}`
34
- ]
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({
35
+ nmorph: [O[e.height], a.value && "focused"],
36
+ "nmorph-text-input": [e.typePassword && "password", (e.typePassword || e.clearable) && "with-action"]
35
37
  })
36
- ), w = (P) => {
37
- const k = P.target;
38
- r("update:model-value", k.value);
39
- }, t = l(!1), x = () => {
40
- e.clearable ? r("update:model-value", "") : t.value = !t.value;
41
- }, I = n(() => e.typePassword && !t.value && !e.clearable ? "password" : "text"), a = l(!1), N = () => {
42
- r("focus"), a.value = !0;
43
- }, _ = () => {
44
- r("blur"), a.value = !1;
45
- }, 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 = () => {
46
48
  o.value?.focus();
47
- }, p = () => {
49
+ }, d = () => {
48
50
  o.value?.blur();
49
- }, i = () => {
51
+ }, c = () => {
50
52
  o.value?.select();
51
53
  };
52
- m({ inputDOMRef: o, focus: u, blur: p, select: i });
53
- const r = h, S = n(() => e.clearable ? D : t.value ? F : H), 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() {
54
- return A;
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;
55
57
  }, get NmorphButton() {
56
- return M;
58
+ return R;
57
59
  } };
58
- return Object.defineProperty(c, "__isScriptSetup", { enumerable: !1, value: !0 }), c;
60
+ return Object.defineProperty(f, "__isScriptSetup", { enumerable: !1, value: !0 }), f;
59
61
  }
60
62
  });
61
63
  export {
62
- U as default
64
+ Z as default
63
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 $ } from "../../../types/index.js";
4
- import { useModifiers as O } from "../../../utils/create-modifiers.js";
5
- import { useFormItemInput as V } from "../nmorph-form/use-form-item-input.js";
6
- const D = /* @__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 D = /* @__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 } = V(e), a = h(null), s = h(!1), S = l(
28
- () => O({
29
- nmorph: [$[e.height], `${s.value && "focused"}`],
30
- "nmorph-textarea": [`${e.disabled && "disabled"}`, `${e.autoSize && "auto-size"}`]
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"],
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
- D 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),