@nmorph/nmorph-ui-kit 2.2.12 → 2.2.13

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 (53) hide show
  1. package/README.md +11 -7
  2. package/dist/components/basic/nmorph-icon/NmorphIcon.css +1 -1
  3. package/dist/components/basic/nmorph-icon/NmorphIcon.vue2.js +11 -11
  4. package/dist/components/data/nmorph-pagination/NmorphPagination.css +1 -1
  5. package/dist/components/data/nmorph-pagination/NmorphPagination.vue.js +13 -12
  6. package/dist/components/data/nmorph-pagination/NmorphPagination.vue2.js +46 -40
  7. package/dist/components/data/nmorph-table/NmorphTable.css +1 -1
  8. package/dist/components/data/nmorph-table/NmorphTable.vue.js +228 -103
  9. package/dist/components/data/nmorph-table/NmorphTable.vue2.js +49 -30
  10. package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.css +1 -1
  11. package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.js +91 -35
  12. package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue2.js +48 -35
  13. package/dist/components/form/nmorph-checkbox/NmorphCheckbox.css +1 -1
  14. package/dist/components/form/nmorph-color-picker/NmorphColorPicker.vue2.js +11 -10
  15. package/dist/components/form/nmorph-radio/NmorphRadio.css +1 -1
  16. package/dist/components/form/nmorph-select/NmorphSelect.css +1 -1
  17. package/dist/components/form/nmorph-select/NmorphSelect.vue.js +115 -58
  18. package/dist/components/form/nmorph-select/NmorphSelect.vue2.js +104 -75
  19. package/dist/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue2.js +12 -10
  20. package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue.js +29 -42
  21. package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue2.js +39 -20
  22. package/dist/components/others/nmorph-overlay/NmorphOverlay.vue.js +29 -24
  23. package/dist/components/others/nmorph-overlay/NmorphOverlay.vue2.js +17 -15
  24. package/dist/hooks/use-common-styles.js +16 -12
  25. package/dist/hooks/use-placement.js +76 -44
  26. package/dist/hooks/use-virtual-list.js +46 -0
  27. package/dist/index.es.js +22 -19
  28. package/dist/index.umd.js +38 -29
  29. package/dist/nuxt.mjs +21 -37
  30. package/dist/outside-hooks/use-nmorph-browser.js +9 -9
  31. package/dist/outside-hooks/use-nmorph-theme.js +133 -87
  32. package/dist/package.json.js +1 -1
  33. package/dist/plugin.js +31 -27
  34. package/dist/src/components/data/nmorph-table/NmorphTable.vue.d.ts +9 -0
  35. package/dist/src/components/data/nmorph-table/types.d.ts +2 -2
  36. package/dist/src/components/feedback/nmorph-tooltip/NmorphTooltip.vue.d.ts +1 -1
  37. package/dist/src/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.d.ts +11 -0
  38. package/dist/src/components/form/nmorph-select/NmorphSelect.vue.d.ts +8 -0
  39. package/dist/src/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue.d.ts +1 -0
  40. package/dist/src/components/form/nmorph-select/types.d.ts +1 -0
  41. package/dist/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue.d.ts +3 -1
  42. package/dist/src/components/others/nmorph-overlay/NmorphOverlay.vue.d.ts +4 -0
  43. package/dist/src/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.d.ts +1 -1
  44. package/dist/src/hooks/index.d.ts +1 -0
  45. package/dist/src/hooks/use-common-styles.d.ts +1 -0
  46. package/dist/src/hooks/use-placement.d.ts +8 -4
  47. package/dist/src/hooks/use-virtual-list.d.ts +21 -0
  48. package/dist/src/outside-hooks/use-nmorph-notification.d.ts +2 -2
  49. package/dist/src/outside-hooks/use-nmorph-theme.d.ts +1 -0
  50. package/dist/src/plugin.d.ts +2 -0
  51. package/dist/src/types/index.d.ts +3 -1
  52. package/dist/style.css +1 -1
  53. package/package.json +1 -1
@@ -1,30 +1,30 @@
1
1
  import './NmorphSelect.css';
2
- import p from "./NmorphSelect.vue2.js";
3
- import { openBlock as o, createElementBlock as r, normalizeClass as v, createElementVNode as i, withKeys as t, Fragment as a, renderList as d, withModifiers as w, toDisplayString as h, createBlock as l, mergeProps as m, createVNode as s, withCtx as c, renderSlot as k, createCommentVNode as g } from "vue";
2
+ import y from "./NmorphSelect.vue2.js";
3
+ import { openBlock as o, createElementBlock as r, normalizeClass as g, createElementVNode as t, withKeys as a, Fragment as i, renderList as c, withModifiers as u, toDisplayString as _, createBlock as n, mergeProps as d, createVNode as v, withCtx as h, normalizeStyle as s, renderSlot as w, createCommentVNode as k } from "vue";
4
4
  /* empty css */
5
- import y from "../../../_virtual/_plugin-vue_export-helper.js";
6
- const N = { class: "nmorph-select__content" }, b = ["id", "name", "autocomplete", "tabindex", "disabled"], x = ["value"], O = {
5
+ import x from "../../../_virtual/_plugin-vue_export-helper.js";
6
+ const N = { class: "nmorph-select__content" }, S = ["id", "name", "autocomplete", "tabindex", "disabled"], b = ["value"], H = {
7
7
  key: 0,
8
8
  class: "nmorph-select__selected-value"
9
- }, D = {
9
+ }, O = {
10
10
  key: 1,
11
11
  class: "nmorph-select__selected-value"
12
- }, H = {
12
+ }, C = {
13
13
  key: 2,
14
14
  class: "nmorph-select__selected-value"
15
- }, u = {
15
+ }, D = {
16
16
  ref: "optionsDOMRef",
17
17
  class: "nmorph-select__options"
18
18
  };
19
- function C(_, I, f, e, S, M) {
19
+ function I(f, m, p, e, M, z) {
20
20
  return o(), r(
21
21
  "div",
22
22
  {
23
- class: v(e.modifiers)
23
+ class: g(e.modifiers)
24
24
  },
25
25
  [
26
- i("div", N, [
27
- i("select", {
26
+ t("div", N, [
27
+ t("select", {
28
28
  id: e.id,
29
29
  name: e.name,
30
30
  autocomplete: e.autocomplete,
@@ -33,51 +33,51 @@ function C(_, I, f, e, S, M) {
33
33
  onFocus: e.focusHandler,
34
34
  onBlur: e.blurHandler,
35
35
  onKeydown: [
36
- t(e.spaceHandler, ["space"]),
37
- t(e.arrowDownHandler, ["arrow-down"]),
38
- t(e.arrowUpHandler, ["arrow-up"]),
39
- t(e.enterHandler, ["enter"])
36
+ a(e.spaceHandler, ["space"]),
37
+ a(e.arrowDownHandler, ["arrow-down"]),
38
+ a(e.arrowUpHandler, ["arrow-up"]),
39
+ a(e.enterHandler, ["enter"])
40
40
  ]
41
41
  }, [
42
42
  (o(!0), r(
43
- a,
43
+ i,
44
44
  null,
45
- d(e.domOptions, (n) => (o(), r("option", {
46
- key: n,
47
- value: n
48
- }, null, 8, x))),
45
+ c(e.nativeOptions, (l) => (o(), r("option", {
46
+ key: l,
47
+ value: l
48
+ }, null, 8, b))),
49
49
  128
50
50
  /* KEYED_FRAGMENT */
51
51
  ))
52
- ], 40, b),
53
- i(
52
+ ], 40, S),
53
+ t(
54
54
  "div",
55
55
  {
56
56
  ref: "nmorphSelectDOMRef",
57
57
  class: "nmorph-select__selected-values-line",
58
- onClick: w(e.clickHandler, ["stop"])
58
+ onClick: u(e.clickHandler, ["stop"])
59
59
  },
60
60
  [
61
61
  typeof e.initialValue == "string" ? (o(), r(
62
62
  "div",
63
- O,
64
- h(e.selectedValueTitle),
63
+ H,
64
+ _(e.selectedValueTitle),
65
65
  1
66
66
  /* TEXT */
67
67
  )) : e.initialValue.length === 0 ? (o(), r(
68
68
  "div",
69
- D,
70
- h(e.computedNoElementPlaceholder),
69
+ O,
70
+ _(e.computedNoElementPlaceholder),
71
71
  1
72
72
  /* TEXT */
73
- )) : (o(), r("div", H, [
73
+ )) : (o(), r("div", C, [
74
74
  (o(!0), r(
75
- a,
75
+ i,
76
76
  null,
77
- d(e.tags, (n) => (o(), l(e.NmorphTagItem, m({
78
- key: n.value,
77
+ c(e.tags, (l) => (o(), n(e.NmorphTagItem, d({
78
+ key: l.value,
79
79
  ref_for: !0
80
- }, n, {
80
+ }, l, {
81
81
  transparent: "",
82
82
  removable: e.tags.length > 1 || !e.props.valueRequired,
83
83
  height: "thin",
@@ -87,9 +87,9 @@ function C(_, I, f, e, S, M) {
87
87
  /* KEYED_FRAGMENT */
88
88
  ))
89
89
  ])),
90
- s(e.NmorphIcon, { class: "nmorph-select__chevron" }, {
91
- default: c(() => [
92
- e.props.loading ? (o(), l(e.NmorphIconLoader, { key: 0 })) : (o(), l(e.NmorphIconChevronDown, { key: 1 }))
90
+ v(e.NmorphIcon, { class: "nmorph-select__chevron" }, {
91
+ default: h(() => [
92
+ e.props.loading ? (o(), n(e.NmorphIconLoader, { key: 0 })) : (o(), n(e.NmorphIconChevronDown, { key: 1 }))
93
93
  ]),
94
94
  _: 1
95
95
  /* STABLE */
@@ -99,7 +99,7 @@ function C(_, I, f, e, S, M) {
99
99
  /* NEED_PATCH */
100
100
  )
101
101
  ]),
102
- e.nmorphSelectDOMRef && !e.props.disabled ? (o(), l(e.NmorphDropdown, {
102
+ e.nmorphSelectDOMRef && !e.props.disabled ? (o(), n(e.NmorphDropdown, {
103
103
  key: 0,
104
104
  open: e.open && !e.props.loading,
105
105
  "relative-element": e.nmorphSelectDOMRef,
@@ -110,34 +110,91 @@ function C(_, I, f, e, S, M) {
110
110
  "z-index": e.props.zIndex,
111
111
  onOnOutsideClick: e.closeHandler
112
112
  }, {
113
- default: c(() => [
114
- i(
113
+ default: h(() => [
114
+ t(
115
115
  "div",
116
- u,
116
+ D,
117
117
  [
118
- e.props.loading ? (o(), l(e.NmorphIcon, {
118
+ e.props.loading ? (o(), n(e.NmorphIcon, {
119
119
  key: 0,
120
120
  class: "nmorph-select__chevron",
121
121
  size: "medium"
122
122
  }, {
123
- default: c(() => [
124
- s(e.NmorphIconChevronDown)
123
+ default: h(() => [
124
+ v(e.NmorphIconChevronDown)
125
125
  ]),
126
126
  _: 1
127
127
  /* STABLE */
128
- })) : (o(!0), r(
129
- a,
130
- { key: 1 },
131
- d(f.options, (n) => (o(), l(e.NmorphSelectOption, m({
132
- key: n.value,
133
- ref_for: !0
134
- }, n, {
135
- height: e.props.height
136
- }), null, 16, ["height"]))),
137
- 128
138
- /* KEYED_FRAGMENT */
139
- )),
140
- k(_.$slots, "default")
128
+ })) : e.virtualEnabled ? (o(), r(
129
+ "div",
130
+ {
131
+ key: 1,
132
+ ref: e.virtualList.containerRef,
133
+ class: "nmorph-select__virtual-list",
134
+ style: s({ maxHeight: e.virtualMaxHeight }),
135
+ onScroll: m[0] || (m[0] = (...l) => e.virtualList.scrollHandler && e.virtualList.scrollHandler(...l))
136
+ },
137
+ [
138
+ t(
139
+ "div",
140
+ {
141
+ class: "nmorph-select__virtual-spacer",
142
+ style: s(e.virtualSpacerStyle)
143
+ },
144
+ [
145
+ t(
146
+ "div",
147
+ {
148
+ class: "nmorph-select__virtual-content",
149
+ style: s(e.virtualContentStyle)
150
+ },
151
+ [
152
+ (o(!0), r(
153
+ i,
154
+ null,
155
+ c(e.virtualOptions, (l) => (o(), n(e.NmorphSelectOption, d({
156
+ key: l.index,
157
+ ref_for: !0
158
+ }, l.item, {
159
+ focused: l.item.value === e.currentFocusedEl,
160
+ height: e.props.height
161
+ }), null, 16, ["focused", "height"]))),
162
+ 128
163
+ /* KEYED_FRAGMENT */
164
+ ))
165
+ ],
166
+ 4
167
+ /* STYLE */
168
+ )
169
+ ],
170
+ 4
171
+ /* STYLE */
172
+ )
173
+ ],
174
+ 36
175
+ /* STYLE, NEED_HYDRATION */
176
+ )) : (o(), r(
177
+ i,
178
+ { key: 2 },
179
+ [
180
+ (o(!0), r(
181
+ i,
182
+ null,
183
+ c(p.options, (l) => (o(), n(e.NmorphSelectOption, d({
184
+ key: l.value,
185
+ ref_for: !0
186
+ }, l, {
187
+ focused: l.value === e.currentFocusedEl,
188
+ height: e.props.height
189
+ }), null, 16, ["focused", "height"]))),
190
+ 128
191
+ /* KEYED_FRAGMENT */
192
+ )),
193
+ w(f.$slots, "default")
194
+ ],
195
+ 64
196
+ /* STABLE_FRAGMENT */
197
+ ))
141
198
  ],
142
199
  512
143
200
  /* NEED_PATCH */
@@ -145,13 +202,13 @@ function C(_, I, f, e, S, M) {
145
202
  ]),
146
203
  _: 3
147
204
  /* FORWARDED */
148
- }, 8, ["open", "relative-element", "fill-width", "width", "min-width", "z-index"])) : g("v-if", !0)
205
+ }, 8, ["open", "relative-element", "fill-width", "width", "min-width", "z-index"])) : k("v-if", !0)
149
206
  ],
150
207
  2
151
208
  /* CLASS */
152
209
  );
153
210
  }
154
- const E = /* @__PURE__ */ y(p, [["render", C], ["__file", "/builds/ketjo/nmorph/library/src/components/form/nmorph-select/NmorphSelect.vue"]]);
211
+ const B = /* @__PURE__ */ x(y, [["render", I], ["__file", "/builds/ketjo/nmorph/library/src/components/form/nmorph-select/NmorphSelect.vue"]]);
155
212
  export {
156
- E as default
213
+ B as default
157
214
  };
@@ -1,16 +1,17 @@
1
1
  import './NmorphSelect.css';
2
- import { defineComponent as U, computed as n, ref as o, watch as N, onMounted as F, nextTick as j, onUnmounted as z, provide as E } from "vue";
3
- import { NmorphComponentHeight as G } from "../../../types/index.js";
4
- import { useModifiers as J } from "../../../utils/create-modifiers.js";
5
- import { useI18n as K } from "vue-i18n";
6
- import { useFormItemInput as Q } from "../nmorph-form/use-form-item-input.js";
7
- import X from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
8
- import Y from "./components/nmorph-select-option/NmorphSelectOption.vue.js";
9
- import Z from "../../basic/nmorph-icon/NmorphIcon.vue.js";
10
- import ee from "../../data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.js";
11
- import te from "../../../assets/icons/chevron-down.svg.js";
12
- import le from "../../../assets/icons/loader.svg.js";
13
- const ye = /* @__PURE__ */ U({
2
+ import { defineComponent as le, computed as a, ref as s, watch as f, nextTick as E, onMounted as ae, onUnmounted as re, provide as L } from "vue";
3
+ import { NmorphComponentHeight as ne } from "../../../types/index.js";
4
+ import { useModifiers as ue } from "../../../utils/create-modifiers.js";
5
+ import { useI18n as oe } from "vue-i18n";
6
+ import { useFormItemInput as ie } from "../nmorph-form/use-form-item-input.js";
7
+ import { useVirtualList as se } from "../../../hooks/use-virtual-list.js";
8
+ import de from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
9
+ import ve from "./components/nmorph-select-option/NmorphSelectOption.vue.js";
10
+ import ce from "../../basic/nmorph-icon/NmorphIcon.vue.js";
11
+ import fe from "../../data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.js";
12
+ import pe from "../../../assets/icons/chevron-down.svg.js";
13
+ import me from "../../../assets/icons/loader.svg.js";
14
+ const _e = /* @__PURE__ */ le({
14
15
  __name: "NmorphSelect",
15
16
  props: {
16
17
  noElementPlaceholder: { type: String, required: !1, default: "" },
@@ -23,6 +24,10 @@ const ye = /* @__PURE__ */ U({
23
24
  fill: { type: Boolean, required: !1, default: !1 },
24
25
  optionsWidth: { type: String, required: !1, default: "truncate" },
25
26
  zIndex: { type: Number, required: !1 },
27
+ virtual: { type: Boolean, required: !1, default: !1 },
28
+ virtualItemHeight: { type: Number, required: !1, default: 0 },
29
+ virtualMaxHeight: { type: [Number, String], required: !1, default: 240 },
30
+ virtualOverscan: { type: Number, required: !1, default: 5 },
26
31
  id: { type: String, required: !1 },
27
32
  name: { type: String, required: !1 },
28
33
  autocomplete: { type: String, required: !1 },
@@ -31,98 +36,122 @@ const ye = /* @__PURE__ */ U({
31
36
  tabindex: { type: Number, required: !1 }
32
37
  },
33
38
  emits: ["update:model-value"],
34
- setup(M, { expose: _, emit: $ }) {
35
- _();
36
- const { t: H } = K(), t = M, I = n(
37
- () => t.noElementPlaceholder ? t.noElementPlaceholder : H("noElementPlaceholder")
38
- ), v = $, e = o(t.modelValue), r = o(t.open), u = n(() => t.disabled || t.loading), m = n(() => t.optionsWidth === "auto"), c = o(null), w = o(null), h = o(!0), { id: V, name: D, autocomplete: O, tabindex: L } = Q(t), g = (l) => {
39
- if (!u.value) {
40
- if (r.value = !1, typeof e.value == "string" && (!t.valueRequired && e.value === l ? e.value = "" : e.value = l, v("update:model-value", e.value)), Array.isArray(e.value)) {
41
- const a = e.value.includes(l), A = e.value.length === 1 && a;
42
- if (t.valueRequired && A) return;
43
- a ? e.value = e.value.filter((b) => b !== l) : e.value = [...e.value, l];
39
+ setup(V, { expose: B, emit: T }) {
40
+ B();
41
+ const { t: O } = oe(), l = V, S = a(
42
+ () => l.noElementPlaceholder ? l.noElementPlaceholder : O("noElementPlaceholder")
43
+ ), m = T, t = s(l.modelValue), r = s(l.open), d = a(() => l.disabled || l.loading), h = a(() => l.optionsWidth === "auto"), g = s(!0), { id: C, name: P, autocomplete: k, tabindex: R } = ie(l), y = (e) => {
44
+ if (!d.value) {
45
+ if (r.value = !1, typeof t.value == "string" && (!l.valueRequired && t.value === e ? t.value = "" : t.value = e, m("update:model-value", t.value)), Array.isArray(t.value)) {
46
+ const n = t.value.includes(e), ee = t.value.length === 1 && n;
47
+ if (l.valueRequired && ee) return;
48
+ n ? t.value = t.value.filter((te) => te !== e) : t.value = [...t.value, e];
44
49
  }
45
- v("update:model-value", e.value);
50
+ m("update:model-value", t.value);
46
51
  }
47
- }, p = o(!1), P = () => {
52
+ }, p = s(!1), W = () => {
48
53
  p.value = !0;
49
- }, B = () => {
54
+ }, U = () => {
50
55
  p.value = !1;
51
- }, R = n(
52
- () => J({
53
- nmorph: [G[t.height]],
56
+ }, z = a(
57
+ () => ue({
58
+ nmorph: [ne[l.height]],
54
59
  "nmorph-select": [
55
- `${t.disabled && "disabled"}`,
56
- `${t.modelValue ? "on" : "off"}`,
57
- `${t.loading && "loading"}`,
58
- `${r.value && !u.value && "open"}`,
59
- `${t.fill && "fill"}`,
60
- `${m.value && "options-auto-width"}`,
61
- `${h.value ? "selected-line-outset" : "selected-line-inset"}`,
60
+ `${l.disabled && "disabled"}`,
61
+ `${l.modelValue ? "on" : "off"}`,
62
+ `${l.loading && "loading"}`,
63
+ `${r.value && !d.value && "open"}`,
64
+ `${l.fill && "fill"}`,
65
+ `${h.value && "options-auto-width"}`,
66
+ `${g.value ? "selected-line-outset" : "selected-line-inset"}`,
62
67
  `${p.value && "focus"}`
63
68
  ]
64
69
  })
65
- ), W = () => {
66
- u.value || (r.value = !r.value);
70
+ ), F = () => {
71
+ d.value || (r.value = !r.value);
67
72
  };
68
- N(
73
+ f(
69
74
  r,
70
- (l) => {
71
- l && (h.value = !1);
75
+ (e) => {
76
+ e && (g.value = !1);
72
77
  },
73
78
  { immediate: !0 }
74
79
  );
75
- const y = () => {
80
+ const b = () => {
76
81
  r.value = !1;
77
82
  };
78
- N(
79
- () => t.loading,
80
- (l) => {
81
- l && (r.value = !1);
83
+ f(
84
+ () => l.loading,
85
+ (e) => {
86
+ e && (r.value = !1);
82
87
  }
83
88
  );
84
- const f = o(), i = o([]), s = o(0), d = o("");
85
- N(s, (l) => {
86
- d.value = i.value[l], f.value.forEach((a) => {
87
- const b = a.getAttribute("value") === d.value ? "add" : "remove";
88
- a.classList[b]("nmorph-select-option--focused");
89
- });
90
- }), F(async () => {
91
- await j(), c.value && (f.value = c.value.querySelectorAll(".nmorph-select-option"), f.value.forEach((l) => {
92
- const a = l.getAttribute("value");
93
- a && i.value.push(a);
94
- }), d.value = i.value[s.value], w.value = `${c.value.clientHeight}px`, document.addEventListener("click", y));
95
- }), z(() => {
96
- document.removeEventListener("click", y);
89
+ const i = a(() => l.options.length > 0 ? l.options : l.optionsMap), q = s(null), H = s([]), x = a(() => l.options), c = a(() => l.virtual && x.value.length > 0), M = a(() => ({
90
+ basic: 30,
91
+ thick: 38,
92
+ thin: 22
93
+ })[l.height || "basic"]), w = a(() => l.virtualItemHeight || M.value), A = a(() => l.virtualOverscan), v = se(x, {
94
+ enabled: c,
95
+ itemHeight: w,
96
+ overscan: A
97
+ }), j = a(() => v.virtualItems.value), Y = a(() => ({
98
+ height: `${v.totalHeight.value}px`
99
+ })), G = a(() => ({
100
+ transform: `translateY(${v.offsetTop.value}px)`
101
+ })), $ = (e) => typeof e == "number" ? `${e}px` : e, J = a(() => $(l.virtualMaxHeight)), I = () => {
102
+ i.value.length > 0 || !q.value || (H.value = Array.from(q.value.querySelectorAll(".nmorph-select-option")).map((e) => e.getAttribute("value")).filter((e) => !!e));
103
+ }, o = a(
104
+ () => i.value.length > 0 ? i.value.map((e) => e.value) : H.value
105
+ ), K = a(() => c.value ? Array.isArray(t.value) ? t.value : t.value ? [t.value] : [] : o.value), u = s(0), N = a(() => o.value[u.value] || "");
106
+ f(u, (e) => {
107
+ r.value && c.value && v.scrollToIndex(e);
108
+ }), f(
109
+ o,
110
+ (e) => {
111
+ u.value >= e.length && (u.value = Math.max(e.length - 1, 0));
112
+ },
113
+ { immediate: !0 }
114
+ ), f(r, async (e) => {
115
+ if (e) {
116
+ if (await E(), I(), typeof t.value == "string") {
117
+ const n = o.value.indexOf(t.value);
118
+ n !== -1 && (u.value = n);
119
+ }
120
+ v.refresh(), c.value && v.scrollToIndex(u.value);
121
+ }
122
+ }), ae(async () => {
123
+ await E(), I(), document.addEventListener("click", b);
124
+ }), re(() => {
125
+ document.removeEventListener("click", b);
97
126
  });
98
- const k = n(() => typeof e.value == "string" ? e.value === "" ? I.value : t.options.find((l) => l.value === e.value)?.label : t.options.find((l) => l.value === e.value)?.label), q = n(() => t.options.length > 0 ? t.options : t.optionsMap), C = n(() => q.value.length > 0 ? q.value.filter((a) => e.value.includes(a.value)).map((a) => ({ text: a.label, value: a.value })) : Array.isArray(e.value) ? e.value.map((a) => ({ text: a, value: a })) : [{ text: e.value, value: e.value }]);
99
- E("select-selected-value", e), E("select-change-selected-value", g);
100
- const S = o(null), T = n(
101
- () => m.value ? `${S.value?.clientWidth || 0}px` : void 0
102
- ), x = { t: H, props: t, computedNoElementPlaceholder: I, emit: v, initialValue: e, open: r, disabledInput: u, autoOptionsWidth: m, optionsDOMRef: c, optionsHeight: w, selectedLineOutset: h, id: V, name: D, autocomplete: O, tabindex: L, changeHandler: g, focus: p, focusHandler: P, blurHandler: B, modifiers: R, clickHandler: W, closeHandler: y, nodeOptions: f, domOptions: i, currentIndex: s, currentFocusedEl: d, selectedValueTitle: k, optionsMap: q, tags: C, nmorphSelectDOMRef: S, optionsMinWidth: T, spaceHandler: () => {
103
- u.value || (r.value = !r.value);
127
+ const Q = a(() => typeof t.value == "string" ? t.value === "" ? S.value : i.value.find((e) => e.value === t.value)?.label : i.value.find((e) => e.value === t.value)?.label), X = a(() => i.value.length > 0 ? i.value.filter((n) => t.value.includes(n.value)).map((n) => ({ text: n.label, value: n.value })) : Array.isArray(t.value) ? t.value.map((n) => ({ text: n, value: n })) : [{ text: t.value, value: t.value }]);
128
+ L("select-selected-value", t), L("select-change-selected-value", y);
129
+ const D = s(null), Z = a(
130
+ () => h.value ? `${D.value?.clientWidth || 0}px` : void 0
131
+ ), _ = { t: O, props: l, computedNoElementPlaceholder: S, emit: m, initialValue: t, open: r, disabledInput: d, autoOptionsWidth: h, selectedLineOutset: g, id: C, name: P, autocomplete: k, tabindex: R, changeHandler: y, focus: p, focusHandler: W, blurHandler: U, modifiers: z, clickHandler: F, closeHandler: b, optionsMap: i, optionsDOMRef: q, slotDomOptions: H, renderedOptions: x, virtualEnabled: c, defaultOptionHeight: M, virtualItemHeight: w, virtualOverscan: A, virtualList: v, virtualOptions: j, virtualSpacerStyle: Y, virtualContentStyle: G, getCssSize: $, virtualMaxHeight: J, refreshDomOptions: I, domOptions: o, nativeOptions: K, currentIndex: u, currentFocusedEl: N, selectedValueTitle: Q, tags: X, nmorphSelectDOMRef: D, optionsMinWidth: Z, spaceHandler: () => {
132
+ d.value || (r.value = !r.value);
104
133
  }, arrowDownHandler: () => {
105
- u.value || (s.value = (s.value + 1) % i.value.length);
134
+ d.value || o.value.length !== 0 && (u.value = (u.value + 1) % o.value.length);
106
135
  }, arrowUpHandler: () => {
107
- u.value || (s.value = (s.value - 1 + i.value.length) % i.value.length);
136
+ d.value || o.value.length !== 0 && (u.value = (u.value - 1 + o.value.length) % o.value.length);
108
137
  }, enterHandler: () => {
109
- r.value && g(d.value);
138
+ r.value && N.value && y(N.value);
110
139
  }, get NmorphTagItem() {
111
- return ee;
140
+ return fe;
112
141
  }, get NmorphIcon() {
113
- return Z;
142
+ return ce;
114
143
  }, get NmorphSelectOption() {
115
- return Y;
144
+ return ve;
116
145
  }, get NmorphDropdown() {
117
- return X;
146
+ return de;
118
147
  }, get NmorphIconLoader() {
119
- return le;
148
+ return me;
120
149
  }, get NmorphIconChevronDown() {
121
- return te;
150
+ return pe;
122
151
  } };
123
- return Object.defineProperty(x, "__isScriptSetup", { enumerable: !1, value: !0 }), x;
152
+ return Object.defineProperty(_, "__isScriptSetup", { enumerable: !1, value: !0 }), _;
124
153
  }
125
154
  });
126
155
  export {
127
- ye as default
156
+ _e as default
128
157
  };
@@ -1,14 +1,15 @@
1
1
  import './NmorphSelectOption.css';
2
- import { defineComponent as f, inject as i, computed as n } from "vue";
2
+ import { defineComponent as m, inject as u, computed as s } from "vue";
3
3
  import { NmorphComponentHeight as h } from "../../../../../types/index.js";
4
4
  import { useModifiers as g } from "../../../../../utils/create-modifiers.js";
5
5
  import v from "../../../../basic/nmorph-icon/NmorphIcon.vue.js";
6
- import b from "../../../../../assets/icons/success.svg.js";
7
- const I = /* @__PURE__ */ f({
6
+ import y from "../../../../../assets/icons/success.svg.js";
7
+ const I = /* @__PURE__ */ m({
8
8
  __name: "NmorphSelectOption",
9
9
  props: {
10
10
  value: { type: String, required: !0 },
11
11
  label: { type: String, required: !0, default: "" },
12
+ focused: { type: Boolean, required: !1, default: !1 },
12
13
  id: { type: String, required: !1 },
13
14
  name: { type: String, required: !1 },
14
15
  autocomplete: { type: String, required: !1 },
@@ -17,23 +18,24 @@ const I = /* @__PURE__ */ f({
17
18
  tabindex: { type: Number, required: !1 }
18
19
  },
19
20
  emits: ["change-value"],
20
- setup(u, { expose: s, emit: c }) {
21
- s();
22
- const t = i("select-selected-value"), r = i("select-change-selected-value"), e = u, l = c, p = () => {
21
+ setup(i, { expose: n, emit: c }) {
22
+ n();
23
+ const t = u("select-selected-value"), r = u("select-change-selected-value"), e = i, l = c, d = () => {
23
24
  e.disabled || (l("change-value", e.value), r && r(e.value));
24
- }, a = n(() => typeof t?.value == "string" ? t.value === e.value : Array.isArray(t?.value) ? t.value.some((m) => m === e.value) : !1), d = n(
25
+ }, a = s(() => typeof t?.value == "string" ? t.value === e.value : Array.isArray(t?.value) ? t.value.some((f) => f === e.value) : !1), p = s(
25
26
  () => g({
26
27
  nmorph: [h[e.height]],
27
28
  "nmorph-select-option": [
28
29
  `${e.disabled && "disabled"}`,
29
30
  `${e.label && "with-label"}`,
30
- `${a.value && "checked"}`
31
+ `${a.value && "checked"}`,
32
+ `${e.focused && "focused"}`
31
33
  ]
32
34
  })
33
- ), o = { selectSelectedValue: t, selectChangeSelectedValue: r, props: e, emit: l, clickHandler: p, checked: a, modifiers: d, get NmorphIcon() {
35
+ ), o = { selectSelectedValue: t, selectChangeSelectedValue: r, props: e, emit: l, clickHandler: d, checked: a, modifiers: p, get NmorphIcon() {
34
36
  return v;
35
37
  }, get NmorphIconSuccess() {
36
- return b;
38
+ return y;
37
39
  } };
38
40
  return Object.defineProperty(o, "__isScriptSetup", { enumerable: !1, value: !0 }), o;
39
41
  }
@@ -1,49 +1,36 @@
1
1
  import './NmorphDropdown.css';
2
2
  import n from "./NmorphDropdown.vue2.js";
3
- import { openBlock as d, createElementBlock as i, normalizeStyle as r, createVNode as t, withCtx as m, createElementVNode as p, normalizeClass as a, renderSlot as l } from "vue";
3
+ import { openBlock as r, createBlock as t, withCtx as d, createElementBlock as i, normalizeStyle as p, normalizeClass as l, renderSlot as a, createCommentVNode as m } from "vue";
4
4
  /* empty css */
5
5
  import s from "../../../_virtual/_plugin-vue_export-helper.js";
6
- function c(e, h, f, o, w, _) {
7
- return d(), i(
8
- "div",
9
- {
10
- style: r({
11
- "--nmorph-dropdown-width": o.width,
12
- "--nmorph-dropdown-min-width": o.getCssSize(o.props.minWidth) || "auto",
13
- "--nmorph-dropdown-max-width": o.getCssSize(o.props.maxWidth) || "none"
14
- })
15
- },
16
- [
17
- t(o.NmorphOverlay, {
18
- show: o.props.open,
19
- transparent: "",
20
- "z-index": o.props.zIndex,
21
- onOnOutsideClick: o.outsideClickHandler
22
- }, {
23
- default: m(() => [
24
- p(
25
- "div",
26
- {
27
- ref: "dropdownDOMRef",
28
- class: a(o.modifiers),
29
- style: r({ left: `${o.placementCoords.x}`, top: `${o.placementCoords.y}` })
30
- },
31
- [
32
- l(e.$slots, "default")
33
- ],
34
- 6
35
- /* CLASS, STYLE */
36
- )
37
- ]),
38
- _: 3
39
- /* FORWARDED */
40
- }, 8, ["show", "z-index"])
41
- ],
42
- 4
43
- /* STYLE */
44
- );
6
+ function c(e, f, _, o, h, w) {
7
+ return r(), t(o.NmorphOverlay, {
8
+ show: o.props.open,
9
+ transparent: "",
10
+ "z-index": o.props.zIndex,
11
+ onOnOutsideClick: o.outsideClickHandler
12
+ }, {
13
+ default: d(() => [
14
+ o.props.open ? (r(), i(
15
+ "div",
16
+ {
17
+ key: 0,
18
+ ref: "dropdownDOMRef",
19
+ class: l(o.modifiers),
20
+ style: p(o.dropdownStyle)
21
+ },
22
+ [
23
+ a(e.$slots, "default")
24
+ ],
25
+ 6
26
+ /* CLASS, STYLE */
27
+ )) : m("v-if", !0)
28
+ ]),
29
+ _: 3
30
+ /* FORWARDED */
31
+ }, 8, ["show", "z-index"]);
45
32
  }
46
- const k = /* @__PURE__ */ s(n, [["render", c], ["__file", "/builds/ketjo/nmorph/library/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue"]]);
33
+ const z = /* @__PURE__ */ s(n, [["render", c], ["__file", "/builds/ketjo/nmorph/library/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue"]]);
47
34
  export {
48
- k as default
35
+ z as default
49
36
  };