@nmorph/nmorph-ui-kit 2.2.36 → 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.
Files changed (89) hide show
  1. package/dist/components/basic/nmorph-button/NmorphButton.vue2.js +8 -8
  2. package/dist/components/basic/nmorph-icon/NmorphIcon.vue2.js +3 -3
  3. package/dist/components/basic/nmorph-layout/NmorphLayout.vue2.js +14 -13
  4. package/dist/components/basic/nmorph-link/NmorphLink.vue2.js +1 -1
  5. package/dist/components/basic/nmorph-scroll/NmorphScroll.css +1 -0
  6. package/dist/components/basic/nmorph-scroll/NmorphScroll.vue.js +6 -4
  7. package/dist/components/basic/nmorph-scroll/NmorphScroll.vue2.js +1 -0
  8. package/dist/components/basic/nmorph-space/NmorphSpace.vue2.js +15 -19
  9. package/dist/components/data/nmorph-avatar/NmorphAvatar.css +1 -1
  10. package/dist/components/data/nmorph-avatar/NmorphAvatar.vue2.js +5 -5
  11. package/dist/components/data/nmorph-badge/NmorphBadge.vue2.js +37 -36
  12. package/dist/components/data/nmorph-calendar/NmorphCalendar.vue2.js +41 -40
  13. package/dist/components/data/nmorph-card/NmorphCard.vue2.js +15 -14
  14. package/dist/components/data/nmorph-collapse/components/nmorph-collapse-item/NmorphCollapseItem.vue2.js +5 -9
  15. package/dist/components/data/nmorph-empty/NmorphEmpty.vue.js +3 -3
  16. package/dist/components/data/nmorph-empty/NmorphEmpty.vue2.js +17 -14
  17. package/dist/components/data/nmorph-image/NmorphImage.css +1 -0
  18. package/dist/components/data/nmorph-image/NmorphImage.vue.js +14 -12
  19. package/dist/components/data/nmorph-image/NmorphImage.vue2.js +3 -2
  20. package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue2.js +36 -35
  21. package/dist/components/data/nmorph-pagination/NmorphPagination.vue2.js +1 -1
  22. package/dist/components/data/nmorph-progress/NmorphProgress.vue2.js +19 -18
  23. package/dist/components/data/nmorph-qr-code/NmorphQRCode.vue2.js +20 -19
  24. package/dist/components/data/nmorph-skeleton/NmorphSkeleton.vue2.js +1 -1
  25. package/dist/components/data/nmorph-table/NmorphTable.vue2.js +39 -43
  26. package/dist/components/data/nmorph-virtual-list/NmorphVirtualList.vue2.js +34 -33
  27. package/dist/components/feedback/nmorph-alert/NmorphAlert.vue2.js +1 -1
  28. package/dist/components/feedback/nmorph-callout/NmorphCallout.vue2.js +7 -6
  29. package/dist/components/feedback/nmorph-dialog/NmorphDialog.css +1 -1
  30. package/dist/components/feedback/nmorph-dialog/NmorphDialog.vue.js +25 -20
  31. package/dist/components/feedback/nmorph-dialog/NmorphDialog.vue2.js +37 -37
  32. package/dist/components/feedback/nmorph-drawer/NmorphDrawer.vue2.js +22 -21
  33. package/dist/components/feedback/nmorph-tooltip/NmorphTooltip.vue2.js +26 -25
  34. package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue2.js +54 -62
  35. package/dist/components/form/nmorph-checkbox/NmorphCheckbox.vue2.js +5 -5
  36. package/dist/components/form/nmorph-color-picker/NmorphColorPicker.vue2.js +5 -5
  37. package/dist/components/form/nmorph-date-picker/NmorphDatePicker.vue2.js +20 -19
  38. package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue2.js +7 -7
  39. package/dist/components/form/nmorph-form/components/nmorph-form-item/NmorphFormItem.vue2.js +2 -2
  40. package/dist/components/form/nmorph-form/components/nmorph-form-item/inner-components/nmorph-error-box/NmorphErrorBox.vue2.js +1 -1
  41. package/dist/components/form/nmorph-number-input/NmorphNumberInput.vue2.js +3 -6
  42. package/dist/components/form/nmorph-otp-input/NmorphOTPInput.vue2.js +6 -6
  43. package/dist/components/form/nmorph-radio/NmorphRadio.vue2.js +1 -1
  44. package/dist/components/form/nmorph-select/NmorphSelect.vue2.js +65 -73
  45. package/dist/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue2.js +4 -4
  46. package/dist/components/form/nmorph-select-button/NmorphSelectButton.vue2.js +18 -17
  47. package/dist/components/form/nmorph-select-button/components/nmorph-select-button-item/NmorphSelectButtonItem.vue2.js +1 -1
  48. package/dist/components/form/nmorph-slider/NmorphSlider.vue2.js +25 -24
  49. package/dist/components/form/nmorph-switch/NmorphSwitch.vue2.js +23 -22
  50. package/dist/components/form/nmorph-text-input/NmorphTextInput.css +1 -0
  51. package/dist/components/form/nmorph-text-input/NmorphTextInput.vue.js +4 -2
  52. package/dist/components/form/nmorph-text-input/NmorphTextInput.vue2.js +17 -19
  53. package/dist/components/form/nmorph-textarea/NmorphTextarea.vue2.js +9 -9
  54. package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue2.js +43 -42
  55. package/dist/components/navigation/nmorph-backtop/NmorphBacktop.vue2.js +1 -1
  56. package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue2.js +32 -31
  57. package/dist/components/navigation/nmorph-tabs/NmorphTabs.vue2.js +1 -1
  58. package/dist/components/others/nmorph-overlay/NmorphOverlay.vue2.js +1 -1
  59. package/dist/hooks/use-common-styles.js +18 -278
  60. package/dist/hooks/use-virtual-list.js +38 -32
  61. package/dist/index.umd.js +21 -281
  62. package/dist/package.json.js +1 -1
  63. package/dist/src/components/basic/nmorph-button/NmorphButton.vue.d.ts +1 -1
  64. package/dist/src/components/data/nmorph-collapse/components/nmorph-collapse-item/NmorphCollapseItem.vue.d.ts +1 -1
  65. package/dist/src/components/data/nmorph-pagination/NmorphPagination.vue.d.ts +1 -1
  66. package/dist/src/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.d.ts +1 -1
  67. package/dist/src/components/feedback/nmorph-dialog/NmorphDialog.vue.d.ts +4 -4
  68. package/dist/src/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.d.ts +1 -1
  69. package/dist/src/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue.d.ts +1 -1
  70. package/dist/src/components/form/nmorph-color-picker/NmorphColorPicker.vue.d.ts +1 -1
  71. package/dist/src/components/form/nmorph-date-picker/NmorphDatePicker.vue.d.ts +1 -1
  72. package/dist/src/components/form/nmorph-form/components/nmorph-form-item/NmorphFormItem.vue.d.ts +1 -1
  73. package/dist/src/components/form/nmorph-form/components/nmorph-form-item/inner-components/nmorph-error-box/NmorphErrorBox.vue.d.ts +1 -1
  74. package/dist/src/components/form/nmorph-number-input/NmorphNumberInput.vue.d.ts +1 -1
  75. package/dist/src/components/form/nmorph-otp-input/NmorphOTPInput.vue.d.ts +1 -1
  76. package/dist/src/components/form/nmorph-radio-group/NmorphRadioGroup.vue.d.ts +1 -1
  77. package/dist/src/components/form/nmorph-select/NmorphSelect.vue.d.ts +1 -1
  78. package/dist/src/components/form/nmorph-select-button/NmorphSelectButton.vue.d.ts +1 -1
  79. package/dist/src/components/form/nmorph-text-input/NmorphTextInput.vue.d.ts +1 -1
  80. package/dist/src/components/form/nmorph-textarea/NmorphTextarea.vue.d.ts +1 -1
  81. package/dist/src/components/form/nmorph-time-picker/NmorphTimePicker.vue.d.ts +1 -1
  82. package/dist/src/hooks/use-virtual-list.d.ts +6 -0
  83. package/dist/src/types/index.d.ts +2 -1
  84. package/dist/src/utils/common.d.ts +5 -0
  85. package/dist/src/utils/create-modifiers.d.ts +4 -2
  86. package/dist/style.css +1 -1
  87. package/dist/utils/common.js +9 -2
  88. package/dist/utils/create-modifiers.js +6 -6
  89. package/package.json +1 -1
@@ -1,10 +1,11 @@
1
1
  import './NmorphSwitch.css';
2
2
  import { defineComponent as q, ref as i, computed as n, watch as N } from "vue";
3
3
  import { useModifiers as V } from "../../../utils/create-modifiers.js";
4
+ import { toCssSize as a } from "../../../utils/common.js";
4
5
  import { useFormItemInput as _ } from "../nmorph-form/use-form-item-input.js";
5
6
  import w from "../../basic/nmorph-icon/NmorphIcon.vue.js";
6
7
  import H from "../../../assets/icons/loader.svg.js";
7
- const C = /* @__PURE__ */ q({
8
+ const M = /* @__PURE__ */ q({
8
9
  __name: "NmorphSwitch",
9
10
  props: {
10
11
  modelValue: { type: [Boolean, String, Number], required: !1, default: !1 },
@@ -23,39 +24,39 @@ const C = /* @__PURE__ */ q({
23
24
  },
24
25
  emits: ["update:model-value"],
25
26
  setup(s, { expose: f, emit: m }) {
26
- const e = s, { id: p, name: c, tabindex: h } = _(e), u = m, a = i(!1), g = () => {
27
- a.value = !0;
28
- }, v = () => {
29
- a.value = !1;
27
+ const e = s, { id: p, name: c, tabindex: h } = _(e), u = m, r = i(!1), v = () => {
28
+ r.value = !0;
29
+ }, g = () => {
30
+ r.value = !1;
30
31
  }, b = n(
31
32
  () => V({
32
33
  "nmorph-switch": [
33
- `${e.disabled && "disabled"}`,
34
- `${r.value ? "on" : "off"}`,
35
- `${e.loading && "loading"}`,
36
- `${a.value && "focus"}`
34
+ e.disabled && "disabled",
35
+ t.value ? "on" : "off",
36
+ e.loading && "loading",
37
+ r.value && "focus"
37
38
  ]
38
39
  })
39
- ), r = i(e.modelValue === e.activeValue), y = () => {
40
+ ), t = i(e.modelValue === e.activeValue), y = () => {
40
41
  if (e.disabled) return;
41
- r.value = !r.value;
42
- const t = r.value ? e.activeValue : e.inactiveValue;
43
- u("update:model-value", t);
42
+ t.value = !t.value;
43
+ const o = t.value ? e.activeValue : e.inactiveValue;
44
+ u("update:model-value", o);
44
45
  }, l = i(null);
45
46
  f({ inputDOMRef: l });
46
- const o = (t) => typeof t == "number" ? `${t}px` : t, S = n(() => ({
47
- ...e.width !== void 0 && { "--width": o(e.width) },
48
- ...e.height !== void 0 && { "--height": o(e.height) },
49
- ...e.offset !== void 0 && { "--offset": o(e.offset) },
50
- ...e.thumbHeight !== void 0 && { "--thumb-height": o(e.thumbHeight) }
47
+ const S = n(() => ({
48
+ ...e.width !== void 0 && { "--width": a(e.width) },
49
+ ...e.height !== void 0 && { "--height": a(e.height) },
50
+ ...e.offset !== void 0 && { "--offset": a(e.offset) },
51
+ ...e.thumbHeight !== void 0 && { "--thumb-height": a(e.thumbHeight) }
51
52
  }));
52
53
  N(
53
54
  () => e.modelValue,
54
- (t) => {
55
- r.value = t === e.activeValue;
55
+ (o) => {
56
+ t.value = o === e.activeValue;
56
57
  }
57
58
  );
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
+ const d = { props: e, id: p, name: c, tabindex: h, emit: u, focus: r, focusHandler: v, blurHandler: g, modifiers: b, initialValue: t, changeHandler: y, inputDOMRef: l, styles: S, get NmorphIcon() {
59
60
  return w;
60
61
  }, get NmorphIconLoaderDots() {
61
62
  return H;
@@ -64,5 +65,5 @@ const C = /* @__PURE__ */ q({
64
65
  }
65
66
  });
66
67
  export {
67
- C as default
68
+ M as default
68
69
  };
@@ -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);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,
@@ -64,7 +66,7 @@ function B(p, o, N, e, C, I) {
64
66
  /* CLASS, STYLE */
65
67
  );
66
68
  }
67
- const M = /* @__PURE__ */ x(s, [["render", B], ["__file", "/builds/ketjo/nmorph/library/src/components/form/nmorph-text-input/NmorphTextInput.vue"]]);
69
+ const z = /* @__PURE__ */ x(s, [["render", B], ["__file", "/builds/ketjo/nmorph/library/src/components/form/nmorph-text-input/NmorphTextInput.vue"]]);
68
70
  export {
69
- M as default
71
+ z as default
70
72
  };
@@ -1,13 +1,14 @@
1
+ import './NmorphTextInput.css';
1
2
  import { defineComponent as C, useSlots as E, computed as n, ref as l } from "vue";
2
3
  import { NmorphComponentHeight as O } from "../../../types/index.js";
3
- import { useModifiers as $ } from "../../../utils/create-modifiers.js";
4
- import { useFormItemInput as j } from "../nmorph-form/use-form-item-input.js";
5
- import F from "../../../assets/icons/eye-blocked.svg.js";
6
- import H from "../../../assets/icons/eye.svg.js";
7
- import M from "../../basic/nmorph-button/NmorphButton.vue.js";
8
- import A from "../../basic/nmorph-icon/NmorphIcon.vue.js";
9
- import D from "../../../assets/icons/error.svg.js";
10
- const U = /* @__PURE__ */ C({
4
+ import { useModifiers as j } from "../../../utils/create-modifiers.js";
5
+ import { useFormItemInput as F } from "../nmorph-form/use-form-item-input.js";
6
+ import H from "../../../assets/icons/eye-blocked.svg.js";
7
+ import M from "../../../assets/icons/eye.svg.js";
8
+ import A from "../../basic/nmorph-button/NmorphButton.vue.js";
9
+ import D from "../../basic/nmorph-icon/NmorphIcon.vue.js";
10
+ import R from "../../../assets/icons/error.svg.js";
11
+ const W = /* @__PURE__ */ C({
11
12
  __name: "NmorphTextInput",
12
13
  props: {
13
14
  placeholder: { type: String, required: !1, default: "" },
@@ -25,13 +26,10 @@ const U = /* @__PURE__ */ C({
25
26
  },
26
27
  emits: ["update:model-value", "focus", "blur", "on-enter", "keydown"],
27
28
  setup(f, { expose: m, emit: h }) {
28
- const s = E(), e = f, { id: y, name: b, autocomplete: v, tabindex: g } = j(e), q = n(
29
- () => $({
30
- nmorph: [O[e.height], `${a.value && "focused"}`],
31
- "nmorph-text-input": [
32
- `${e.typePassword && "password"}`,
33
- `${(e.typePassword || e.clearable) && "with-action"}`
34
- ]
29
+ const s = E(), e = f, { id: y, name: b, autocomplete: v, tabindex: g } = F(e), q = n(
30
+ () => j({
31
+ nmorph: [O[e.height], a.value && "focused"],
32
+ "nmorph-text-input": [e.typePassword && "password", (e.typePassword || e.clearable) && "with-action"]
35
33
  })
36
34
  ), w = (P) => {
37
35
  const k = P.target;
@@ -50,14 +48,14 @@ const U = /* @__PURE__ */ C({
50
48
  o.value?.select();
51
49
  };
52
50
  m({ inputDOMRef: o, focus: u, blur: p, select: i });
53
- const r = h, S = n(() => e.clearable ? D : t.value ? F : H), d = n(() => e.indentation || (s["prepend-icon"] ? "28px" : "8px")), B = n(() => ({ "--nmorph-text-input-indentation": d.value })), c = { slots: s, props: e, id: y, name: b, autocomplete: v, tabindex: g, modifiers: q, handleInput: w, showPassword: t, actionButtonClickHandler: x, type: I, focused: a, handleFocus: N, handleBlur: _, inputDOMRef: o, focus: u, blur: p, select: i, emit: r, actionIcon: S, indentation: d, styles: B, get NmorphIcon() {
54
- return A;
51
+ const r = h, S = n(() => e.clearable ? R : t.value ? H : M), d = n(() => e.indentation || (s["prepend-icon"] ? "28px" : "8px")), B = n(() => ({ "--nmorph-text-input-indentation": d.value })), c = { slots: s, props: e, id: y, name: b, autocomplete: v, tabindex: g, modifiers: q, handleInput: w, showPassword: t, actionButtonClickHandler: x, type: I, focused: a, handleFocus: N, handleBlur: _, inputDOMRef: o, focus: u, blur: p, select: i, emit: r, actionIcon: S, indentation: d, styles: B, get NmorphIcon() {
52
+ return D;
55
53
  }, get NmorphButton() {
56
- return M;
54
+ return A;
57
55
  } };
58
56
  return Object.defineProperty(c, "__isScriptSetup", { enumerable: !1, value: !0 }), c;
59
57
  }
60
58
  });
61
59
  export {
62
- U as default
60
+ W as default
63
61
  };
@@ -1,9 +1,9 @@
1
1
  import './NmorphTextarea.css';
2
2
  import { defineComponent as F, ref as h, computed as l, watch as B, onMounted as I, nextTick as T } from "vue";
3
- import { NmorphComponentHeight as $ } from "../../../types/index.js";
4
- import { useModifiers as O } from "../../../utils/create-modifiers.js";
5
- import { useFormItemInput as V } from "../nmorph-form/use-form-item-input.js";
6
- const D = /* @__PURE__ */ F({
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
7
  __name: "NmorphTextarea",
8
8
  props: {
9
9
  placeholder: { type: String, required: !1, default: "" },
@@ -24,10 +24,10 @@ const D = /* @__PURE__ */ F({
24
24
  },
25
25
  emits: ["update:model-value", "focus", "blur", "on-enter", "keydown"],
26
26
  setup(y, { expose: g, emit: x }) {
27
- const e = y, n = x, { id: b, name: w, autocomplete: q, tabindex: v } = V(e), a = h(null), s = h(!1), S = l(
28
- () => O({
29
- nmorph: [$[e.height], `${s.value && "focused"}`],
30
- "nmorph-textarea": [`${e.disabled && "disabled"}`, `${e.autoSize && "auto-size"}`]
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
31
  })
32
32
  ), i = (t) => {
33
33
  const o = window.getComputedStyle(t);
@@ -63,5 +63,5 @@ const D = /* @__PURE__ */ F({
63
63
  }
64
64
  });
65
65
  export {
66
- D as default
66
+ Y as default
67
67
  };
@@ -1,14 +1,15 @@
1
1
  import './NmorphTimePicker.css';
2
- import { defineComponent as ee, ref as g, computed as n, watch as te } from "vue";
3
- import { NmorphComponentHeight as _ } from "../../../types/index.js";
4
- import { useI18n as oe } from "vue-i18n";
5
- import { useModifiers as $ } from "../../../utils/create-modifiers.js";
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 se from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
11
- const Se = /* @__PURE__ */ ee({
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, s = k, { t: T } = oe(), { id: B, name: M, autocomplete: P, tabindex: z } = re(t), a = g(!1), c = g(!1), w = g(null), m = (e) => String(e).padStart(2, "0"), p = (e) => Math.max(1, Math.floor(Number.isFinite(e) ? e : 1)), i = (e) => {
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]), S = Number(o[2]), d = Number(o[3] || 0);
39
- return r > 23 || S > 59 || d > 59 ? null : { hour: r, minute: S, second: d };
40
- }, v = (e) => {
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)), x = n(() => i(t.modelValue)), u = g(x.value || { hour: 0, minute: 0, second: 0 }), V = n(() => t.placeholder || T("pickATime"));
44
- te(
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
- }, b = (e, o, r) => {
55
- const S = p(r), d = /* @__PURE__ */ new Set();
56
- for (let l = 0; l <= o; l += S) d.add(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
- }, D = n(() => b("hour", 23, t.hourStep)), A = n(() => b("minute", 59, t.minuteStep)), F = n(() => b("second", 59, t.secondStep)), R = (e, o) => {
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, s("update:model-value", v(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("update:model-value", null), a.value = !1;
72
+ s.value = !1;
70
73
  }, j = () => {
71
- a.value = !1;
74
+ t.disabled || (s.value = !s.value);
72
75
  }, E = () => {
73
- t.disabled || (a.value = !a.value);
76
+ c.value = !0, a("focus");
74
77
  }, G = () => {
75
- c.value = !0, s("focus");
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, s("update:model-value", v(r)));
81
- }, L = n(() => t.modelValue || V.value), Q = n(
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
- ), W = n(() => t.clearable && !!t.modelValue && !t.disabled), X = n(
84
- () => $({
85
- nmorph: [_[t.height]],
84
+ ), Q = n(() => t.clearable && !!t.modelValue && !t.disabled), W = n(
85
+ () => _({
86
+ nmorph: [C[t.height]],
86
87
  "nmorph-time-picker": [
87
- `${t.disabled && "disabled"}`,
88
- `${a.value && "open"}`,
89
- `${c.value && "focus"}`,
90
- `${!t.modelValue && "placeholder"}`
88
+ t.disabled && "disabled",
89
+ s.value && "open",
90
+ c.value && "focus",
91
+ !t.modelValue && "placeholder"
91
92
  ]
92
93
  })
93
- ), Y = n(
94
- () => $({
95
- nmorph: [_[t.height]]
94
+ ), X = n(
95
+ () => _({
96
+ nmorph: [C[t.height]]
96
97
  })
97
- ), I = (e) => typeof e == "number" ? `${e}px` : e, Z = n(() => ({
98
- ...t.width !== void 0 && { "--width": I(t.width) }
98
+ ), Y = n(() => ({
99
+ ...t.width !== void 0 && { "--width": oe(t.width) }
99
100
  }));
100
101
  H({ inputDOMRef: w });
101
- const C = { props: t, emit: s, t: T, id: B, name: M, autocomplete: P, tabindex: z, open: a, focused: c, inputDOMRef: w, pad: m, normalizeStep: p, parseTime: i, formatTime: v, timeToSeconds: f, minTimeParts: y, maxTimeParts: N, modelTimeParts: x, pickerValue: u, placeholderText: V, isOutsideRange: h, getUnitOptions: b, hourOptions: D, minuteOptions: A, secondOptions: F, selectUnit: R, clearHandler: U, closeHandler: j, toggleOpen: E, focusHandler: G, blurHandler: J, nativeInputHandler: K, displayValue: L, inputStep: Q, showClearButton: W, modifiers: X, optionHeightModifiers: Y, getCssSize: I, styles: Z, get NmorphDropdown() {
102
- return se;
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(C, "__isScriptSetup", { enumerable: !1, value: !0 }), C;
111
+ return Object.defineProperty(I, "__isScriptSetup", { enumerable: !1, value: !0 }), I;
111
112
  }
112
113
  });
113
114
  export {
114
- Se as default
115
+ ve as default
115
116
  };
@@ -20,7 +20,7 @@ const Y = /* @__PURE__ */ E({
20
20
  w();
21
21
  const t = b, s = y, g = v(
22
22
  () => q({
23
- "nmorph-backtop": [`${n.value && "show"}`, t.design]
23
+ "nmorph-backtop": [n.value && "show", t.design]
24
24
  })
25
25
  ), N = v(() => ({
26
26
  "--nmorph-backtop-right": `${t.right}px`,
@@ -1,9 +1,10 @@
1
1
  import './NmorphDropdown.css';
2
- import { defineComponent as w, ref as q, toRef as r, computed as n, watch as b } from "vue";
3
- import { useModifiers as v } from "../../../utils/create-modifiers.js";
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 k = /* @__PURE__ */ w({
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(f, { expose: m, emit: c }) {
29
- m();
30
- const e = f, l = c, i = q(null), { placementCoords: d, placementReady: a, adjustPlacement: s } = x({
31
- initialPlacement: r(e, "placement"),
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: r(e, "relativeElement"),
34
- yOffset: r(e, "yOffset"),
35
- xOffset: r(e, "xOffset"),
36
- enabled: r(e, "open")
37
- }), y = n(
38
- () => v({
39
- "nmorph-dropdown": [`${!e.open && "closed"}`, `${e.hideShadow && "hide-shadow"}`]
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
- ), o = (t) => typeof t == "number" ? `${t}px` : t, u = n(
42
- () => e.fillWidth && e.relativeElement ? `${e.relativeElement.clientWidth}px` : o(e.width)
43
- ), h = n(() => ({
44
- "--nmorph-dropdown-width": u.value,
45
- "--nmorph-dropdown-min-width": o(e.minWidth) || "auto",
46
- "--nmorph-dropdown-max-width": o(e.maxWidth) || "none",
47
- left: d.value.x,
48
- top: d.value.y,
49
- visibility: e.open && a.value ? "visible" : "hidden"
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
- b(
52
+ v(
52
53
  () => e.open,
53
- (t) => {
54
- t && s();
54
+ (y) => {
55
+ y && a();
55
56
  },
56
57
  { flush: "post" }
57
58
  );
58
- const p = { props: e, emit: l, dropdownDOMRef: i, placementCoords: d, placementReady: a, adjustPlacement: s, modifiers: y, getCssSize: o, width: u, dropdownStyle: h, outsideClickHandler: () => {
59
- l("on-outside-click");
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
- l("on-escape-keydown");
62
+ r("on-escape-keydown");
62
63
  }, get NmorphOverlay() {
63
64
  return O;
64
65
  } };
65
- return Object.defineProperty(p, "__isScriptSetup", { enumerable: !1, value: !0 }), p;
66
+ return Object.defineProperty(u, "__isScriptSetup", { enumerable: !1, value: !0 }), u;
66
67
  }
67
68
  });
68
69
  export {
69
- k as default
70
+ B as default
70
71
  };
@@ -15,7 +15,7 @@ const D = /* @__PURE__ */ b({
15
15
  d();
16
16
  const e = u, t = i, l = p(
17
17
  () => I({
18
- "nmorph-tabs": [`${e.stretch && "stretch"}`]
18
+ "nmorph-tabs": [e.stretch && "stretch"]
19
19
  })
20
20
  ), m = (n) => {
21
21
  if (n.disabled) return;
@@ -22,7 +22,7 @@ const L = /* @__PURE__ */ _({
22
22
  () => t.zIndex
23
23
  ), w = i(
24
24
  () => F({
25
- "nmorph-overlay": [`${t.show && "show"}`, `${t.transparent && "transparent"}`]
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");