@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.
- package/dist/components/data/nmorph-card/NmorphCard.vue2.js +19 -16
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue2.js +67 -65
- package/dist/components/form/nmorph-checkbox/NmorphCheckbox.css +1 -1
- package/dist/components/form/nmorph-checkbox/NmorphCheckbox.vue2.js +28 -26
- package/dist/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue2.js +25 -20
- package/dist/components/form/nmorph-color-picker/NmorphColorPicker.vue2.js +43 -42
- package/dist/components/form/nmorph-date-picker/NmorphDatePicker.vue2.js +52 -40
- package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue.js +20 -16
- package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue2.js +113 -86
- package/dist/components/form/nmorph-form/NmorphForm.vue2.js +9 -9
- package/dist/components/form/nmorph-form/components/nmorph-form-item/NmorphFormItem.vue2.js +33 -24
- package/dist/components/form/nmorph-form/use-form-item-input.js +29 -8
- package/dist/components/form/nmorph-number-input/NmorphNumberInput.vue2.js +41 -35
- package/dist/components/form/nmorph-otp-input/NmorphOTPInput.vue2.js +65 -61
- package/dist/components/form/nmorph-radio/NmorphRadio.css +1 -1
- package/dist/components/form/nmorph-radio-group/NmorphRadioGroup.vue2.js +24 -22
- package/dist/components/form/nmorph-select/NmorphSelect.css +1 -1
- package/dist/components/form/nmorph-select/NmorphSelect.vue2.js +91 -81
- package/dist/components/form/nmorph-select-button/NmorphSelectButton.vue2.js +28 -26
- package/dist/components/form/nmorph-slider/NmorphSlider.vue2.js +49 -48
- package/dist/components/form/nmorph-switch/NmorphSwitch.vue2.js +37 -36
- package/dist/components/form/nmorph-text-input/NmorphTextInput.css +1 -1
- package/dist/components/form/nmorph-text-input/NmorphTextInput.vue.js +1 -1
- package/dist/components/form/nmorph-text-input/NmorphTextInput.vue2.js +34 -30
- package/dist/components/form/nmorph-textarea/NmorphTextarea.vue.js +1 -1
- package/dist/components/form/nmorph-textarea/NmorphTextarea.vue2.js +29 -25
- package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue.js +1 -1
- package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue2.js +69 -68
- package/dist/hooks/use-field-validation.js +71 -42
- package/dist/hooks/use-form-validation.js +62 -24
- package/dist/index.umd.js +26 -26
- package/dist/package.json.js +1 -1
- package/dist/src/components/basic/nmorph-button/NmorphButton.vue.d.ts +1 -1
- package/dist/src/components/basic/nmorph-link/NmorphLink.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-avatar/NmorphAvatar.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-badge/NmorphBadge.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-empty/NmorphEmpty.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-progress/NmorphProgress.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-table/NmorphTable.vue.d.ts +1 -1
- package/dist/src/components/feedback/nmorph-callout/NmorphCallout.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue.d.ts +2 -2
- package/dist/src/components/form/nmorph-date-picker/NmorphDatePicker.vue.d.ts +2 -2
- package/dist/src/components/form/nmorph-file-upload/NmorphFileUpload.vue.d.ts +6 -3
- package/dist/src/components/form/nmorph-file-upload/types.d.ts +4 -0
- package/dist/src/components/form/nmorph-form/types.d.ts +15 -5
- package/dist/src/components/form/nmorph-form/use-form-item-input.d.ts +10 -0
- package/dist/src/components/form/nmorph-radio-group/NmorphRadioGroup.vue.d.ts +2 -2
- package/dist/src/hooks/use-field-validation.d.ts +15 -0
- package/dist/src/hooks/use-form-validation.d.ts +5 -0
- package/dist/style.css +1 -1
- package/dist/utils/common.js +6 -7
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import './NmorphSlider.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { toCssSize as
|
|
5
|
-
import { useFormItemInput as
|
|
6
|
-
import
|
|
7
|
-
const
|
|
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(
|
|
27
|
-
|
|
28
|
-
const e =
|
|
29
|
-
() =>
|
|
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
|
-
),
|
|
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
|
-
|
|
36
|
-
}), E(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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:
|
|
48
|
-
tooltip:
|
|
48
|
+
thumb: q,
|
|
49
|
+
tooltip: A
|
|
49
50
|
};
|
|
50
|
-
}), l = o(0),
|
|
51
|
-
l.value = window.innerWidth,
|
|
51
|
+
}), l = o(0), h = o(0), v = () => {
|
|
52
|
+
l.value = window.innerWidth, h.value = window.innerHeight;
|
|
52
53
|
};
|
|
53
|
-
|
|
54
|
-
typeof window < "u" && (l.value = window.innerWidth,
|
|
55
|
-
}),
|
|
56
|
-
typeof window < "u" && (document.removeEventListener("pointermove", s), document.removeEventListener("pointerup", i), document.removeEventListener("pointercancel", i), window.removeEventListener("resize",
|
|
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
|
|
59
|
-
|
|
60
|
-
const r =
|
|
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(),
|
|
69
|
+
t.preventDefault(), b(t.clientX);
|
|
69
70
|
}, i = () => {
|
|
70
|
-
document.removeEventListener("pointermove", s), document.removeEventListener("pointerup", i), document.removeEventListener("pointercancel", i),
|
|
71
|
-
},
|
|
72
|
-
e.disabled || t.pointerType === "mouse" && t.button !== 0 || (t.preventDefault(),
|
|
73
|
-
},
|
|
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
|
-
},
|
|
76
|
+
}, R = () => {
|
|
76
77
|
e.showTooltip && (p.value = !1);
|
|
77
|
-
},
|
|
78
|
+
}, D = (t) => {
|
|
78
79
|
const r = t.target;
|
|
79
80
|
n.value = Number(r.value);
|
|
80
|
-
},
|
|
81
|
-
"--nmorph-slider-thumb-width":
|
|
82
|
-
...e.sliderHeight !== void 0 && { "--slider-height":
|
|
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":
|
|
85
|
+
"--value-fixed-container-height": H(e.valueFixedContainerHeight)
|
|
85
86
|
}
|
|
86
|
-
})),
|
|
87
|
-
return
|
|
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(
|
|
90
|
+
return Object.defineProperty(W, "__isScriptSetup", { enumerable: !1, value: !0 }), W;
|
|
90
91
|
}
|
|
91
92
|
});
|
|
92
93
|
export {
|
|
93
|
-
|
|
94
|
+
de as default
|
|
94
95
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import './NmorphSwitch.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { toCssSize as
|
|
5
|
-
import { useFormItemInput as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
const
|
|
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(
|
|
27
|
-
const e =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
41
|
+
a.value && "focus"
|
|
38
42
|
]
|
|
39
43
|
})
|
|
40
|
-
), t = i
|
|
44
|
+
), t = u(i.value === e.activeValue), q = () => {
|
|
41
45
|
if (e.disabled) return;
|
|
42
46
|
t.value = !t.value;
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
...e.width !== void 0 && { "--width":
|
|
49
|
-
...e.height !== void 0 && { "--height":
|
|
50
|
-
...e.offset !== void 0 && { "--offset":
|
|
51
|
-
...e.thumbHeight !== void 0 && { "--thumb-height":
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
|
63
|
+
return x;
|
|
63
64
|
} };
|
|
64
|
-
return Object.defineProperty(
|
|
65
|
+
return Object.defineProperty(n, "__isScriptSetup", { enumerable: !1, value: !0 }), n;
|
|
65
66
|
}
|
|
66
67
|
});
|
|
67
68
|
export {
|
|
68
|
-
|
|
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)}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import './NmorphTextInput.css';
|
|
2
|
-
import { defineComponent as
|
|
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
|
|
5
|
-
import { useFormItemInput as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
const
|
|
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(
|
|
29
|
-
const
|
|
30
|
-
|
|
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
|
-
),
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
}, t =
|
|
38
|
-
e.clearable ?
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
}, o =
|
|
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
|
-
},
|
|
49
|
+
}, d = () => {
|
|
46
50
|
o.value?.blur();
|
|
47
|
-
},
|
|
51
|
+
}, c = () => {
|
|
48
52
|
o.value?.select();
|
|
49
53
|
};
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
return
|
|
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
|
|
58
|
+
return R;
|
|
55
59
|
} };
|
|
56
|
-
return Object.defineProperty(
|
|
60
|
+
return Object.defineProperty(f, "__isScriptSetup", { enumerable: !1, value: !0 }), f;
|
|
57
61
|
}
|
|
58
62
|
});
|
|
59
63
|
export {
|
|
60
|
-
|
|
64
|
+
Z as default
|
|
61
65
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import './NmorphTextarea.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { NmorphComponentHeight as
|
|
4
|
-
import { useModifiers as
|
|
5
|
-
import { useFormItemInput as
|
|
6
|
-
const
|
|
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(
|
|
27
|
-
const e =
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
),
|
|
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
|
|
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),
|
|
42
|
-
t.style.height = `${
|
|
43
|
-
},
|
|
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
|
-
|
|
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
|
-
},
|
|
54
|
+
}, p = () => {
|
|
51
55
|
a.value?.focus();
|
|
52
|
-
},
|
|
56
|
+
}, m = () => {
|
|
53
57
|
a.value?.blur();
|
|
54
|
-
},
|
|
58
|
+
}, f = () => {
|
|
55
59
|
a.value?.select();
|
|
56
60
|
};
|
|
57
|
-
|
|
58
|
-
const
|
|
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
|
-
})),
|
|
62
|
-
return Object.defineProperty(
|
|
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
|
-
|
|
70
|
+
G as default
|
|
67
71
|
};
|