@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.
- package/dist/components/basic/nmorph-button/NmorphButton.vue2.js +8 -8
- package/dist/components/basic/nmorph-icon/NmorphIcon.vue2.js +3 -3
- package/dist/components/basic/nmorph-layout/NmorphLayout.vue2.js +14 -13
- package/dist/components/basic/nmorph-link/NmorphLink.vue2.js +1 -1
- package/dist/components/basic/nmorph-scroll/NmorphScroll.css +1 -0
- package/dist/components/basic/nmorph-scroll/NmorphScroll.vue.js +6 -4
- package/dist/components/basic/nmorph-scroll/NmorphScroll.vue2.js +1 -0
- package/dist/components/basic/nmorph-space/NmorphSpace.vue2.js +15 -19
- package/dist/components/data/nmorph-avatar/NmorphAvatar.css +1 -1
- package/dist/components/data/nmorph-avatar/NmorphAvatar.vue2.js +5 -5
- package/dist/components/data/nmorph-badge/NmorphBadge.vue2.js +37 -36
- package/dist/components/data/nmorph-calendar/NmorphCalendar.vue2.js +41 -40
- package/dist/components/data/nmorph-card/NmorphCard.vue2.js +19 -15
- package/dist/components/data/nmorph-collapse/components/nmorph-collapse-item/NmorphCollapseItem.vue2.js +5 -9
- package/dist/components/data/nmorph-empty/NmorphEmpty.vue.js +3 -3
- package/dist/components/data/nmorph-empty/NmorphEmpty.vue2.js +17 -14
- package/dist/components/data/nmorph-image/NmorphImage.css +1 -0
- package/dist/components/data/nmorph-image/NmorphImage.vue.js +14 -12
- package/dist/components/data/nmorph-image/NmorphImage.vue2.js +3 -2
- package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue2.js +36 -35
- package/dist/components/data/nmorph-pagination/NmorphPagination.vue2.js +1 -1
- package/dist/components/data/nmorph-progress/NmorphProgress.vue2.js +19 -18
- package/dist/components/data/nmorph-qr-code/NmorphQRCode.vue2.js +20 -19
- package/dist/components/data/nmorph-skeleton/NmorphSkeleton.vue2.js +1 -1
- package/dist/components/data/nmorph-table/NmorphTable.vue2.js +39 -43
- package/dist/components/data/nmorph-virtual-list/NmorphVirtualList.vue2.js +34 -33
- package/dist/components/feedback/nmorph-alert/NmorphAlert.vue2.js +1 -1
- package/dist/components/feedback/nmorph-callout/NmorphCallout.vue2.js +7 -6
- package/dist/components/feedback/nmorph-dialog/NmorphDialog.css +1 -1
- package/dist/components/feedback/nmorph-dialog/NmorphDialog.vue.js +25 -20
- package/dist/components/feedback/nmorph-dialog/NmorphDialog.vue2.js +37 -37
- package/dist/components/feedback/nmorph-drawer/NmorphDrawer.vue2.js +22 -21
- package/dist/components/feedback/nmorph-tooltip/NmorphTooltip.vue2.js +26 -25
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue2.js +65 -71
- package/dist/components/form/nmorph-checkbox/NmorphCheckbox.css +1 -1
- package/dist/components/form/nmorph-checkbox/NmorphCheckbox.vue2.js +30 -28
- 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 +53 -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/components/nmorph-form-item/inner-components/nmorph-error-box/NmorphErrorBox.vue2.js +1 -1
- package/dist/components/form/nmorph-form/use-form-item-input.js +29 -8
- package/dist/components/form/nmorph-number-input/NmorphNumberInput.vue2.js +42 -39
- package/dist/components/form/nmorph-otp-input/NmorphOTPInput.vue2.js +66 -62
- package/dist/components/form/nmorph-radio/NmorphRadio.css +1 -1
- package/dist/components/form/nmorph-radio/NmorphRadio.vue2.js +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 +83 -81
- package/dist/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue2.js +4 -4
- package/dist/components/form/nmorph-select-button/NmorphSelectButton.vue2.js +28 -25
- package/dist/components/form/nmorph-select-button/components/nmorph-select-button-item/NmorphSelectButtonItem.vue2.js +1 -1
- package/dist/components/form/nmorph-slider/NmorphSlider.vue2.js +51 -49
- package/dist/components/form/nmorph-switch/NmorphSwitch.vue2.js +35 -33
- package/dist/components/form/nmorph-text-input/NmorphTextInput.css +1 -0
- package/dist/components/form/nmorph-text-input/NmorphTextInput.vue.js +5 -3
- package/dist/components/form/nmorph-text-input/NmorphTextInput.vue2.js +37 -35
- package/dist/components/form/nmorph-textarea/NmorphTextarea.vue.js +1 -1
- package/dist/components/form/nmorph-textarea/NmorphTextarea.vue2.js +30 -26
- package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue.js +1 -1
- package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue2.js +68 -66
- package/dist/components/navigation/nmorph-backtop/NmorphBacktop.vue2.js +1 -1
- package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue2.js +32 -31
- package/dist/components/navigation/nmorph-tabs/NmorphTabs.vue2.js +1 -1
- package/dist/components/others/nmorph-overlay/NmorphOverlay.vue2.js +1 -1
- package/dist/hooks/use-common-styles.js +18 -278
- package/dist/hooks/use-field-validation.js +71 -42
- package/dist/hooks/use-form-validation.js +62 -24
- package/dist/hooks/use-virtual-list.js +38 -32
- package/dist/index.umd.js +26 -286
- package/dist/package.json.js +1 -1
- package/dist/src/components/basic/nmorph-button/NmorphButton.vue.d.ts +2 -2
- 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-collapse/components/nmorph-collapse-item/NmorphCollapseItem.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-empty/NmorphEmpty.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-pagination/NmorphPagination.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/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.d.ts +1 -1
- package/dist/src/components/feedback/nmorph-callout/NmorphCallout.vue.d.ts +1 -1
- package/dist/src/components/feedback/nmorph-dialog/NmorphDialog.vue.d.ts +4 -4
- package/dist/src/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue.d.ts +3 -3
- package/dist/src/components/form/nmorph-color-picker/NmorphColorPicker.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-date-picker/NmorphDatePicker.vue.d.ts +3 -3
- 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/components/nmorph-form-item/NmorphFormItem.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-form/components/nmorph-form-item/inner-components/nmorph-error-box/NmorphErrorBox.vue.d.ts +1 -1
- 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-number-input/NmorphNumberInput.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-otp-input/NmorphOTPInput.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-radio-group/NmorphRadioGroup.vue.d.ts +3 -3
- package/dist/src/components/form/nmorph-select/NmorphSelect.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-select-button/NmorphSelectButton.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-text-input/NmorphTextInput.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-textarea/NmorphTextarea.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-time-picker/NmorphTimePicker.vue.d.ts +1 -1
- package/dist/src/hooks/use-field-validation.d.ts +15 -0
- package/dist/src/hooks/use-form-validation.d.ts +5 -0
- package/dist/src/hooks/use-virtual-list.d.ts +6 -0
- package/dist/src/types/index.d.ts +2 -1
- package/dist/src/utils/common.d.ts +5 -0
- package/dist/src/utils/create-modifiers.d.ts +4 -2
- package/dist/style.css +1 -1
- package/dist/utils/common.js +9 -3
- package/dist/utils/create-modifiers.js +6 -6
- package/package.json +1 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import './NmorphSelectButton.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import
|
|
5
|
-
|
|
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(
|
|
23
|
-
|
|
24
|
-
const e =
|
|
25
|
-
|
|
26
|
-
() =>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
),
|
|
36
|
-
...e.trackPadding !== void 0 && { "--track-padding":
|
|
37
|
-
...e.itemSize !== void 0 && { "--item-size":
|
|
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
|
-
})),
|
|
40
|
-
e.disabled || (i.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",
|
|
43
|
-
const d = { props: e, emit: l,
|
|
44
|
-
return
|
|
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
|
-
|
|
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": [
|
|
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
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
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(
|
|
26
|
-
|
|
27
|
-
const e =
|
|
28
|
-
() =>
|
|
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": [
|
|
31
|
+
"nmorph-slider": [e.disabled && "disabled"]
|
|
31
32
|
})
|
|
32
|
-
), g = m(() => `${e.thumbWidth}px`), p = o(e.showTooltip), x =
|
|
33
|
-
|
|
34
|
-
x("update:model-value",
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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:
|
|
47
|
-
tooltip:
|
|
48
|
+
thumb: q,
|
|
49
|
+
tooltip: A
|
|
48
50
|
};
|
|
49
|
-
}),
|
|
50
|
-
|
|
51
|
+
}), l = o(0), h = o(0), v = () => {
|
|
52
|
+
l.value = window.innerWidth, h.value = window.innerHeight;
|
|
51
53
|
};
|
|
52
|
-
|
|
53
|
-
typeof window < "u" && (
|
|
54
|
-
}),
|
|
55
|
-
typeof window < "u" && (document.removeEventListener("pointermove",
|
|
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
|
|
58
|
-
|
|
59
|
-
const r =
|
|
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
|
-
},
|
|
67
|
-
t.preventDefault(),
|
|
68
|
+
}, s = (t) => {
|
|
69
|
+
t.preventDefault(), b(t.clientX);
|
|
68
70
|
}, i = () => {
|
|
69
|
-
document.removeEventListener("pointermove",
|
|
70
|
-
},
|
|
71
|
-
e.disabled || t.pointerType === "mouse" && t.button !== 0 || (t.preventDefault(),
|
|
72
|
-
},
|
|
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
|
-
},
|
|
76
|
+
}, R = () => {
|
|
75
77
|
e.showTooltip && (p.value = !1);
|
|
76
|
-
},
|
|
78
|
+
}, D = (t) => {
|
|
77
79
|
const r = t.target;
|
|
78
80
|
n.value = Number(r.value);
|
|
79
|
-
},
|
|
81
|
+
}, w = o(!0), X = m(() => ({
|
|
80
82
|
"--nmorph-slider-thumb-width": g.value,
|
|
81
|
-
...e.sliderHeight !== void 0 && { "--slider-height":
|
|
83
|
+
...e.sliderHeight !== void 0 && { "--slider-height": H(e.sliderHeight) },
|
|
82
84
|
...e.valueFixedContainerHeight !== void 0 && {
|
|
83
|
-
"--value-fixed-container-height":
|
|
85
|
+
"--value-fixed-container-height": H(e.valueFixedContainerHeight)
|
|
84
86
|
}
|
|
85
|
-
})),
|
|
86
|
-
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;
|
|
87
89
|
} };
|
|
88
|
-
return Object.defineProperty(
|
|
90
|
+
return Object.defineProperty(W, "__isScriptSetup", { enumerable: !1, value: !0 }), W;
|
|
89
91
|
}
|
|
90
92
|
});
|
|
91
93
|
export {
|
|
92
|
-
|
|
94
|
+
de as default
|
|
93
95
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import './NmorphSwitch.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
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(
|
|
26
|
-
const e =
|
|
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
|
-
},
|
|
33
|
+
}, y = () => {
|
|
29
34
|
a.value = !1;
|
|
30
|
-
},
|
|
31
|
-
() =>
|
|
35
|
+
}, S = f(
|
|
36
|
+
() => w({
|
|
32
37
|
"nmorph-switch": [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
e.disabled && "disabled",
|
|
39
|
+
t.value ? "on" : "off",
|
|
40
|
+
e.loading && "loading",
|
|
41
|
+
a.value && "focus"
|
|
37
42
|
]
|
|
38
43
|
})
|
|
39
|
-
),
|
|
44
|
+
), t = u(i.value === e.activeValue), q = () => {
|
|
40
45
|
if (e.disabled) return;
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
const
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
|
63
|
+
return x;
|
|
62
64
|
} };
|
|
63
|
-
return Object.defineProperty(
|
|
65
|
+
return Object.defineProperty(n, "__isScriptSetup", { enumerable: !1, value: !0 }), n;
|
|
64
66
|
}
|
|
65
67
|
});
|
|
66
68
|
export {
|
|
67
|
-
|
|
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.
|
|
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
|
|
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
|
-
|
|
71
|
+
z as default
|
|
70
72
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import
|
|
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
|
|
4
|
-
import { useFormItemInput as j } from "../nmorph-form/use-form-item-input.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
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({
|
|
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(
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
),
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
}, t =
|
|
40
|
-
e.clearable ?
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
}, 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 = () => {
|
|
46
48
|
o.value?.focus();
|
|
47
|
-
},
|
|
49
|
+
}, d = () => {
|
|
48
50
|
o.value?.blur();
|
|
49
|
-
},
|
|
51
|
+
}, c = () => {
|
|
50
52
|
o.value?.select();
|
|
51
53
|
};
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
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;
|
|
55
57
|
}, get NmorphButton() {
|
|
56
|
-
return
|
|
58
|
+
return R;
|
|
57
59
|
} };
|
|
58
|
-
return Object.defineProperty(
|
|
60
|
+
return Object.defineProperty(f, "__isScriptSetup", { enumerable: !1, value: !0 }), f;
|
|
59
61
|
}
|
|
60
62
|
});
|
|
61
63
|
export {
|
|
62
|
-
|
|
64
|
+
Z as default
|
|
63
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 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(
|
|
27
|
-
const e =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
),
|
|
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
|
};
|