@nmorph/nmorph-ui-kit 2.2.35 → 2.2.37
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/assets/icons/baseball.svg.js +28 -0
- package/dist/assets/icons/basketball.svg.js +21 -0
- package/dist/assets/icons/bowl.svg.js +21 -0
- package/dist/assets/icons/box.svg.js +35 -0
- package/dist/assets/icons/briefcase.svg.js +21 -0
- package/dist/assets/icons/brush-filled.svg.js +21 -0
- package/dist/assets/icons/brush.svg.js +21 -0
- package/dist/assets/icons/camera-filled.svg.js +21 -0
- package/dist/assets/icons/chevron-double-left.svg.js +28 -0
- package/dist/assets/icons/chevron-double-right.svg.js +28 -0
- package/dist/assets/icons/chevron-double-up.svg.js +28 -0
- package/dist/assets/icons/chevron-left.svg.js +21 -0
- package/dist/assets/icons/chevron-right.svg.js +21 -0
- package/dist/assets/icons/chevron-up.svg.js +21 -0
- package/dist/assets/icons/chicken.svg.js +21 -0
- package/dist/assets/icons/clipboard-check.svg.js +25 -0
- package/dist/assets/icons/clipboard.svg.js +25 -0
- package/dist/assets/icons/close-bold.svg.js +21 -0
- package/dist/assets/icons/cold-drink.svg.js +21 -0
- package/dist/assets/icons/comment.svg.js +21 -0
- package/dist/assets/icons/database.svg.js +25 -0
- package/dist/assets/icons/drag-handle.svg.js +21 -0
- package/dist/assets/icons/external-link.svg.js +28 -0
- package/dist/assets/icons/filter-off.svg.js +28 -0
- package/dist/assets/icons/fingerprint.svg.js +44 -0
- package/dist/assets/icons/folder-remove.svg.js +21 -0
- package/dist/assets/icons/goblet.svg.js +21 -0
- package/dist/assets/icons/ice-tea.svg.js +21 -0
- package/dist/assets/icons/inbox.svg.js +25 -0
- package/dist/assets/icons/mail.svg.js +25 -0
- package/dist/assets/icons/odometer.svg.js +35 -0
- package/dist/assets/icons/open.svg.js +28 -0
- package/dist/assets/icons/pagination.svg.js +8 -0
- package/dist/assets/icons/redo.svg.js +21 -0
- package/dist/assets/icons/save.svg.js +25 -0
- package/dist/assets/icons/server.svg.js +32 -0
- package/dist/assets/icons/shield-check.svg.js +25 -0
- package/dist/assets/icons/shield.svg.js +25 -0
- package/dist/assets/icons/sliders.svg.js +31 -0
- package/dist/assets/icons/stopwatch.svg.js +28 -0
- package/dist/assets/icons/suitcase-line.svg.js +22 -0
- package/dist/assets/icons/undo.svg.js +21 -0
- package/dist/assets/icons/video-camera.svg.js +21 -0
- package/dist/components/basic/nmorph-button/NmorphButton.vue.js +10 -10
- package/dist/components/basic/nmorph-button/NmorphButton.vue2.js +13 -13
- package/dist/components/basic/nmorph-icon/NmorphIcon.vue2.js +3 -3
- package/dist/components/basic/nmorph-icon/NmorphIcons.js +617 -529
- package/dist/components/basic/nmorph-layout/NmorphLayout.css +1 -0
- package/dist/components/basic/nmorph-layout/NmorphLayout.vue.js +50 -0
- package/dist/components/basic/nmorph-layout/NmorphLayout.vue2.js +29 -0
- 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.css +1 -0
- package/dist/components/basic/nmorph-space/NmorphSpace.vue.js +21 -0
- package/dist/components/basic/nmorph-space/NmorphSpace.vue2.js +41 -0
- package/dist/components/data/nmorph-avatar/NmorphAvatar.css +1 -1
- package/dist/components/data/nmorph-avatar/NmorphAvatar.vue.js +15 -15
- package/dist/components/data/nmorph-avatar/NmorphAvatar.vue2.js +6 -6
- 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 +15 -14
- 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.vue.js +31 -31
- package/dist/components/data/nmorph-pagination/NmorphPagination.vue2.js +36 -38
- package/dist/components/data/nmorph-progress/NmorphProgress.vue2.js +19 -18
- package/dist/components/data/nmorph-qr-code/NmorphQRCode.css +1 -0
- package/dist/components/data/nmorph-qr-code/NmorphQRCode.vue.js +59 -0
- package/dist/components/data/nmorph-qr-code/NmorphQRCode.vue2.js +51 -0
- package/dist/components/data/nmorph-qr-code/qr-code.js +568 -0
- 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.css +1 -0
- package/dist/components/data/nmorph-virtual-list/NmorphVirtualList.vue.js +86 -0
- package/dist/components/data/nmorph-virtual-list/NmorphVirtualList.vue2.js +61 -0
- 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.css +1 -0
- package/dist/components/feedback/nmorph-drawer/NmorphDrawer.vue.js +81 -0
- package/dist/components/feedback/nmorph-drawer/NmorphDrawer.vue2.js +48 -0
- package/dist/components/feedback/nmorph-tooltip/NmorphTooltip.vue2.js +26 -25
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.js +30 -30
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue2.js +59 -64
- package/dist/components/form/nmorph-checkbox/NmorphCheckbox.vue2.js +5 -5
- package/dist/components/form/nmorph-color-picker/NmorphColorPicker.vue2.js +5 -5
- package/dist/components/form/nmorph-date-picker/NmorphDatePicker.vue2.js +20 -19
- package/dist/components/form/nmorph-date-picker/inner-components/nmorph-date-picker-content/NmorphDatePickerContent.vue.js +13 -13
- package/dist/components/form/nmorph-date-picker/inner-components/nmorph-date-picker-content/NmorphDatePickerContent.vue2.js +28 -27
- package/dist/components/form/nmorph-date-picker/inner-components/nmorph-year-month-picker/NmorphYearMonthPicker.vue.js +16 -16
- package/dist/components/form/nmorph-date-picker/inner-components/nmorph-year-month-picker/NmorphYearMonthPicker.vue2.js +20 -17
- package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue2.js +7 -7
- package/dist/components/form/nmorph-form/components/nmorph-form-item/NmorphFormItem.vue2.js +2 -2
- 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-number-input/NmorphNumberInput.vue2.js +3 -6
- package/dist/components/form/nmorph-otp-input/NmorphOTPInput.vue.js +21 -21
- package/dist/components/form/nmorph-otp-input/NmorphOTPInput.vue2.js +92 -84
- package/dist/components/form/nmorph-radio/NmorphRadio.vue2.js +1 -1
- package/dist/components/form/nmorph-select/NmorphSelect.vue.js +5 -5
- package/dist/components/form/nmorph-select/NmorphSelect.vue2.js +66 -74
- 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 +18 -17
- 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 +25 -24
- package/dist/components/form/nmorph-switch/NmorphSwitch.vue.js +1 -1
- package/dist/components/form/nmorph-switch/NmorphSwitch.vue2.js +22 -21
- package/dist/components/form/nmorph-text-input/NmorphTextInput.css +1 -0
- package/dist/components/form/nmorph-text-input/NmorphTextInput.vue.js +4 -2
- package/dist/components/form/nmorph-text-input/NmorphTextInput.vue2.js +17 -19
- package/dist/components/form/nmorph-textarea/NmorphTextarea.css +1 -0
- package/dist/components/form/nmorph-textarea/NmorphTextarea.vue.js +41 -0
- package/dist/components/form/nmorph-textarea/NmorphTextarea.vue2.js +67 -0
- package/dist/components/form/nmorph-time-picker/NmorphTimePicker.css +1 -1
- package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue2.js +43 -42
- package/dist/components/navigation/nmorph-backtop/NmorphBacktop.vue2.js +38 -28
- 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-virtual-list.js +38 -32
- package/dist/icons.js +621 -533
- package/dist/index.es.js +780 -678
- package/dist/index.umd.js +25 -285
- package/dist/package.json.js +1 -1
- package/dist/src/components/basic/index.d.ts +2 -0
- package/dist/src/components/basic/nmorph-button/NmorphButton.vue.d.ts +1 -1
- package/dist/src/components/basic/nmorph-icon/NmorphIcons.d.ts +48 -3
- package/dist/src/components/basic/nmorph-layout/NmorphLayout.vue.d.ts +22 -0
- package/dist/src/components/basic/nmorph-space/NmorphSpace.vue.d.ts +33 -0
- package/dist/src/components/data/index.d.ts +4 -0
- package/dist/src/components/data/nmorph-collapse/components/nmorph-collapse-item/NmorphCollapseItem.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-pagination/NmorphPagination.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-qr-code/NmorphQRCode.vue.d.ts +34 -0
- package/dist/src/components/data/nmorph-qr-code/qr-code.d.ts +12 -0
- package/dist/src/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-virtual-list/NmorphVirtualList.vue.d.ts +46 -0
- package/dist/src/components/data/nmorph-virtual-list/types.d.ts +4 -0
- package/dist/src/components/feedback/index.d.ts +1 -0
- package/dist/src/components/feedback/nmorph-dialog/NmorphDialog.vue.d.ts +4 -4
- package/dist/src/components/feedback/nmorph-drawer/NmorphDrawer.vue.d.ts +40 -0
- package/dist/src/components/form/index.d.ts +1 -0
- 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 +2 -2
- 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 +1 -1
- package/dist/src/components/form/nmorph-date-picker/inner-components/nmorph-date-picker-content/NmorphDatePickerContent.vue.d.ts +2 -2
- 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-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 +2 -2
- 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 +48 -0
- package/dist/src/components/form/nmorph-time-picker/NmorphTimePicker.vue.d.ts +1 -1
- package/dist/src/components/navigation/nmorph-backtop/NmorphBacktop.vue.d.ts +1 -1
- package/dist/src/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.d.ts +1 -1
- package/dist/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue.d.ts +1 -1
- 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 -2
- package/dist/utils/create-modifiers.js +6 -6
- package/package.json +1 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import './NmorphTextarea.css';
|
|
2
|
+
import { defineComponent as F, ref as h, computed as l, watch as B, onMounted as I, nextTick as T } from "vue";
|
|
3
|
+
import { NmorphComponentHeight as O } from "../../../types/index.js";
|
|
4
|
+
import { useModifiers as V } from "../../../utils/create-modifiers.js";
|
|
5
|
+
import { useFormItemInput as j } from "../nmorph-form/use-form-item-input.js";
|
|
6
|
+
const Y = /* @__PURE__ */ F({
|
|
7
|
+
__name: "NmorphTextarea",
|
|
8
|
+
props: {
|
|
9
|
+
placeholder: { type: String, required: !1, default: "" },
|
|
10
|
+
modelValue: { type: String, required: !1, default: "" },
|
|
11
|
+
rows: { type: Number, required: !1, default: 3 },
|
|
12
|
+
minRows: { type: Number, required: !1, default: 2 },
|
|
13
|
+
maxRows: { type: Number, required: !1, default: void 0 },
|
|
14
|
+
resize: { type: String, required: !1, default: "vertical" },
|
|
15
|
+
autoSize: { type: Boolean, required: !1, default: !1 },
|
|
16
|
+
indentation: { type: String, required: !1, default: "12px" },
|
|
17
|
+
textareaAttrs: { type: Object, required: !1, default: () => ({}) },
|
|
18
|
+
id: { type: String, required: !1 },
|
|
19
|
+
name: { type: String, required: !1 },
|
|
20
|
+
autocomplete: { type: String, required: !1 },
|
|
21
|
+
height: { type: null, required: !1, default: "basic" },
|
|
22
|
+
disabled: { type: Boolean, required: !1, default: !1 },
|
|
23
|
+
tabindex: { type: Number, required: !1 }
|
|
24
|
+
},
|
|
25
|
+
emits: ["update:model-value", "focus", "blur", "on-enter", "keydown"],
|
|
26
|
+
setup(y, { expose: g, emit: x }) {
|
|
27
|
+
const e = y, n = x, { id: b, name: w, autocomplete: q, tabindex: v } = j(e), a = h(null), s = h(!1), S = l(
|
|
28
|
+
() => V({
|
|
29
|
+
nmorph: [O[e.height], s.value && "focused"],
|
|
30
|
+
"nmorph-textarea": [e.disabled && "disabled", e.autoSize && "auto-size"]
|
|
31
|
+
})
|
|
32
|
+
), i = (t) => {
|
|
33
|
+
const o = window.getComputedStyle(t);
|
|
34
|
+
return parseFloat(o.paddingTop) + parseFloat(o.paddingBottom);
|
|
35
|
+
}, r = async () => {
|
|
36
|
+
if (!e.autoSize) return;
|
|
37
|
+
await T();
|
|
38
|
+
const t = a.value;
|
|
39
|
+
if (!t) return;
|
|
40
|
+
t.style.height = "auto";
|
|
41
|
+
const o = window.getComputedStyle(t), N = parseFloat(o.lineHeight) || 20, c = e.maxRows ? e.maxRows * N + i(t) : 1 / 0, C = Math.min(t.scrollHeight, c);
|
|
42
|
+
t.style.height = `${C}px`, t.style.overflowY = t.scrollHeight > c ? "auto" : "hidden";
|
|
43
|
+
}, _ = (t) => {
|
|
44
|
+
const o = t.target;
|
|
45
|
+
n("update:model-value", o.value), r();
|
|
46
|
+
}, z = () => {
|
|
47
|
+
n("focus"), s.value = !0;
|
|
48
|
+
}, H = () => {
|
|
49
|
+
n("blur"), s.value = !1;
|
|
50
|
+
}, u = () => {
|
|
51
|
+
a.value?.focus();
|
|
52
|
+
}, d = () => {
|
|
53
|
+
a.value?.blur();
|
|
54
|
+
}, p = () => {
|
|
55
|
+
a.value?.select();
|
|
56
|
+
};
|
|
57
|
+
B(() => e.modelValue, r), I(r), g({ textareaDOMRef: a, focus: u, blur: d, select: p, resizeToContent: r });
|
|
58
|
+
const f = l(() => Math.max(e.minRows, 1)), R = l(() => Math.max(e.rows, f.value)), M = l(() => ({
|
|
59
|
+
"--nmorph-textarea-resize": e.autoSize ? "none" : e.resize,
|
|
60
|
+
"--nmorph-textarea-indentation": e.indentation
|
|
61
|
+
})), m = { props: e, emit: n, id: b, name: w, autocomplete: q, tabindex: v, textareaDOMRef: a, focused: s, modifiers: S, getVerticalPadding: i, resizeToContent: r, handleInput: _, handleFocus: z, handleBlur: H, focus: u, blur: d, select: p, minRows: f, rows: R, styles: M };
|
|
62
|
+
return Object.defineProperty(m, "__isScriptSetup", { enumerable: !1, value: !0 }), m;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
export {
|
|
66
|
+
Y as default
|
|
67
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.nmorph-time-picker{--width: 160px;position:relative;width:var(--width);height:var(--height)}.nmorph-time-picker .nmorph-time-picker__input{display:flex;align-items:center;height:100%;padding:0 var(--default-indentation-input);overflow:hidden;background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-outset);cursor:pointer}.nmorph-time-picker .nmorph-time-picker__native{position:absolute;width:0;height:0;padding:0;border:0;opacity:0;pointer-events:none}.nmorph-time-picker .nmorph-time-picker__clock-icon{flex:0 0 auto;margin-right:6px}.nmorph-time-picker .nmorph-time-picker__selected-value{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.nmorph-time-picker .nmorph-time-picker__clear{display:inline-flex;flex:0 0 auto;justify-content:center;align-items:center;width:18px;height:18px;padding:0;color:var(--nmorph-text-color);background:transparent;border:0;cursor:pointer}.nmorph-time-picker .nmorph-time-picker__panel{display:grid;grid-template-columns:minmax(
|
|
1
|
+
.nmorph-time-picker{--width: 160px;position:relative;width:var(--width);height:var(--height)}.nmorph-time-picker .nmorph-time-picker__input{display:flex;align-items:center;height:100%;padding:0 var(--default-indentation-input);overflow:hidden;background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-outset);cursor:pointer}.nmorph-time-picker .nmorph-time-picker__native{position:absolute;width:0;height:0;padding:0;border:0;opacity:0;pointer-events:none}.nmorph-time-picker .nmorph-time-picker__clock-icon{flex:0 0 auto;margin-right:6px}.nmorph-time-picker .nmorph-time-picker__selected-value{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.nmorph-time-picker .nmorph-time-picker__clear{display:inline-flex;flex:0 0 auto;justify-content:center;align-items:center;width:18px;height:18px;padding:0;color:var(--nmorph-text-color);background:transparent;border:0;cursor:pointer}.nmorph-time-picker .nmorph-time-picker__panel{display:grid;grid-template-columns:minmax(0,1fr) 8px minmax(0,1fr);gap:6px;align-items:start;padding:8px;color:var(--nmorph-text-color)}.nmorph-time-picker .nmorph-time-picker__panel--with-seconds{grid-template-columns:minmax(0,1fr) 8px minmax(0,1fr) 8px minmax(0,1fr)}.nmorph-time-picker .nmorph-time-picker__column{display:grid;grid-auto-flow:row;grid-auto-rows:var(--height);grid-template-columns:minmax(0,1fr);gap:4px;align-content:start;max-height:220px;padding:2px;overflow:hidden auto;scrollbar-gutter:stable}.nmorph-time-picker .nmorph-time-picker__separator{display:flex;justify-content:center;align-items:flex-start;min-width:8px;padding-top:calc((var(--height) - 1em) / 2 + 2px);color:var(--nmorph-semi-contrast-text-color);font-weight:700;line-height:1}.nmorph-time-picker .nmorph-time-picker__option{display:flex;justify-content:center;align-items:center;width:100%;min-width:0;min-height:var(--height);margin:0;padding:0 8px;color:var(--nmorph-text-color);font:inherit;line-height:1;background:transparent;border:0;border-radius:4px;box-shadow:none;cursor:pointer;appearance:none}.nmorph-time-picker .nmorph-time-picker__option:hover:not(:disabled),.nmorph-time-picker .nmorph-time-picker__option--active{color:var(--nmorph-focus-text-color);background:var(--nmorph-accent-color)}.nmorph-time-picker .nmorph-time-picker__option:focus-visible{outline:2px solid var(--nmorph-accent-color);outline-offset:1px}.nmorph-time-picker .nmorph-time-picker__option:disabled{cursor:not-allowed;opacity:.35}.nmorph-time-picker.nmorph-time-picker--open .nmorph-time-picker__input{box-shadow:var(--nmorph-shadow-inset)}.nmorph-time-picker.nmorph-time-picker--focus{outline:2px solid var(--nmorph-accent-color)}.nmorph-time-picker.nmorph-time-picker--placeholder .nmorph-time-picker__selected-value{color:var(--nmorph-placeholder-text-color)}.nmorph-time-picker.nmorph-time-picker--disabled{cursor:not-allowed;opacity:.6}.nmorph-time-picker.nmorph-time-picker--disabled .nmorph-time-picker__input{pointer-events:none}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import './NmorphTimePicker.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { NmorphComponentHeight as
|
|
4
|
-
import { useI18n as
|
|
5
|
-
import { useModifiers as
|
|
2
|
+
import { defineComponent as Z, ref as v, computed as n, watch as ee } from "vue";
|
|
3
|
+
import { NmorphComponentHeight as C } from "../../../types/index.js";
|
|
4
|
+
import { useI18n as te } from "vue-i18n";
|
|
5
|
+
import { useModifiers as _ } from "../../../utils/create-modifiers.js";
|
|
6
|
+
import { toCssSize as oe } from "../../../utils/common.js";
|
|
6
7
|
import { useFormItemInput as re } from "../nmorph-form/use-form-item-input.js";
|
|
7
8
|
import ne from "../../../assets/icons/clock.svg.js";
|
|
8
9
|
import le from "../../../assets/icons/circle-close.svg.js";
|
|
9
10
|
import ue from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
10
|
-
import
|
|
11
|
-
const
|
|
11
|
+
import ae from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
|
|
12
|
+
const ve = /* @__PURE__ */ Z({
|
|
12
13
|
__name: "NmorphTimePicker",
|
|
13
14
|
props: {
|
|
14
15
|
modelValue: { type: [String, null], required: !1, default: null },
|
|
@@ -31,17 +32,17 @@ const Se = /* @__PURE__ */ ee({
|
|
|
31
32
|
},
|
|
32
33
|
emits: ["update:model-value", "focus", "blur"],
|
|
33
34
|
setup(O, { expose: H, emit: k }) {
|
|
34
|
-
const t = O,
|
|
35
|
+
const t = O, a = k, { t: T } = te(), { id: B, name: M, autocomplete: P, tabindex: $ } = re(t), s = v(!1), c = v(!1), w = v(null), m = (e) => String(e).padStart(2, "0"), p = (e) => Math.max(1, Math.floor(Number.isFinite(e) ? e : 1)), i = (e) => {
|
|
35
36
|
if (!e) return null;
|
|
36
37
|
const o = e.match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/);
|
|
37
38
|
if (!o) return null;
|
|
38
|
-
const r = Number(o[1]),
|
|
39
|
-
return r > 23 ||
|
|
40
|
-
},
|
|
39
|
+
const r = Number(o[1]), b = Number(o[2]), d = Number(o[3] || 0);
|
|
40
|
+
return r > 23 || b > 59 || d > 59 ? null : { hour: r, minute: b, second: d };
|
|
41
|
+
}, g = (e) => {
|
|
41
42
|
const o = `${m(e.hour)}:${m(e.minute)}`;
|
|
42
43
|
return t.showSeconds ? `${o}:${m(e.second)}` : o;
|
|
43
|
-
}, f = (e) => e.hour * 3600 + e.minute * 60 + e.second, y = n(() => i(t.minTime)), N = n(() => i(t.maxTime)),
|
|
44
|
-
|
|
44
|
+
}, f = (e) => e.hour * 3600 + e.minute * 60 + e.second, y = n(() => i(t.minTime)), N = n(() => i(t.maxTime)), V = n(() => i(t.modelValue)), u = v(V.value || { hour: 0, minute: 0, second: 0 }), x = n(() => t.placeholder || T("pickATime"));
|
|
45
|
+
ee(
|
|
45
46
|
() => t.modelValue,
|
|
46
47
|
(e) => {
|
|
47
48
|
const o = i(e);
|
|
@@ -51,9 +52,9 @@ const Se = /* @__PURE__ */ ee({
|
|
|
51
52
|
const h = (e) => {
|
|
52
53
|
const o = f(e);
|
|
53
54
|
return !!(y.value && o < f(y.value) || N.value && o > f(N.value));
|
|
54
|
-
},
|
|
55
|
-
const
|
|
56
|
-
for (let l = 0; l <= o; l +=
|
|
55
|
+
}, S = (e, o, r) => {
|
|
56
|
+
const b = p(r), d = /* @__PURE__ */ new Set();
|
|
57
|
+
for (let l = 0; l <= o; l += b) d.add(l);
|
|
57
58
|
return d.add(u.value[e]), Array.from(d).filter((l) => l >= 0 && l <= o).sort((l, q) => l - q).map((l) => {
|
|
58
59
|
const q = { ...u.value, [e]: l };
|
|
59
60
|
return {
|
|
@@ -62,44 +63,44 @@ const Se = /* @__PURE__ */ ee({
|
|
|
62
63
|
disabled: h(q)
|
|
63
64
|
};
|
|
64
65
|
});
|
|
65
|
-
},
|
|
66
|
+
}, z = n(() => S("hour", 23, t.hourStep)), D = n(() => S("minute", 59, t.minuteStep)), A = n(() => S("second", 59, t.secondStep)), F = (e, o) => {
|
|
66
67
|
const r = { ...u.value, [e]: o };
|
|
67
|
-
h(r) || (u.value = r,
|
|
68
|
+
h(r) || (u.value = r, a("update:model-value", g(r)));
|
|
69
|
+
}, R = () => {
|
|
70
|
+
a("update:model-value", null), s.value = !1;
|
|
68
71
|
}, U = () => {
|
|
69
|
-
s
|
|
72
|
+
s.value = !1;
|
|
70
73
|
}, j = () => {
|
|
71
|
-
|
|
74
|
+
t.disabled || (s.value = !s.value);
|
|
72
75
|
}, E = () => {
|
|
73
|
-
|
|
76
|
+
c.value = !0, a("focus");
|
|
74
77
|
}, G = () => {
|
|
75
|
-
c.value = !
|
|
76
|
-
}, J = () => {
|
|
77
|
-
c.value = !1, s("blur");
|
|
78
|
-
}, K = (e) => {
|
|
78
|
+
c.value = !1, a("blur");
|
|
79
|
+
}, J = (e) => {
|
|
79
80
|
const o = e.target, r = i(o.value);
|
|
80
|
-
!r || h(r) || (u.value = r,
|
|
81
|
-
},
|
|
81
|
+
!r || h(r) || (u.value = r, a("update:model-value", g(r)));
|
|
82
|
+
}, K = n(() => t.modelValue || x.value), L = n(
|
|
82
83
|
() => t.showSeconds ? p(t.secondStep) : p(t.minuteStep) * 60
|
|
83
|
-
),
|
|
84
|
-
() =>
|
|
85
|
-
nmorph: [
|
|
84
|
+
), Q = n(() => t.clearable && !!t.modelValue && !t.disabled), W = n(
|
|
85
|
+
() => _({
|
|
86
|
+
nmorph: [C[t.height]],
|
|
86
87
|
"nmorph-time-picker": [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
t.disabled && "disabled",
|
|
89
|
+
s.value && "open",
|
|
90
|
+
c.value && "focus",
|
|
91
|
+
!t.modelValue && "placeholder"
|
|
91
92
|
]
|
|
92
93
|
})
|
|
93
|
-
),
|
|
94
|
-
() =>
|
|
95
|
-
nmorph: [
|
|
94
|
+
), X = n(
|
|
95
|
+
() => _({
|
|
96
|
+
nmorph: [C[t.height]]
|
|
96
97
|
})
|
|
97
|
-
),
|
|
98
|
-
...t.width !== void 0 && { "--width":
|
|
98
|
+
), Y = n(() => ({
|
|
99
|
+
...t.width !== void 0 && { "--width": oe(t.width) }
|
|
99
100
|
}));
|
|
100
101
|
H({ inputDOMRef: w });
|
|
101
|
-
const
|
|
102
|
-
return
|
|
102
|
+
const I = { props: t, emit: a, t: T, id: B, name: M, autocomplete: P, tabindex: $, open: s, focused: c, inputDOMRef: w, pad: m, normalizeStep: p, parseTime: i, formatTime: g, timeToSeconds: f, minTimeParts: y, maxTimeParts: N, modelTimeParts: V, pickerValue: u, placeholderText: x, isOutsideRange: h, getUnitOptions: S, hourOptions: z, minuteOptions: D, secondOptions: A, selectUnit: F, clearHandler: R, closeHandler: U, toggleOpen: j, focusHandler: E, blurHandler: G, nativeInputHandler: J, displayValue: K, inputStep: L, showClearButton: Q, modifiers: W, optionHeightModifiers: X, styles: Y, get NmorphDropdown() {
|
|
103
|
+
return ae;
|
|
103
104
|
}, get NmorphIcon() {
|
|
104
105
|
return ue;
|
|
105
106
|
}, get NmorphIconCircleClose() {
|
|
@@ -107,9 +108,9 @@ const Se = /* @__PURE__ */ ee({
|
|
|
107
108
|
}, get NmorphIconClock() {
|
|
108
109
|
return ne;
|
|
109
110
|
} };
|
|
110
|
-
return Object.defineProperty(
|
|
111
|
+
return Object.defineProperty(I, "__isScriptSetup", { enumerable: !1, value: !0 }), I;
|
|
111
112
|
}
|
|
112
113
|
});
|
|
113
114
|
export {
|
|
114
|
-
|
|
115
|
+
ve as default
|
|
115
116
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import './NmorphBacktop.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
const
|
|
2
|
+
import { defineComponent as E, computed as v, ref as l, onMounted as T, onUnmounted as k } from "vue";
|
|
3
|
+
import { useModifiers as q } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import x from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
5
|
+
import I from "../../basic/nmorph-button/NmorphButton.vue.js";
|
|
6
|
+
import B from "../../../assets/icons/chevron-down.svg.js";
|
|
7
|
+
const Y = /* @__PURE__ */ E({
|
|
8
8
|
__name: "NmorphBacktop",
|
|
9
9
|
props: {
|
|
10
10
|
right: { type: Number, required: !1, default: 40 },
|
|
@@ -16,42 +16,52 @@ const M = /* @__PURE__ */ y({
|
|
|
16
16
|
teleportDisabled: { type: Boolean, required: !1, default: !1 }
|
|
17
17
|
},
|
|
18
18
|
emits: ["click"],
|
|
19
|
-
setup(
|
|
20
|
-
|
|
21
|
-
const t =
|
|
22
|
-
() =>
|
|
23
|
-
"nmorph-backtop": [
|
|
19
|
+
setup(b, { expose: w, emit: y }) {
|
|
20
|
+
w();
|
|
21
|
+
const t = b, s = y, g = v(
|
|
22
|
+
() => q({
|
|
23
|
+
"nmorph-backtop": [n.value && "show", t.design]
|
|
24
24
|
})
|
|
25
|
-
),
|
|
25
|
+
), N = v(() => ({
|
|
26
26
|
"--nmorph-backtop-right": `${t.right}px`,
|
|
27
27
|
"--nmorph-backtop-bottom": `${t.bottom}px`,
|
|
28
28
|
"--nmorph-backtop-z-index": t.zIndex
|
|
29
|
-
})),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
})), u = (r) => r === window, c = (r) => u(r) ? window.scrollY || document.documentElement.scrollTop || document.body.scrollTop || 0 : r.scrollTop, a = (r) => {
|
|
30
|
+
let o = r?.parentElement ?? null;
|
|
31
|
+
for (; o; ) {
|
|
32
|
+
const h = window.getComputedStyle(o), _ = h.overflowY || h.overflow;
|
|
33
|
+
if (["auto", "scroll", "overlay"].includes(_) && o.scrollHeight > o.clientHeight) return o;
|
|
34
|
+
o = o.parentElement;
|
|
35
|
+
}
|
|
36
|
+
return window;
|
|
37
|
+
}, e = l(null), p = l(null), m = l(null), n = l(!1), d = l(!1), i = () => {
|
|
38
|
+
if (!e.value) {
|
|
39
|
+
n.value = !1;
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
n.value = c(e.value) > t.visibilityHeight;
|
|
43
|
+
}, S = () => {
|
|
44
|
+
s("click"), e.value && e.value.scrollTo({
|
|
35
45
|
top: 0,
|
|
36
46
|
left: 0,
|
|
37
47
|
behavior: "smooth"
|
|
38
48
|
});
|
|
39
49
|
};
|
|
40
|
-
|
|
41
|
-
e.value =
|
|
42
|
-
}),
|
|
43
|
-
e.value && e.value
|
|
50
|
+
T(() => {
|
|
51
|
+
e.value = a(p.value ?? m.value), e.value.addEventListener("scroll", i), i(), d.value = !0;
|
|
52
|
+
}), k(() => {
|
|
53
|
+
e.value && e.value.removeEventListener("scroll", i);
|
|
44
54
|
});
|
|
45
|
-
const
|
|
46
|
-
return
|
|
55
|
+
const f = { props: t, emit: s, modifiers: g, styles: N, isWindow: u, getScrollTop: c, findScrollableAncestor: a, container: e, placeholderDOMEl: p, selfDOMEl: m, showButton: n, isMounted: d, updateVisibility: i, scrollToTopHandler: S, get NmorphButton() {
|
|
56
|
+
return I;
|
|
47
57
|
}, get NmorphIcon() {
|
|
48
|
-
return
|
|
58
|
+
return x;
|
|
49
59
|
}, get NmorphIconChevronDown() {
|
|
50
|
-
return
|
|
60
|
+
return B;
|
|
51
61
|
} };
|
|
52
|
-
return Object.defineProperty(
|
|
62
|
+
return Object.defineProperty(f, "__isScriptSetup", { enumerable: !1, value: !0 }), f;
|
|
53
63
|
}
|
|
54
64
|
});
|
|
55
65
|
export {
|
|
56
|
-
|
|
66
|
+
Y as default
|
|
57
67
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import './NmorphDropdown.css';
|
|
2
|
-
import { defineComponent as w, ref as q, toRef as
|
|
3
|
-
import { useModifiers as
|
|
2
|
+
import { defineComponent as w, ref as q, toRef as t, computed as l, watch as v } from "vue";
|
|
3
|
+
import { useModifiers as b } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { toCssSize as d } from "../../../utils/common.js";
|
|
4
5
|
import { usePlacement as x } from "../../../hooks/use-placement.js";
|
|
5
6
|
import O from "../../others/nmorph-overlay/NmorphOverlay.vue.js";
|
|
6
|
-
const
|
|
7
|
+
const B = /* @__PURE__ */ w({
|
|
7
8
|
__name: "NmorphDropdown",
|
|
8
9
|
props: {
|
|
9
10
|
open: { type: Boolean, required: !0 },
|
|
@@ -25,46 +26,46 @@ const k = /* @__PURE__ */ w({
|
|
|
25
26
|
hideShadow: { type: Boolean, required: !1, default: !1 }
|
|
26
27
|
},
|
|
27
28
|
emits: ["on-outside-click", "on-escape-keydown"],
|
|
28
|
-
setup(
|
|
29
|
-
|
|
30
|
-
const e =
|
|
31
|
-
initialPlacement:
|
|
29
|
+
setup(p, { expose: f, emit: m }) {
|
|
30
|
+
f();
|
|
31
|
+
const e = p, r = m, i = q(null), { placementCoords: o, placementReady: n, adjustPlacement: a } = x({
|
|
32
|
+
initialPlacement: t(e, "placement"),
|
|
32
33
|
contentDOMElement: i,
|
|
33
|
-
relativeElement:
|
|
34
|
-
yOffset:
|
|
35
|
-
xOffset:
|
|
36
|
-
enabled:
|
|
37
|
-
}),
|
|
38
|
-
() =>
|
|
39
|
-
"nmorph-dropdown": [
|
|
34
|
+
relativeElement: t(e, "relativeElement"),
|
|
35
|
+
yOffset: t(e, "yOffset"),
|
|
36
|
+
xOffset: t(e, "xOffset"),
|
|
37
|
+
enabled: t(e, "open")
|
|
38
|
+
}), c = l(
|
|
39
|
+
() => b({
|
|
40
|
+
"nmorph-dropdown": [!e.open && "closed", e.hideShadow && "hide-shadow"]
|
|
40
41
|
})
|
|
41
|
-
),
|
|
42
|
-
() => e.fillWidth && e.relativeElement ? `${e.relativeElement.clientWidth}px` :
|
|
43
|
-
), h =
|
|
44
|
-
"--nmorph-dropdown-width":
|
|
45
|
-
"--nmorph-dropdown-min-width":
|
|
46
|
-
"--nmorph-dropdown-max-width":
|
|
47
|
-
left:
|
|
48
|
-
top:
|
|
49
|
-
visibility: e.open &&
|
|
42
|
+
), s = l(
|
|
43
|
+
() => e.fillWidth && e.relativeElement ? `${e.relativeElement.clientWidth}px` : d(e.width)
|
|
44
|
+
), h = l(() => ({
|
|
45
|
+
"--nmorph-dropdown-width": s.value,
|
|
46
|
+
"--nmorph-dropdown-min-width": d(e.minWidth) || "auto",
|
|
47
|
+
"--nmorph-dropdown-max-width": d(e.maxWidth) || "none",
|
|
48
|
+
left: o.value.x,
|
|
49
|
+
top: o.value.y,
|
|
50
|
+
visibility: e.open && n.value ? "visible" : "hidden"
|
|
50
51
|
}));
|
|
51
|
-
|
|
52
|
+
v(
|
|
52
53
|
() => e.open,
|
|
53
|
-
(
|
|
54
|
-
|
|
54
|
+
(y) => {
|
|
55
|
+
y && a();
|
|
55
56
|
},
|
|
56
57
|
{ flush: "post" }
|
|
57
58
|
);
|
|
58
|
-
const
|
|
59
|
-
|
|
59
|
+
const u = { props: e, emit: r, dropdownDOMRef: i, placementCoords: o, placementReady: n, adjustPlacement: a, modifiers: c, width: s, dropdownStyle: h, outsideClickHandler: () => {
|
|
60
|
+
r("on-outside-click");
|
|
60
61
|
}, escapeHandler: () => {
|
|
61
|
-
|
|
62
|
+
r("on-escape-keydown");
|
|
62
63
|
}, get NmorphOverlay() {
|
|
63
64
|
return O;
|
|
64
65
|
} };
|
|
65
|
-
return Object.defineProperty(
|
|
66
|
+
return Object.defineProperty(u, "__isScriptSetup", { enumerable: !1, value: !0 }), u;
|
|
66
67
|
}
|
|
67
68
|
});
|
|
68
69
|
export {
|
|
69
|
-
|
|
70
|
+
B as default
|
|
70
71
|
};
|
|
@@ -22,7 +22,7 @@ const L = /* @__PURE__ */ _({
|
|
|
22
22
|
() => t.zIndex
|
|
23
23
|
), w = i(
|
|
24
24
|
() => F({
|
|
25
|
-
"nmorph-overlay": [
|
|
25
|
+
"nmorph-overlay": [t.show && "show", t.transparent && "transparent"]
|
|
26
26
|
})
|
|
27
27
|
), k = i(() => t.disabledTeleport || !t.show || typeof document > "u"), x = () => {
|
|
28
28
|
s("on-outside-click");
|