@enos5/enos-vue-default 1.8.6 → 1.8.8

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.
@@ -85,6 +85,18 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
85
85
  type: (ArrayConstructor | StringConstructor | ObjectConstructor)[];
86
86
  default: string;
87
87
  };
88
+ searchable: {
89
+ type: BooleanConstructor;
90
+ default: boolean;
91
+ };
92
+ searchPlaceholder: {
93
+ type: StringConstructor;
94
+ default: string;
95
+ };
96
+ searchInputClass: {
97
+ type: (ArrayConstructor | StringConstructor | ObjectConstructor)[];
98
+ default: string;
99
+ };
88
100
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
89
101
  "update:modelValue": (...args: any[]) => void;
90
102
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -172,6 +184,18 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
172
184
  type: (ArrayConstructor | StringConstructor | ObjectConstructor)[];
173
185
  default: string;
174
186
  };
187
+ searchable: {
188
+ type: BooleanConstructor;
189
+ default: boolean;
190
+ };
191
+ searchPlaceholder: {
192
+ type: StringConstructor;
193
+ default: string;
194
+ };
195
+ searchInputClass: {
196
+ type: (ArrayConstructor | StringConstructor | ObjectConstructor)[];
197
+ default: string;
198
+ };
175
199
  }>> & Readonly<{
176
200
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
177
201
  }>, {
@@ -196,4 +220,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
196
220
  dropdownClass: string | unknown[] | Record<string, any>;
197
221
  dropdownOptionClass: string | unknown[] | Record<string, any>;
198
222
  dropdownSelectedClass: string | unknown[] | Record<string, any>;
223
+ searchable: boolean;
224
+ searchPlaceholder: string;
225
+ searchInputClass: string | unknown[] | Record<string, any>;
199
226
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -185,6 +185,18 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
185
185
  type: StringConstructor;
186
186
  default: string;
187
187
  };
188
+ searchable: {
189
+ type: BooleanConstructor;
190
+ default: boolean;
191
+ };
192
+ searchPlaceholder: {
193
+ type: StringConstructor;
194
+ default: string;
195
+ };
196
+ searchInputClass: {
197
+ type: (ArrayConstructor | StringConstructor | ObjectConstructor)[];
198
+ default: undefined;
199
+ };
188
200
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
189
201
  "update:modelValue": (...args: any[]) => void;
190
202
  blur: (...args: any[]) => void;
@@ -369,6 +381,18 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
369
381
  type: StringConstructor;
370
382
  default: string;
371
383
  };
384
+ searchable: {
385
+ type: BooleanConstructor;
386
+ default: boolean;
387
+ };
388
+ searchPlaceholder: {
389
+ type: StringConstructor;
390
+ default: string;
391
+ };
392
+ searchInputClass: {
393
+ type: (ArrayConstructor | StringConstructor | ObjectConstructor)[];
394
+ default: undefined;
395
+ };
372
396
  }>> & Readonly<{
373
397
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
374
398
  onBlur?: ((...args: any[]) => any) | undefined;
@@ -395,6 +419,9 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
395
419
  optionClass: string | unknown[] | Record<string, any>;
396
420
  deletedOptionClass: string | unknown[] | Record<string, any>;
397
421
  placeholderClass: string | unknown[] | Record<string, any>;
422
+ searchable: boolean;
423
+ searchPlaceholder: string;
424
+ searchInputClass: string | unknown[] | Record<string, any>;
398
425
  locale: string;
399
426
  withTimestamp: boolean;
400
427
  max: string;
@@ -85,6 +85,18 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
85
85
  type: (ArrayConstructor | StringConstructor | ObjectConstructor)[];
86
86
  default: string;
87
87
  };
88
+ searchable: {
89
+ type: BooleanConstructor;
90
+ default: boolean;
91
+ };
92
+ searchPlaceholder: {
93
+ type: StringConstructor;
94
+ default: string;
95
+ };
96
+ searchInputClass: {
97
+ type: (ArrayConstructor | StringConstructor | ObjectConstructor)[];
98
+ default: string;
99
+ };
88
100
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
89
101
  "update:modelValue": (...args: any[]) => void;
90
102
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -172,6 +184,18 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
172
184
  type: (ArrayConstructor | StringConstructor | ObjectConstructor)[];
173
185
  default: string;
174
186
  };
187
+ searchable: {
188
+ type: BooleanConstructor;
189
+ default: boolean;
190
+ };
191
+ searchPlaceholder: {
192
+ type: StringConstructor;
193
+ default: string;
194
+ };
195
+ searchInputClass: {
196
+ type: (ArrayConstructor | StringConstructor | ObjectConstructor)[];
197
+ default: string;
198
+ };
175
199
  }>> & Readonly<{
176
200
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
177
201
  }>, {
@@ -196,4 +220,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
196
220
  dropdownClass: string | unknown[] | Record<string, any>;
197
221
  dropdownOptionClass: string | unknown[] | Record<string, any>;
198
222
  dropdownSelectedClass: string | unknown[] | Record<string, any>;
223
+ searchable: boolean;
224
+ searchPlaceholder: string;
225
+ searchInputClass: string | unknown[] | Record<string, any>;
199
226
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -170,6 +170,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
170
170
  "onUpdate:searchShowDeleted"?: ((...args: any[]) => any) | undefined;
171
171
  }>, {
172
172
  search: boolean;
173
+ searchPlaceholder: string;
173
174
  sortField: string;
174
175
  sortDirection: string;
175
176
  emptyState: Record<string, any>;
@@ -178,7 +179,6 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
178
179
  isCard: boolean;
179
180
  actionsLabel: string;
180
181
  deletedLabel: string;
181
- searchPlaceholder: string;
182
182
  searchCountLabel: string;
183
183
  searchCount: number;
184
184
  searchQueryLabel: string;
@@ -200,6 +200,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
200
200
  "onEdit-cancel"?: ((...args: any[]) => any) | undefined;
201
201
  }>, {
202
202
  search: boolean;
203
+ searchPlaceholder: string;
203
204
  sortField: string;
204
205
  sortDirection: string;
205
206
  emptyState: Record<string, any>;
@@ -208,7 +209,6 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
208
209
  isCard: boolean;
209
210
  actionsLabel: string;
210
211
  deletedLabel: string;
211
- searchPlaceholder: string;
212
212
  getErrorMessage: Function;
213
213
  rowKey: string | Function;
214
214
  isDeletedFn: Function;
@@ -37,9 +37,21 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
37
37
  type: StringConstructor;
38
38
  default: string;
39
39
  };
40
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
40
+ }>, {
41
+ getEditor: () => any;
42
+ focus: () => any;
43
+ execCommand: (command: any, ui: boolean | undefined, value: any) => any;
44
+ getContent: (options: any) => any;
45
+ getBody: () => any;
46
+ selectNode: (node: any) => void;
47
+ getBookmark: () => any;
48
+ moveToBookmark: (bookmark: any) => void;
49
+ syncContent: () => any;
50
+ insertContent: (value: any, options?: {}) => Promise<any>;
51
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
41
52
  "update:modelValue": (...args: any[]) => void;
42
53
  blur: (...args: any[]) => void;
54
+ init: (...args: any[]) => void;
43
55
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
44
56
  modelValue: {
45
57
  type: StringConstructor;
@@ -80,6 +92,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
80
92
  }>> & Readonly<{
81
93
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
82
94
  onBlur?: ((...args: any[]) => any) | undefined;
95
+ onInit?: ((...args: any[]) => any) | undefined;
83
96
  }>, {
84
97
  modelValue: string;
85
98
  readonly: boolean;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import './styles.css';
2
- import { _, a, b, c, d, e, f, g, h, i, C, j, k, D, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, S, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W, X, Y, Z, $, a0, a1, a2, a3 } from "./plugin-HUdH_CuM.js";
2
+ import { _, a, b, c, d, e, f, g, h, i, C, j, k, D, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, S, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W, X, Y, Z, $, a0, a1, a2, a3 } from "./plugin-Bc62JLDw.js";
3
3
  export {
4
4
  _ as ActionCard,
5
5
  a as ActionMessage,
@@ -1,4 +1,4 @@
1
- import { _, a, b, c, d, e, f, g, h, i, C, j, k, D, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, S, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W, X, Y, Z, $, a0, a1, a2, a3 } from "./plugin-HUdH_CuM.js";
1
+ import { _, a, b, c, d, e, f, g, h, i, C, j, k, D, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, S, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W, X, Y, Z, $, a0, a1, a2, a3 } from "./plugin-Bc62JLDw.js";
2
2
  export {
3
3
  _ as ActionCard,
4
4
  a as ActionMessage,
@@ -1,4 +1,4 @@
1
- import { ref, computed, watch, openBlock, createElementBlock, createElementVNode, Fragment, renderList, normalizeClass, normalizeStyle, toDisplayString, createBlock, createCommentVNode, renderSlot, createVNode, Transition, withCtx, mergeProps, useSlots, unref, withDirectives, vShow, useAttrs, vModelCheckbox, onMounted, nextTick, onBeforeUnmount, Teleport, withModifiers, onUnmounted, inject, provide, defineComponent, isVNode, cloneVNode, resolveDynamicComponent, createTextVNode, h, vModelText, createSlots } from "vue";
1
+ import { ref, computed, watch, openBlock, createElementBlock, createElementVNode, Fragment, renderList, normalizeClass, normalizeStyle, toDisplayString, createBlock, createCommentVNode, renderSlot, createVNode, Transition, withCtx, mergeProps, useSlots, unref, withDirectives, vShow, useAttrs, vModelCheckbox, onMounted, nextTick, onBeforeUnmount, Teleport, withModifiers, vModelText, onUnmounted, inject, provide, defineComponent, isVNode, cloneVNode, resolveDynamicComponent, createTextVNode, h, createSlots } from "vue";
2
2
  import { LockClosedIcon, ChevronDownIcon, PhotoIcon, EyeDropperIcon, ExclamationCircleIcon, ExclamationTriangleIcon, ChevronUpIcon, MagnifyingGlassIcon, CheckIcon, PencilSquareIcon } from "@heroicons/vue/24/outline";
3
3
  import Editor from "@tinymce/tinymce-vue";
4
4
  import { useI18n } from "vue-i18n";
@@ -306,7 +306,7 @@ const _sfc_main$O = {};
306
306
  const _hoisted_1$B = { class: "md:col-span-1 flex justify-between" };
307
307
  const _hoisted_2$m = { class: "px-4 sm:px-0" };
308
308
  const _hoisted_3$g = { class: "text-xl font-semibold tracking-tight text-neutral-950 dark:text-neutral-50" };
309
- const _hoisted_4$b = { class: "mt-1 max-w-2xl text-sm text-neutral-600 dark:text-neutral-200" };
309
+ const _hoisted_4$c = { class: "mt-1 max-w-2xl text-sm text-neutral-600 dark:text-neutral-200" };
310
310
  const _hoisted_5$9 = { class: "px-4 sm:px-0" };
311
311
  function _sfc_render(_ctx, _cache) {
312
312
  return openBlock(), createElementBlock("div", _hoisted_1$B, [
@@ -314,7 +314,7 @@ function _sfc_render(_ctx, _cache) {
314
314
  createElementVNode("h3", _hoisted_3$g, [
315
315
  renderSlot(_ctx.$slots, "title")
316
316
  ]),
317
- createElementVNode("p", _hoisted_4$b, [
317
+ createElementVNode("p", _hoisted_4$c, [
318
318
  renderSlot(_ctx.$slots, "description")
319
319
  ])
320
320
  ]),
@@ -621,7 +621,7 @@ const _hoisted_2$k = {
621
621
  class: "absolute inset-y-0 left-0 flex items-center pointer-events-none pl-3"
622
622
  };
623
623
  const _hoisted_3$e = ["type", "value", "disabled"];
624
- const _hoisted_4$a = ["aria-label"];
624
+ const _hoisted_4$b = ["aria-label"];
625
625
  const _hoisted_5$8 = {
626
626
  key: 0,
627
627
  class: "h-5 w-5",
@@ -740,7 +740,7 @@ const _sfc_main$I = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
740
740
  d: "M2.458 12C3.732 7.943 7.523 5 12 5s8.268 2.943 9.542 7c-1.274 4.057-5.065 7-9.542 7S3.732 16.057 2.458 12z"
741
741
  }, null, -1)
742
742
  ])]))
743
- ], 8, _hoisted_4$a)) : createCommentVNode("", true)
743
+ ], 8, _hoisted_4$b)) : createCommentVNode("", true)
744
744
  ]);
745
745
  };
746
746
  }
@@ -822,12 +822,13 @@ const _sfc_main$H = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
822
822
  };
823
823
  }
824
824
  });
825
- const _hoisted_1$t = ["onClick"];
826
- const _hoisted_2$j = {
825
+ const _hoisted_1$t = ["placeholder"];
826
+ const _hoisted_2$j = ["onClick"];
827
+ const _hoisted_3$d = {
827
828
  key: 0,
828
829
  class: "flex items-center gap-3"
829
830
  };
830
- const _hoisted_3$d = ["checked", "disabled", "onChange"];
831
+ const _hoisted_4$a = ["checked", "disabled", "onChange"];
831
832
  const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
832
833
  __name: "CustomSelect",
833
834
  props: {
@@ -914,6 +915,18 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
914
915
  dropdownSelectedClass: {
915
916
  type: [String, Array, Object],
916
917
  default: "bg-neutral-100 font-medium text-neutral-950 dark:bg-neutral-900 dark:text-neutral-50"
918
+ },
919
+ searchable: {
920
+ type: Boolean,
921
+ default: false
922
+ },
923
+ searchPlaceholder: {
924
+ type: String,
925
+ default: "Search..."
926
+ },
927
+ searchInputClass: {
928
+ type: [String, Array, Object],
929
+ default: "w-full border-b border-neutral-200 px-4 py-3 text-sm outline-none focus:border-neutral-900 dark:border-neutral-800 dark:bg-neutral-950 dark:focus:border-neutral-100"
917
930
  }
918
931
  },
919
932
  emits: ["update:modelValue"],
@@ -928,6 +941,7 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
928
941
  const dropdownStyle = ref({});
929
942
  const isDarkMode = ref(false);
930
943
  const isMounted = ref(false);
944
+ const searchQuery = ref("");
931
945
  const isObjectOption = (option) => typeof option === "object" && option !== null;
932
946
  const optionValue = (option) => {
933
947
  if (isObjectOption(option)) {
@@ -985,6 +999,17 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
985
999
  return true;
986
1000
  });
987
1001
  });
1002
+ const filteredOptions = computed(() => {
1003
+ if (!props.searchable || !searchQuery.value) {
1004
+ return props.multiple ? multipleOptions.value : availableOptions.value;
1005
+ }
1006
+ const query = searchQuery.value.toLowerCase();
1007
+ const options = props.multiple ? multipleOptions.value : availableOptions.value;
1008
+ return options.filter((option) => {
1009
+ const text = String(optionText(option)).toLowerCase();
1010
+ return text.includes(query);
1011
+ });
1012
+ });
988
1013
  const selectedMultipleOptions = computed(() => {
989
1014
  if (!props.multiple || modelValueSet.value.size === 0) {
990
1015
  return [];
@@ -1071,6 +1096,7 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
1071
1096
  const clickedInsideMenu = dropdownMenuRef.value?.contains(event.target);
1072
1097
  if (!clickedInsideTrigger && !clickedInsideMenu) {
1073
1098
  isOpen.value = false;
1099
+ searchQuery.value = "";
1074
1100
  }
1075
1101
  };
1076
1102
  const syncDarkMode = () => {
@@ -1095,6 +1121,7 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
1095
1121
  });
1096
1122
  watch(isOpen, async (open) => {
1097
1123
  if (!open) {
1124
+ searchQuery.value = "";
1098
1125
  return;
1099
1126
  }
1100
1127
  syncDarkMode();
@@ -1150,8 +1177,21 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
1150
1177
  createElementVNode("div", {
1151
1178
  class: normalizeClass([__props.dropdownClass, { "bg-neutral-950 border-neutral-800": isDarkMode.value }])
1152
1179
  }, [
1153
- __props.placeholder && !__props.multiple ? (openBlock(), createElementBlock("div", {
1180
+ __props.searchable ? withDirectives((openBlock(), createElementBlock("input", {
1154
1181
  key: 0,
1182
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchQuery.value = $event),
1183
+ type: "text",
1184
+ placeholder: __props.searchPlaceholder,
1185
+ class: normalizeClass(__props.searchInputClass),
1186
+ onClick: _cache[1] || (_cache[1] = withModifiers(() => {
1187
+ }, ["stop"])),
1188
+ onKeydown: _cache[2] || (_cache[2] = withModifiers(() => {
1189
+ }, ["stop"]))
1190
+ }, null, 42, _hoisted_1$t)), [
1191
+ [vModelText, searchQuery.value]
1192
+ ]) : createCommentVNode("", true),
1193
+ __props.placeholder && !__props.multiple ? (openBlock(), createElementBlock("div", {
1194
+ key: 1,
1155
1195
  class: normalizeClass([
1156
1196
  __props.dropdownOptionClass,
1157
1197
  __props.placeholderClass,
@@ -1164,14 +1204,14 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
1164
1204
  }, toDisplayString(__props.placeholder), 5)
1165
1205
  ], 2)) : createCommentVNode("", true),
1166
1206
  selectedDeletedOption.value ? (openBlock(), createElementBlock("div", {
1167
- key: 1,
1207
+ key: 2,
1168
1208
  class: normalizeClass([
1169
1209
  __props.dropdownOptionClass,
1170
1210
  __props.deletedOptionClass,
1171
1211
  __props.dropdownSelectedClass
1172
1212
  ])
1173
1213
  }, toDisplayString(optionText(selectedDeletedOption.value)), 3)) : createCommentVNode("", true),
1174
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.multiple ? multipleOptions.value : availableOptions.value, (option) => {
1214
+ (openBlock(true), createElementBlock(Fragment, null, renderList(filteredOptions.value, (option) => {
1175
1215
  return openBlock(), createElementBlock("div", {
1176
1216
  key: String(optionValue(option)),
1177
1217
  class: normalizeClass([
@@ -1186,17 +1226,17 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
1186
1226
  ]),
1187
1227
  onClick: withModifiers(($event) => __props.multiple ? toggleMultipleOption(option) : selectOption(option), ["stop"])
1188
1228
  }, [
1189
- __props.multiple ? (openBlock(), createElementBlock("div", _hoisted_2$j, [
1229
+ __props.multiple ? (openBlock(), createElementBlock("div", _hoisted_3$d, [
1190
1230
  createElementVNode("input", {
1191
1231
  type: "checkbox",
1192
1232
  class: "h-4 w-4 rounded border-neutral-300 text-neutral-900 focus:ring-neutral-900",
1193
1233
  checked: optionIsSelected(option),
1194
1234
  disabled: __props.disabled,
1195
1235
  tabindex: "-1",
1196
- onClick: _cache[0] || (_cache[0] = withModifiers(() => {
1236
+ onClick: _cache[3] || (_cache[3] = withModifiers(() => {
1197
1237
  }, ["stop"])),
1198
1238
  onChange: withModifiers(($event) => toggleMultipleOption(option), ["stop"])
1199
- }, null, 40, _hoisted_3$d),
1239
+ }, null, 40, _hoisted_4$a),
1200
1240
  createElementVNode("span", {
1201
1241
  style: normalizeStyle(darkTextStyle.value)
1202
1242
  }, toDisplayString(optionText(option)), 5)
@@ -1204,7 +1244,7 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
1204
1244
  key: 1,
1205
1245
  style: normalizeStyle(darkTextStyle.value)
1206
1246
  }, toDisplayString(optionText(option)), 5))
1207
- ], 10, _hoisted_1$t);
1247
+ ], 10, _hoisted_2$j);
1208
1248
  }), 128))
1209
1249
  ], 2)
1210
1250
  ], 6)) : createCommentVNode("", true)
@@ -1302,6 +1342,18 @@ const _sfc_main$F = {
1302
1342
  dropdownSelectedClass: {
1303
1343
  type: [String, Array, Object],
1304
1344
  default: "bg-blue-50 text-blue-700 font-medium dark:bg-neutral-900 dark:text-neutral-50"
1345
+ },
1346
+ searchable: {
1347
+ type: Boolean,
1348
+ default: false
1349
+ },
1350
+ searchPlaceholder: {
1351
+ type: String,
1352
+ default: "Search..."
1353
+ },
1354
+ searchInputClass: {
1355
+ type: [String, Array, Object],
1356
+ default: "w-full border-b border-neutral-200 px-4 py-3 text-sm outline-none focus:border-neutral-900 dark:border-neutral-800 dark:bg-neutral-950 dark:focus:border-neutral-100"
1305
1357
  }
1306
1358
  },
1307
1359
  emits: ["update:modelValue"],
@@ -1330,8 +1382,11 @@ const _sfc_main$F = {
1330
1382
  "dropdown-class": __props.dropdownClass,
1331
1383
  "dropdown-option-class": __props.dropdownOptionClass,
1332
1384
  "dropdown-selected-class": __props.dropdownSelectedClass,
1385
+ searchable: __props.searchable,
1386
+ "search-placeholder": __props.searchPlaceholder,
1387
+ "search-input-class": __props.searchInputClass,
1333
1388
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event))
1334
- }, _ctx.$attrs), null, 16, ["model-value", "model-modifiers", "options", "placeholder", "placeholder-disabled", "multiple", "disabled", "soft-delete-aware", "label-key", "value-key", "deleted-key", "option-label", "base-class", "normal-text-class", "deleted-selected-class", "option-class", "deleted-option-class", "placeholder-class", "dropdown-class", "dropdown-option-class", "dropdown-selected-class"]);
1389
+ }, _ctx.$attrs), null, 16, ["model-value", "model-modifiers", "options", "placeholder", "placeholder-disabled", "multiple", "disabled", "soft-delete-aware", "label-key", "value-key", "deleted-key", "option-label", "base-class", "normal-text-class", "deleted-selected-class", "option-class", "deleted-option-class", "placeholder-class", "dropdown-class", "dropdown-option-class", "dropdown-selected-class", "searchable", "search-placeholder", "search-input-class"]);
1335
1390
  };
1336
1391
  }
1337
1392
  };
@@ -2190,13 +2245,32 @@ const _sfc_main$x = {
2190
2245
  default: "html"
2191
2246
  }
2192
2247
  },
2193
- emits: ["update:modelValue", "blur"],
2194
- setup(__props, { emit: __emit }) {
2248
+ emits: ["update:modelValue", "blur", "init"],
2249
+ setup(__props, { expose: __expose, emit: __emit }) {
2195
2250
  const props = __props;
2196
2251
  const emit = __emit;
2197
2252
  const content = ref(props.modelValue ?? "");
2198
2253
  const isEditorReady = ref(false);
2199
2254
  const editorRevision = ref(0);
2255
+ const editorComponentRef = ref(null);
2256
+ const editorInstance = ref(null);
2257
+ const getEditor = () => editorInstance.value ?? editorComponentRef.value?.getEditor?.() ?? null;
2258
+ const syncContentFromEditor = (editor = getEditor()) => {
2259
+ if (!editor) {
2260
+ return "";
2261
+ }
2262
+ const nextValue = editor.getContent({ format: props.outputFormat });
2263
+ content.value = nextValue;
2264
+ emit("update:modelValue", nextValue);
2265
+ return nextValue;
2266
+ };
2267
+ const waitForFrames = async (frameCount = 1) => {
2268
+ for (let index = 0; index < frameCount; index += 1) {
2269
+ await new Promise((resolve) => {
2270
+ requestAnimationFrame(() => resolve());
2271
+ });
2272
+ }
2273
+ };
2200
2274
  const loadTinyMce = async () => {
2201
2275
  const tinymceModule = await import("./tinymce-WPdeGquX.js").then((n) => n.t);
2202
2276
  const tinymce = tinymceModule.default ?? tinymceModule;
@@ -2247,23 +2321,80 @@ const _sfc_main$x = {
2247
2321
  onMounted(() => {
2248
2322
  void loadTinyMce();
2249
2323
  });
2324
+ onBeforeUnmount(() => {
2325
+ editorInstance.value = null;
2326
+ });
2327
+ const handleEditorInit = (_event, editor) => {
2328
+ editorInstance.value = editor;
2329
+ emit("init", editor);
2330
+ };
2250
2331
  const handleEditorInput = (_event, editor) => {
2251
- const nextValue = editor.getContent({ format: props.outputFormat });
2252
- content.value = nextValue;
2253
- emit("update:modelValue", nextValue);
2332
+ syncContentFromEditor(editor);
2254
2333
  };
2255
2334
  const handleEditorBlur = (_event, editor) => {
2256
2335
  emit("blur", editor.getContent({ format: props.outputFormat }));
2257
2336
  };
2337
+ __expose({
2338
+ getEditor,
2339
+ focus: () => getEditor()?.focus(),
2340
+ execCommand: (command, ui = false, value) => getEditor()?.execCommand(command, ui, value),
2341
+ getContent: (options) => getEditor()?.getContent(options) ?? "",
2342
+ getBody: () => getEditor()?.getBody?.() ?? null,
2343
+ selectNode: (node) => {
2344
+ const editor = getEditor();
2345
+ if (!editor || !node) {
2346
+ return;
2347
+ }
2348
+ editor.selection.select(node);
2349
+ },
2350
+ getBookmark: () => getEditor()?.selection.getBookmark() ?? null,
2351
+ moveToBookmark: (bookmark) => {
2352
+ const editor = getEditor();
2353
+ if (!editor || !bookmark) {
2354
+ return;
2355
+ }
2356
+ editor.selection.moveToBookmark(bookmark);
2357
+ },
2358
+ syncContent: () => syncContentFromEditor(),
2359
+ insertContent: async (value, options = {}) => {
2360
+ const editor = getEditor();
2361
+ if (!editor) {
2362
+ return null;
2363
+ }
2364
+ editor.focus();
2365
+ editor.insertContent(value);
2366
+ if (options.selectLast) {
2367
+ await waitForFrames(options.frames ?? 2);
2368
+ const matchingNodes = Array.from(
2369
+ editor.getBody().querySelectorAll(options.selectLast)
2370
+ );
2371
+ const selectedNode = matchingNodes.at(-1);
2372
+ if (selectedNode) {
2373
+ editor.selection.select(selectedNode);
2374
+ }
2375
+ }
2376
+ if (options.command) {
2377
+ await waitForFrames(options.frames ?? 2);
2378
+ editor.execCommand(options.command, false, options.commandValue);
2379
+ }
2380
+ if (options.sync !== false) {
2381
+ syncContentFromEditor(editor);
2382
+ }
2383
+ return editor;
2384
+ }
2385
+ });
2258
2386
  return (_ctx, _cache) => {
2259
2387
  return openBlock(), createElementBlock("div", { key: editorKey.value }, [
2260
2388
  !isEditorReady.value ? (openBlock(), createElementBlock("div", _hoisted_1$l)) : (openBlock(), createBlock(unref(Editor), {
2261
2389
  key: 1,
2390
+ ref_key: "editorComponentRef",
2391
+ ref: editorComponentRef,
2262
2392
  "initial-value": content.value,
2263
2393
  "license-key": __props.licenseKey,
2264
2394
  readonly: __props.readonly,
2265
2395
  "output-format": __props.outputFormat,
2266
2396
  init: editorInit.value,
2397
+ onInit: handleEditorInit,
2267
2398
  onInput: handleEditorInput,
2268
2399
  onBlur: handleEditorBlur
2269
2400
  }, null, 8, ["initial-value", "license-key", "readonly", "output-format", "init"]))
@@ -3210,6 +3341,18 @@ const _sfc_main$v = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
3210
3341
  variant: {
3211
3342
  type: String,
3212
3343
  default: "classic"
3344
+ },
3345
+ searchable: {
3346
+ type: Boolean,
3347
+ default: false
3348
+ },
3349
+ searchPlaceholder: {
3350
+ type: String,
3351
+ default: "Search..."
3352
+ },
3353
+ searchInputClass: {
3354
+ type: [String, Array, Object],
3355
+ default: void 0
3213
3356
  }
3214
3357
  },
3215
3358
  emits: ["update:modelValue", "blur"],
@@ -3312,6 +3455,11 @@ const _sfc_main$v = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
3312
3455
  inputProps.deletedOptionClass = props.deletedOptionClass;
3313
3456
  if (props.placeholderClass !== void 0)
3314
3457
  inputProps.placeholderClass = props.placeholderClass;
3458
+ if (props.searchable !== void 0) inputProps.searchable = props.searchable;
3459
+ if (props.searchPlaceholder !== void 0)
3460
+ inputProps.searchPlaceholder = props.searchPlaceholder;
3461
+ if (props.searchInputClass !== void 0)
3462
+ inputProps.searchInputClass = props.searchInputClass;
3315
3463
  return inputProps;
3316
3464
  });
3317
3465
  const notationBindings = computed(() => ({
@@ -6119,4 +6267,4 @@ export {
6119
6267
  _sfc_main$B as y,
6120
6268
  _sfc_main$A as z
6121
6269
  };
6122
- //# sourceMappingURL=plugin-HUdH_CuM.js.map
6270
+ //# sourceMappingURL=plugin-Bc62JLDw.js.map