@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,9 +1,9 @@
|
|
|
1
1
|
import './NmorphCard.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { NmorphShadowType as
|
|
4
|
-
import { useModifiers as
|
|
5
|
-
import { toCssSize as
|
|
6
|
-
const S = /* @__PURE__ */
|
|
2
|
+
import { defineComponent as p, useSlots as l, computed as o } from "vue";
|
|
3
|
+
import { NmorphShadowType as u } from "../../../types/index.js";
|
|
4
|
+
import { useModifiers as f } from "../../../utils/create-modifiers.js";
|
|
5
|
+
import { toCssSize as m } from "../../../utils/common.js";
|
|
6
|
+
const S = /* @__PURE__ */ p({
|
|
7
7
|
__name: "NmorphCard",
|
|
8
8
|
props: {
|
|
9
9
|
shadowType: { type: null, required: !1, default: "outset" },
|
|
@@ -13,19 +13,22 @@ const S = /* @__PURE__ */ n({
|
|
|
13
13
|
fill: { type: Boolean, required: !1, default: !0 },
|
|
14
14
|
tag: { type: String, required: !1, default: "div" }
|
|
15
15
|
},
|
|
16
|
-
setup(
|
|
17
|
-
|
|
18
|
-
const e =
|
|
19
|
-
() =>
|
|
20
|
-
nmorph: [
|
|
16
|
+
setup(t, { expose: i }) {
|
|
17
|
+
i();
|
|
18
|
+
const e = t, a = l(), n = o(
|
|
19
|
+
() => f({
|
|
20
|
+
nmorph: [u[e.shadowType]],
|
|
21
21
|
"nmorph-card": [e.shadowType, e.fill ? "fill" : "fit-content"]
|
|
22
22
|
})
|
|
23
|
-
), s =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
), s = o(() => {
|
|
24
|
+
const d = e.cardPadding !== void 0 ? m(e.cardPadding) : void 0;
|
|
25
|
+
return {
|
|
26
|
+
...e.shadowType === "combined" && {
|
|
27
|
+
"--nmorph-card-combined-border-width": `${e.combinedShadowBorderWidth}px`
|
|
28
|
+
},
|
|
29
|
+
...d !== void 0 && { "--card-padding": d, padding: d }
|
|
30
|
+
};
|
|
31
|
+
}), r = { props: e, slots: a, modifiers: n, styles: s };
|
|
29
32
|
return Object.defineProperty(r, "__isScriptSetup", { enumerable: !1, value: !0 }), r;
|
|
30
33
|
}
|
|
31
34
|
});
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import './NmorphAutocomplete.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { getNmorphOptionHeight as
|
|
5
|
-
import { NmorphComponentHeight as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
|
|
2
|
+
import { defineComponent as K, ref as s, computed as l, watch as c, nextTick as Q } from "vue";
|
|
3
|
+
import { useModifiers as M } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { getNmorphOptionHeight as W, toCssSize as X, resolveDomElement as Y } from "../../../utils/common.js";
|
|
5
|
+
import { NmorphComponentHeight as ee } from "../../../types/index.js";
|
|
6
|
+
import { useFormItemModel as te } from "../nmorph-form/use-form-item-input.js";
|
|
7
|
+
import { useVirtualList as ae } from "../../../hooks/use-virtual-list.js";
|
|
8
|
+
import { useZIndex as le } from "../../../hooks/use-z-index.js";
|
|
9
|
+
import re from "../nmorph-text-input/NmorphTextInput.vue.js";
|
|
10
|
+
import oe from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
|
|
11
|
+
import ue from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
12
|
+
import ne from "../../../assets/icons/loader.svg.js";
|
|
13
|
+
const Ie = /* @__PURE__ */ K({
|
|
13
14
|
__name: "NmorphAutocomplete",
|
|
14
15
|
props: {
|
|
15
16
|
modelValue: { type: String, required: !1, default: "" },
|
|
@@ -31,83 +32,84 @@ const fe = /* @__PURE__ */ G({
|
|
|
31
32
|
tabindex: { type: Number, required: !1 }
|
|
32
33
|
},
|
|
33
34
|
emits: ["update:model-value", "select"],
|
|
34
|
-
setup(
|
|
35
|
-
|
|
36
|
-
const t =
|
|
37
|
-
|
|
35
|
+
setup(O, { expose: L, emit: V }) {
|
|
36
|
+
L();
|
|
37
|
+
const t = O, p = V, { modelValue: m, updateModelValue: v } = te(
|
|
38
|
+
t,
|
|
39
|
+
(e) => p("update:model-value", e),
|
|
40
|
+
""
|
|
41
|
+
), o = s(m.value), A = l(
|
|
42
|
+
() => M({
|
|
38
43
|
"nmorph-autocomplete": [a.value && "open"]
|
|
39
44
|
})
|
|
40
|
-
), i = s(!1),
|
|
41
|
-
i.value = e === "", o.value = e, a.value = !i.value && r.value.length > 0, u.value = 0,
|
|
42
|
-
},
|
|
45
|
+
), i = s(!1), b = (e) => {
|
|
46
|
+
i.value = e === "", o.value = e, a.value = !i.value && r.value.length > 0, u.value = 0, v(o.value);
|
|
47
|
+
}, T = l({
|
|
43
48
|
get: () => o.value,
|
|
44
|
-
set:
|
|
45
|
-
}), a = s(!1),
|
|
49
|
+
set: b
|
|
50
|
+
}), a = s(!1), z = s(null), x = () => {
|
|
46
51
|
i.value = !0, a.value = !1;
|
|
47
|
-
}, r = l(() => t.list.filter((e) => Object.keys(e).some((
|
|
48
|
-
enabled:
|
|
49
|
-
itemHeight:
|
|
50
|
-
overscan:
|
|
51
|
-
dynamic:
|
|
52
|
-
}),
|
|
53
|
-
c(
|
|
54
|
-
(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
), c(r, async (e) => {
|
|
59
|
-
a.value = !i.value && o.value !== "" && e.length > 0, u.value = 0, await J(), n.scrollToIndex(0), n.refresh();
|
|
52
|
+
}, r = l(() => t.list.filter((e) => Object.keys(e).some((I) => String(e[I]).toLowerCase().includes(o.value.toLowerCase())))), f = l(() => t.virtual && r.value.length > 0), H = l(() => t.virtualItemHeight || W(t.height)), q = l(() => t.virtualOverscan), N = l(() => t.virtualDynamicHeight), n = ae(r, {
|
|
53
|
+
enabled: f,
|
|
54
|
+
itemHeight: H,
|
|
55
|
+
overscan: q,
|
|
56
|
+
dynamic: N
|
|
57
|
+
}), B = l(() => n.virtualItems.value), E = n.spacerStyle, $ = n.contentStyle, j = l(() => X(t.virtualMaxHeight)), u = s(0), h = l(() => r.value[u.value]), g = l(() => `${t.id || t.name || "nmorph-autocomplete"}-listbox`), D = (e) => `${g.value}-option-${e}`;
|
|
58
|
+
c(m, (e) => {
|
|
59
|
+
e !== o.value && (o.value = e);
|
|
60
|
+
}), c(r, async (e) => {
|
|
61
|
+
a.value = !i.value && o.value !== "" && e.length > 0, u.value = 0, await Q(), n.scrollToIndex(0), n.refresh();
|
|
60
62
|
});
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
+
const y = (e) => {
|
|
64
|
+
p("select", e), o.value = e.value, v(o.value), setTimeout(() => {
|
|
63
65
|
i.value = !0, a.value = !1;
|
|
64
66
|
});
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
},
|
|
67
|
+
}, F = (e) => {
|
|
68
|
+
y(e);
|
|
69
|
+
}, R = () => {
|
|
68
70
|
i.value = !1, a.value = r.value.length > 0;
|
|
69
|
-
},
|
|
71
|
+
}, d = s(!1);
|
|
70
72
|
c(o, async (e) => {
|
|
71
|
-
e !== "" && t.actionCallback && (
|
|
72
|
-
}), c(
|
|
73
|
+
e !== "" && t.actionCallback && (d.value = !0, await t.actionCallback(), d.value = !1);
|
|
74
|
+
}), c(d, (e) => {
|
|
73
75
|
e && (a.value = !0);
|
|
74
76
|
}), c(u, (e) => {
|
|
75
|
-
|
|
77
|
+
f.value && n.scrollToIndex(e);
|
|
76
78
|
});
|
|
77
|
-
const
|
|
79
|
+
const S = () => {
|
|
78
80
|
r.value.length && (a.value = !0, u.value = (u.value + 1) % r.value.length);
|
|
79
|
-
},
|
|
81
|
+
}, w = () => {
|
|
80
82
|
r.value.length && (a.value = !0, u.value = (u.value - 1 + r.value.length) % r.value.length);
|
|
81
|
-
},
|
|
82
|
-
!a.value || !
|
|
83
|
-
},
|
|
84
|
-
e.key === "ArrowDown" ? (e.preventDefault(),
|
|
85
|
-
},
|
|
83
|
+
}, k = () => {
|
|
84
|
+
!a.value || !h.value || y(h.value);
|
|
85
|
+
}, U = (e) => {
|
|
86
|
+
e.key === "ArrowDown" ? (e.preventDefault(), S()) : e.key === "ArrowUp" ? (e.preventDefault(), w()) : e.key === "Enter" ? (e.preventDefault(), k()) : e.key === "Escape" && (e.preventDefault(), x());
|
|
87
|
+
}, Z = l(() => ({
|
|
86
88
|
role: "combobox",
|
|
87
89
|
"aria-autocomplete": "list",
|
|
88
90
|
"aria-expanded": a.value,
|
|
89
|
-
"aria-controls":
|
|
90
|
-
"aria-activedescendant": a.value ?
|
|
91
|
-
})),
|
|
92
|
-
n.measureElement(
|
|
93
|
-
},
|
|
94
|
-
"--nmorph-autocomplete-input-z-index":
|
|
95
|
-
})),
|
|
96
|
-
() =>
|
|
97
|
-
nmorph: [
|
|
91
|
+
"aria-controls": g.value,
|
|
92
|
+
"aria-activedescendant": a.value ? D(u.value) : void 0
|
|
93
|
+
})), P = (e, I) => {
|
|
94
|
+
n.measureElement(I, Y(e));
|
|
95
|
+
}, C = le(a, () => t.zIndex), G = l(() => ({
|
|
96
|
+
"--nmorph-autocomplete-input-z-index": C.value + 1
|
|
97
|
+
})), J = l(
|
|
98
|
+
() => M({
|
|
99
|
+
nmorph: [ee[t.height]]
|
|
98
100
|
})
|
|
99
|
-
),
|
|
100
|
-
return
|
|
101
|
+
), _ = { props: t, emit: p, modelValue: m, updateModelValue: v, initialValue: o, modifiers: A, userClosed: i, updateValueHandler: b, inputValue: T, open: a, nmorphAutocompleteDOMRef: z, closeHandler: x, filteredList: r, virtualEnabled: f, virtualItemHeight: H, virtualOverscan: q, virtualDynamicHeight: N, virtualList: n, virtualItems: B, virtualSpacerStyle: E, virtualContentStyle: $, virtualMaxHeight: j, currentIndex: u, activeItem: h, listboxId: g, getOptionId: D, selectItem: y, clickHandler: F, focusHandler: R, loader: d, arrowDownHandler: S, arrowUpHandler: w, enterHandler: k, keydownHandler: U, inputAttrs: Z, setVirtualItemRef: P, dropdownZIndex: C, styles: G, optionHeightModifiers: J, get NmorphIcon() {
|
|
102
|
+
return ue;
|
|
101
103
|
}, get NmorphDropdown() {
|
|
102
|
-
return
|
|
104
|
+
return oe;
|
|
103
105
|
}, get NmorphTextInput() {
|
|
104
|
-
return te;
|
|
105
|
-
}, get NmorphIconLoaderDots() {
|
|
106
106
|
return re;
|
|
107
|
+
}, get NmorphIconLoaderDots() {
|
|
108
|
+
return ne;
|
|
107
109
|
} };
|
|
108
|
-
return Object.defineProperty(
|
|
110
|
+
return Object.defineProperty(_, "__isScriptSetup", { enumerable: !1, value: !0 }), _;
|
|
109
111
|
}
|
|
110
112
|
});
|
|
111
113
|
export {
|
|
112
|
-
|
|
114
|
+
Ie as default
|
|
113
115
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.nmorph-checkbox{--size: var(--height);display:inline-flex;align-items:center;vertical-align:middle;cursor:pointer}.nmorph-checkbox .nmorph-checkbox__content{position:relative;display:flex;justify-content:center;align-items:center}.nmorph-checkbox .nmorph-checkbox__input-wrapper{position:relative;width:var(--size);height:var(--size)}.nmorph-checkbox input{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0}.nmorph-checkbox input:focus-visible{outline:2px solid var(--nmorph-accent-color);opacity:1;scale:.95}.nmorph-checkbox .nmorph-checkbox__fake{position:absolute;top:0;left:0;width:100%;height:100%;background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:inset var(--base-shadow-width) var(--base-shadow-width) var(--base-shadow-blur) var(--nmorph-dark-shade-color),inset calc(-1 * var(--base-shadow-width)) calc(-1 * var(--base-shadow-width)) var(--base-shadow-blur) var(--nmorph-light-shade-color)}.nmorph-checkbox .nmorph-checkbox__label,.nmorph-checkbox .nmorph-checkbox__fake span{font-weight:400;font-size:var(--font-size
|
|
1
|
+
.nmorph-checkbox{--size: var(--height);--nmorph-selection-control-font-size: var(--font-size-small);--nmorph-selection-control-line-height: var(--line-height-regular);--nmorph-selection-control-inline-padding: var(--indentation-03);display:inline-flex;align-items:center;vertical-align:middle;cursor:pointer}.nmorph-checkbox.nmorph{height:auto;min-height:var(--size)}.nmorph-checkbox .nmorph-checkbox__content{position:relative;display:flex;justify-content:center;align-items:center;min-height:var(--size)}.nmorph-checkbox .nmorph-checkbox__input-wrapper{position:relative;width:var(--size);height:var(--size)}.nmorph-checkbox input{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0}.nmorph-checkbox input:focus-visible{outline:2px solid var(--nmorph-accent-color);opacity:1;scale:.95}.nmorph-checkbox .nmorph-checkbox__fake{position:absolute;top:0;left:0;width:100%;height:100%;background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:inset var(--base-shadow-width) var(--base-shadow-width) var(--base-shadow-blur) var(--nmorph-dark-shade-color),inset calc(-1 * var(--base-shadow-width)) calc(-1 * var(--base-shadow-width)) var(--base-shadow-blur) var(--nmorph-light-shade-color)}.nmorph-checkbox .nmorph-checkbox__label,.nmorph-checkbox .nmorph-checkbox__fake span{font-weight:400;font-size:var(--nmorph-selection-control-font-size);line-height:var(--nmorph-selection-control-line-height)}.nmorph-checkbox .nmorph-checkbox__fake-checked{position:absolute;top:50%;left:50%;width:50%;height:50%;background:var(--nmorph-accent-color);border-radius:var(--border-radius-20);transform:translate(-50%,-50%)}.nmorph-checkbox .nmorph-checkbox__label{margin-left:var(--indentation-02);line-height:1}.nmorph-checkbox .nmorph-checkbox__fake span{line-height:.8}.nmorph-checkbox.nmorph-checkbox--button .nmorph-checkbox__fake{position:relative;display:flex;justify-content:center;align-items:center;width:auto;min-width:var(--size);height:var(--size);padding:var(--nmorph-selection-control-inline-padding);background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--base-shadow-width) var(--base-shadow-width) var(--base-shadow-blur) var(--nmorph-dark-shade-color),calc(-1 * var(--base-shadow-width)) calc(-1 * var(--base-shadow-width)) var(--base-shadow-blur) var(--nmorph-light-shade-color)}.nmorph-checkbox.nmorph--extra-thin-component{--nmorph-selection-control-font-size: var(--font-size-tiny);--nmorph-selection-control-line-height: var(--line-height-line);--nmorph-selection-control-inline-padding: var(--indentation-02)}.nmorph-checkbox.nmorph--thin-component{--nmorph-selection-control-font-size: var(--font-size-extra-small)}.nmorph-checkbox.nmorph--basic-component{--nmorph-selection-control-font-size: var(--font-size-small)}.nmorph-checkbox.nmorph--thick-component{--nmorph-selection-control-font-size: var(--font-size-base)}.nmorph-checkbox.nmorph-checkbox--checked .nmorph-checkbox__fake{background:var(--nmorph-main-color);box-shadow:inset var(--base-shadow-width) var(--base-shadow-width) var(--base-shadow-blur) var(--nmorph-dark-shade-color),inset calc(-1 * var(--base-shadow-width)) calc(-1 * var(--base-shadow-width)) var(--base-shadow-blur) var(--nmorph-light-shade-color)}.nmorph-checkbox.nmorph-checkbox--disabled{cursor:not-allowed;opacity:.6}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import './NmorphCheckbox.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { NmorphSelectionControlHeight as
|
|
5
|
-
|
|
2
|
+
import { defineComponent as x, inject as i, watch as S, ref as n, computed as d } from "vue";
|
|
3
|
+
import { useModifiers as q } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { NmorphSelectionControlHeight as V } from "../../../types/index.js";
|
|
5
|
+
import { useFormItemModel as C } from "../nmorph-form/use-form-item-input.js";
|
|
6
|
+
const H = /* @__PURE__ */ x({
|
|
6
7
|
__name: "NmorphCheckbox",
|
|
7
8
|
props: {
|
|
8
9
|
id: { type: String, required: !1, default: "" },
|
|
@@ -13,43 +14,44 @@ const j = /* @__PURE__ */ y({
|
|
|
13
14
|
height: { type: null, required: !1 }
|
|
14
15
|
},
|
|
15
16
|
emits: ["update:model-value"],
|
|
16
|
-
setup(
|
|
17
|
-
const
|
|
17
|
+
setup(g, { expose: b, emit: _ }) {
|
|
18
|
+
const o = i(
|
|
18
19
|
"checkbox-group-selected-value",
|
|
19
20
|
void 0
|
|
20
|
-
),
|
|
21
|
+
), u = i(
|
|
21
22
|
"change-checkbox-value-handler",
|
|
22
23
|
void 0
|
|
23
|
-
),
|
|
24
|
-
|
|
25
|
-
() =>
|
|
26
|
-
|
|
27
|
-
t.value = _;
|
|
28
|
-
}
|
|
24
|
+
), s = i("checkbox-group-height", void 0), e = g, c = _, { modelValue: l, updateModelValue: p } = C(
|
|
25
|
+
e,
|
|
26
|
+
(r) => c("update:model-value", r),
|
|
27
|
+
!1
|
|
29
28
|
);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
S(l, (r) => {
|
|
30
|
+
t.value = r;
|
|
31
|
+
});
|
|
32
|
+
const f = n(null);
|
|
33
|
+
b({ inputDOMRef: f });
|
|
34
|
+
const a = o !== void 0, t = a ? n(o.value) : n(l.value), h = d(() => a ? o.value.includes(e.id) : l.value), m = d(() => e.height || s?.value || "thin"), y = () => {
|
|
33
35
|
if (!e.disabled) {
|
|
34
|
-
if (!
|
|
35
|
-
t.value = !t.value, p(
|
|
36
|
+
if (!a) {
|
|
37
|
+
t.value = !t.value, p(t.value);
|
|
36
38
|
return;
|
|
37
39
|
}
|
|
38
|
-
|
|
40
|
+
u && Array.isArray(t.value) && u(e.id, t.value);
|
|
39
41
|
}
|
|
40
|
-
},
|
|
41
|
-
() =>
|
|
42
|
-
nmorph: [
|
|
42
|
+
}, k = d(
|
|
43
|
+
() => q({
|
|
44
|
+
nmorph: [V[m.value]],
|
|
43
45
|
"nmorph-checkbox": [
|
|
44
|
-
|
|
46
|
+
h.value && "checked",
|
|
45
47
|
e.disabled && "disabled",
|
|
46
48
|
e.design === "button" && "button"
|
|
47
49
|
]
|
|
48
50
|
})
|
|
49
|
-
),
|
|
50
|
-
return Object.defineProperty(
|
|
51
|
+
), v = { groupSelectedValue: o, changeValue: u, groupHeight: s, props: e, emit: c, modelValue: l, updateModelValue: p, inputDOMRef: f, hasGroup: a, initialValue: t, checked: h, height: m, handleChange: y, modifiers: k };
|
|
52
|
+
return Object.defineProperty(v, "__isScriptSetup", { enumerable: !1, value: !0 }), v;
|
|
51
53
|
}
|
|
52
54
|
});
|
|
53
55
|
export {
|
|
54
|
-
|
|
56
|
+
H as default
|
|
55
57
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import './NmorphCheckboxGroup.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import
|
|
5
|
-
|
|
2
|
+
import { defineComponent as g, ref as b, watch as v, computed as p, provide as u } from "vue";
|
|
3
|
+
import { useModifiers as y } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { useFormItemModel as q } from "../nmorph-form/use-form-item-input.js";
|
|
5
|
+
import x from "../nmorph-checkbox/NmorphCheckbox.vue.js";
|
|
6
|
+
const N = /* @__PURE__ */ g({
|
|
6
7
|
__name: "NmorphCheckboxGroup",
|
|
7
8
|
props: {
|
|
8
|
-
modelValue: { type: Array, required: !
|
|
9
|
+
modelValue: { type: Array, required: !1, default: () => [] },
|
|
9
10
|
options: { type: Array, required: !1, default: () => [] },
|
|
10
11
|
design: { type: String, required: !1, default: "button" },
|
|
11
12
|
direction: { type: null, required: !1, default: "row" },
|
|
@@ -17,30 +18,34 @@ const _ = /* @__PURE__ */ m({
|
|
|
17
18
|
tabindex: { type: Number, required: !1 }
|
|
18
19
|
},
|
|
19
20
|
emits: ["update:model-value"],
|
|
20
|
-
setup(
|
|
21
|
-
|
|
22
|
-
const r =
|
|
23
|
-
|
|
24
|
-
() =>
|
|
21
|
+
setup(s, { expose: c, emit: f }) {
|
|
22
|
+
c();
|
|
23
|
+
const r = s, a = f, { modelValue: o, updateModelValue: l } = q(
|
|
24
|
+
r,
|
|
25
|
+
(t) => a("update:model-value", t),
|
|
26
|
+
[]
|
|
27
|
+
), e = b([...o.value]);
|
|
28
|
+
v(
|
|
29
|
+
o,
|
|
25
30
|
(t) => {
|
|
26
31
|
e.value = [...t];
|
|
27
32
|
},
|
|
28
33
|
{ deep: !0 }
|
|
29
34
|
);
|
|
30
|
-
const
|
|
31
|
-
e.value = e.value.includes(t) ? e.value.filter((
|
|
32
|
-
},
|
|
33
|
-
() =>
|
|
35
|
+
const i = (t) => {
|
|
36
|
+
e.value = e.value.includes(t) ? e.value.filter((h) => h !== t) : [...e.value, t], l(e.value);
|
|
37
|
+
}, m = p(
|
|
38
|
+
() => y({
|
|
34
39
|
"nmorph-checkbox-group": [r.design, r.direction]
|
|
35
40
|
})
|
|
36
|
-
),
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
return
|
|
41
|
+
), d = p(() => r.height);
|
|
42
|
+
u("checkbox-group-selected-value", e), u("change-checkbox-value-handler", i), u("checkbox-group-height", d);
|
|
43
|
+
const n = { props: r, emit: a, modelValue: o, updateModelValue: l, initialValue: e, changeHandler: i, modifiers: m, height: d, get NmorphCheckbox() {
|
|
44
|
+
return x;
|
|
40
45
|
} };
|
|
41
|
-
return Object.defineProperty(
|
|
46
|
+
return Object.defineProperty(n, "__isScriptSetup", { enumerable: !1, value: !0 }), n;
|
|
42
47
|
}
|
|
43
48
|
});
|
|
44
49
|
export {
|
|
45
|
-
|
|
50
|
+
N as default
|
|
46
51
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import './NmorphColorPicker.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { NmorphComponentHeight as
|
|
4
|
-
import { useModifiers as
|
|
5
|
-
import { useFormItemInput as
|
|
6
|
-
const
|
|
2
|
+
import { defineComponent as k, ref as g, watch as B, onMounted as H, computed as _ } from "vue";
|
|
3
|
+
import { NmorphComponentHeight as L } from "../../../types/index.js";
|
|
4
|
+
import { useModifiers as O } from "../../../utils/create-modifiers.js";
|
|
5
|
+
import { useFormItemInput as z, useFormItemModel as A } from "../nmorph-form/use-form-item-input.js";
|
|
6
|
+
const G = /* @__PURE__ */ k({
|
|
7
7
|
__name: "NmorphColorPicker",
|
|
8
8
|
props: {
|
|
9
9
|
modelValue: { type: String, required: !1, default: "" },
|
|
@@ -17,51 +17,52 @@ const E = /* @__PURE__ */ R({
|
|
|
17
17
|
tabindex: { type: Number, required: !1 }
|
|
18
18
|
},
|
|
19
19
|
emits: ["update:model-value", "focus", "blur"],
|
|
20
|
-
setup(
|
|
21
|
-
const
|
|
20
|
+
setup(q, { expose: S, emit: V }) {
|
|
21
|
+
const n = q, b = V, { id: x, name: I, tabindex: F } = z(n), { modelValue: d, updateModelValue: y } = A(
|
|
22
|
+
n,
|
|
23
|
+
(e) => b("update:model-value", e),
|
|
24
|
+
""
|
|
25
|
+
), l = (e, r = "#000000") => {
|
|
22
26
|
const t = e?.trim() || "";
|
|
23
|
-
return /^#[\da-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[\da-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((
|
|
24
|
-
},
|
|
27
|
+
return /^#[\da-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[\da-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((o) => `${o}${o}`).join("").toLowerCase()}` : r;
|
|
28
|
+
}, p = g(null), m = () => {
|
|
25
29
|
if (typeof document > "u") return "#006cb6";
|
|
26
|
-
const e =
|
|
27
|
-
return
|
|
28
|
-
}, a =
|
|
29
|
-
|
|
30
|
-
()
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const r = e.target, t = s(r.value);
|
|
37
|
-
a.value = t, g("update:model-value", t);
|
|
38
|
-
}, p = (e) => [
|
|
30
|
+
const e = p.value || document.documentElement, r = getComputedStyle(e).getPropertyValue("--nmorph-accent-color").trim();
|
|
31
|
+
return l(r, "#006cb6");
|
|
32
|
+
}, a = g(l(d.value)), v = g(!1);
|
|
33
|
+
B(d, (e) => {
|
|
34
|
+
a.value = e ? l(e) : m();
|
|
35
|
+
});
|
|
36
|
+
const w = (e) => {
|
|
37
|
+
const r = e.target, t = l(r.value);
|
|
38
|
+
a.value = t, y(t);
|
|
39
|
+
}, f = (e) => [
|
|
39
40
|
parseInt(e.slice(1, 3), 16),
|
|
40
41
|
parseInt(e.slice(3, 5), 16),
|
|
41
42
|
parseInt(e.slice(5, 7), 16)
|
|
42
|
-
],
|
|
43
|
-
const [r, t,
|
|
44
|
-
return `rgb(${r}, ${t}, ${
|
|
45
|
-
},
|
|
46
|
-
const [r, t,
|
|
47
|
-
if (
|
|
48
|
-
return `hsl(0, 0%, ${Math.round(
|
|
49
|
-
const i =
|
|
50
|
-
let
|
|
51
|
-
return
|
|
43
|
+
], $ = (e) => {
|
|
44
|
+
const [r, t, o] = f(e);
|
|
45
|
+
return `rgb(${r}, ${t}, ${o})`;
|
|
46
|
+
}, M = (e) => {
|
|
47
|
+
const [r, t, o] = f(e).map((j) => j / 255), s = Math.max(r, t, o), u = Math.min(r, t, o), h = (s + u) / 2;
|
|
48
|
+
if (s === u)
|
|
49
|
+
return `hsl(0, 0%, ${Math.round(h * 100)}%)`;
|
|
50
|
+
const i = s - u, R = h > 0.5 ? i / (2 - s - u) : i / (s + u);
|
|
51
|
+
let c = 0;
|
|
52
|
+
return s === r ? c = (t - o) / i + (t < o ? 6 : 0) : s === t ? c = (o - r) / i + 2 : c = (r - t) / i + 4, `hsl(${Math.round(c * 60)}, ${Math.round(R * 100)}%, ${Math.round(h * 100)}%)`;
|
|
52
53
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}),
|
|
56
|
-
const
|
|
57
|
-
() =>
|
|
58
|
-
nmorph: [
|
|
59
|
-
"nmorph-color-picker": [
|
|
54
|
+
H(() => {
|
|
55
|
+
d.value || (a.value = m());
|
|
56
|
+
}), S({ inputDOMRef: p });
|
|
57
|
+
const N = _(
|
|
58
|
+
() => O({
|
|
59
|
+
nmorph: [L[n.height], v.value && "focused"],
|
|
60
|
+
"nmorph-color-picker": [n.disabled && "disabled", n.displayFormat]
|
|
60
61
|
})
|
|
61
|
-
),
|
|
62
|
-
return Object.defineProperty(
|
|
62
|
+
), P = _(() => n.displayFormat === "rgb" ? $(a.value) : n.displayFormat === "hsl" ? M(a.value) : a.value.toUpperCase()), C = { props: n, emit: b, id: x, name: I, tabindex: F, modelValue: d, updateModelValue: y, normalizeColor: l, inputDOMRef: p, resolveAccentColor: m, currentValue: a, focused: v, handleInput: w, hexToRgb: f, formatRgb: $, formatHsl: M, modifiers: N, displayValue: P };
|
|
63
|
+
return Object.defineProperty(C, "__isScriptSetup", { enumerable: !1, value: !0 }), C;
|
|
63
64
|
}
|
|
64
65
|
});
|
|
65
66
|
export {
|
|
66
|
-
|
|
67
|
+
G as default
|
|
67
68
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import './NmorphDatePicker.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { toCssSize as
|
|
5
|
-
import { NmorphComponentHeight as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { useI18n as
|
|
9
|
-
import { useFormItemInput as
|
|
10
|
-
import { formatDate as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
const
|
|
2
|
+
import { defineComponent as B, computed as a, ref as u, watch as M } from "vue";
|
|
3
|
+
import { useModifiers as V } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { toCssSize as m } from "../../../utils/common.js";
|
|
5
|
+
import { NmorphComponentHeight as P } from "../../../types/index.js";
|
|
6
|
+
import j from "./inner-components/nmorph-clear-button/NmorphClearButton.vue.js";
|
|
7
|
+
import z from "./inner-components/nmorph-date-picker-content/NmorphDatePickerContent.vue.js";
|
|
8
|
+
import { useI18n as L } from "vue-i18n";
|
|
9
|
+
import { useFormItemInput as R, useFormItemModel as T } from "../nmorph-form/use-form-item-input.js";
|
|
10
|
+
import { formatDate as c } from "../../data/nmorph-calendar/utils.js";
|
|
11
|
+
import E from "../../../assets/icons/calendar.svg.js";
|
|
12
|
+
import G from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
13
|
+
import J from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
|
|
14
|
+
const le = /* @__PURE__ */ B({
|
|
15
15
|
__name: "NmorphDatePicker",
|
|
16
16
|
props: {
|
|
17
17
|
placeholder: { type: String, required: !1, default: "" },
|
|
18
|
-
modelValue: { type: [Date, Array, null], required: !
|
|
18
|
+
modelValue: { type: [Date, Array, null], required: !1, default: null },
|
|
19
19
|
type: { type: null, required: !1, default: "date" },
|
|
20
20
|
textSeparator: { type: String, required: !1, default: "-" },
|
|
21
21
|
initialDate: { type: Date, required: !1, default: () => /* @__PURE__ */ new Date() },
|
|
@@ -36,25 +36,29 @@ const ee = /* @__PURE__ */ O({
|
|
|
36
36
|
tabindex: { type: Number, required: !1 }
|
|
37
37
|
},
|
|
38
38
|
emits: ["update:model-value"],
|
|
39
|
-
setup(
|
|
40
|
-
|
|
41
|
-
const { t:
|
|
39
|
+
setup(v, { expose: h, emit: y }) {
|
|
40
|
+
h();
|
|
41
|
+
const { t: p } = L(), e = v, { id: g, name: q, autocomplete: S } = R(e), n = a(() => e.placeholder ? e.placeholder : p("pickADate")), s = y, { modelValue: d, updateModelValue: i } = T(
|
|
42
|
+
e,
|
|
43
|
+
(r) => s("update:model-value", r),
|
|
44
|
+
null
|
|
45
|
+
), t = u(d.value), l = u(!1), N = () => {
|
|
42
46
|
l.value = !0;
|
|
43
|
-
},
|
|
47
|
+
}, D = () => {
|
|
44
48
|
l.value = !1;
|
|
45
|
-
},
|
|
46
|
-
() =>
|
|
47
|
-
nmorph: [
|
|
49
|
+
}, b = a(
|
|
50
|
+
() => V({
|
|
51
|
+
nmorph: [P[e.height]],
|
|
48
52
|
"nmorph-date-picker": [e.disabled && "disabled", e.type, l.value && "focus"]
|
|
49
53
|
})
|
|
50
|
-
),
|
|
51
|
-
...e.width !== void 0 && { "--width":
|
|
54
|
+
), C = a(() => ({
|
|
55
|
+
...e.width !== void 0 && { "--width": m(e.width) },
|
|
52
56
|
...e.calendarCellHeight !== void 0 && {
|
|
53
|
-
"--date-picker-calendar-cell-height":
|
|
57
|
+
"--date-picker-calendar-cell-height": m(e.calendarCellHeight)
|
|
54
58
|
}
|
|
55
|
-
})), o = u(!1),
|
|
59
|
+
})), o = u(!1), I = u(null), _ = () => {
|
|
56
60
|
o.value = !1;
|
|
57
|
-
},
|
|
61
|
+
}, w = () => {
|
|
58
62
|
o.value = !o.value;
|
|
59
63
|
}, A = a(() => {
|
|
60
64
|
if (!t.value) return n.value;
|
|
@@ -66,25 +70,33 @@ const ee = /* @__PURE__ */ O({
|
|
|
66
70
|
};
|
|
67
71
|
if (Array.isArray(t.value)) {
|
|
68
72
|
if (t.value.length === 0) return n.value;
|
|
69
|
-
const
|
|
70
|
-
return
|
|
73
|
+
const O = c(t.value, r), k = e.type === "daterange" ? e.rangeSeparator : e.valueSeparator;
|
|
74
|
+
return O.join(k);
|
|
71
75
|
} else
|
|
72
|
-
return
|
|
73
|
-
}),
|
|
76
|
+
return c(t.value, r);
|
|
77
|
+
}), F = () => {
|
|
74
78
|
const r = Array.isArray(t.value) ? [] : null;
|
|
75
|
-
t.value = r,
|
|
76
|
-
},
|
|
77
|
-
t.value = r,
|
|
78
|
-
}
|
|
79
|
-
|
|
79
|
+
t.value = r, i(t.value);
|
|
80
|
+
}, H = (r) => {
|
|
81
|
+
t.value = r, i(t.value);
|
|
82
|
+
};
|
|
83
|
+
M(
|
|
84
|
+
d,
|
|
85
|
+
(r) => {
|
|
86
|
+
t.value = r;
|
|
87
|
+
},
|
|
88
|
+
{ deep: !0 }
|
|
89
|
+
);
|
|
90
|
+
const x = a(() => Array.isArray(t.value) ? t.value.length > 0 : !!t.value), f = { t: p, props: e, id: g, name: q, autocomplete: S, placeholderText: n, emit: s, modelValue: d, updateModelValue: i, selectedDate: t, focus: l, focusHandler: N, blurHandler: D, modifiers: b, styles: C, open: o, nmorphInputDOMRef: I, closeHandler: _, toggleOpen: w, displayValue: A, clearHandler: F, updateSelectedDateHandler: H, showClearButton: x, get NmorphDropdown() {
|
|
91
|
+
return J;
|
|
80
92
|
}, get NmorphIcon() {
|
|
81
|
-
return
|
|
93
|
+
return G;
|
|
82
94
|
}, get NmorphIconCalendar() {
|
|
83
|
-
return
|
|
84
|
-
}, NmorphClearButton:
|
|
85
|
-
return Object.defineProperty(
|
|
95
|
+
return E;
|
|
96
|
+
}, NmorphClearButton: j, NmorphDatePickerContent: z };
|
|
97
|
+
return Object.defineProperty(f, "__isScriptSetup", { enumerable: !1, value: !0 }), f;
|
|
86
98
|
}
|
|
87
99
|
});
|
|
88
100
|
export {
|
|
89
|
-
|
|
101
|
+
le as default
|
|
90
102
|
};
|