@mekari/pixel3-rich-text-editor 0.2.1-dev.1 → 0.3.0-dev.2

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.
@@ -30,6 +30,7 @@ interface RichTextEditorProps {
30
30
  options?: ToolbarOption[][];
31
31
  suggestions?: MentionSuggestionSource;
32
32
  maxSuggestions?: number;
33
+ mentionEmptyText?: string | ((query: string) => string);
33
34
  variables?: VariableSuggestionItem[];
34
35
  isInvalid: boolean;
35
36
  isDisabled: boolean;
@@ -30,6 +30,7 @@ interface RichTextEditorProps {
30
30
  options?: ToolbarOption[][];
31
31
  suggestions?: MentionSuggestionSource;
32
32
  maxSuggestions?: number;
33
+ mentionEmptyText?: string | ((query: string) => string);
33
34
  variables?: VariableSuggestionItem[];
34
35
  isInvalid: boolean;
35
36
  isDisabled: boolean;
@@ -39,6 +39,10 @@ declare const MpRichTextEditor: vue.DefineComponent<{
39
39
  type: vue.PropType<number | undefined>;
40
40
  default: number;
41
41
  };
42
+ mentionEmptyText: {
43
+ type: vue.PropType<string | ((query: string) => string) | undefined>;
44
+ default: string;
45
+ };
42
46
  variables: {
43
47
  type: vue.PropType<VariableSuggestionItem[] | undefined>;
44
48
  default: () => never[];
@@ -88,6 +92,10 @@ declare const MpRichTextEditor: vue.DefineComponent<{
88
92
  type: vue.PropType<number | undefined>;
89
93
  default: number;
90
94
  };
95
+ mentionEmptyText: {
96
+ type: vue.PropType<string | ((query: string) => string) | undefined>;
97
+ default: string;
98
+ };
91
99
  variables: {
92
100
  type: vue.PropType<VariableSuggestionItem[] | undefined>;
93
101
  default: () => never[];
@@ -102,19 +110,20 @@ declare const MpRichTextEditor: vue.DefineComponent<{
102
110
  type: vue.PropType<((url: string) => string) | undefined>;
103
111
  };
104
112
  }>> & {
105
- onPaste?: ((...args: any[]) => any) | undefined;
106
- onFocus?: ((...args: any[]) => any) | undefined;
107
- onBlur?: ((...args: any[]) => any) | undefined;
108
113
  onChange?: ((...args: any[]) => any) | undefined;
114
+ onBlur?: ((...args: any[]) => any) | undefined;
115
+ onFocus?: ((...args: any[]) => any) | undefined;
109
116
  onAction?: ((...args: any[]) => any) | undefined;
117
+ onPaste?: ((...args: any[]) => any) | undefined;
110
118
  onSuggestionsChange?: ((...args: any[]) => any) | undefined;
111
119
  }, {
112
- suggestions: MentionSuggestionSource | undefined;
113
- maxSuggestions: number | undefined;
114
- variables: VariableSuggestionItem[] | undefined;
115
120
  isInvalid: boolean;
116
121
  isDisabled: boolean;
117
122
  hasBorder: boolean | undefined;
123
+ suggestions: MentionSuggestionSource | undefined;
124
+ maxSuggestions: number | undefined;
125
+ mentionEmptyText: string | ((query: string) => string) | undefined;
126
+ variables: VariableSuggestionItem[] | undefined;
118
127
  }, {}>;
119
128
 
120
129
  export { MpRichTextEditor };
@@ -39,6 +39,10 @@ declare const MpRichTextEditor: vue.DefineComponent<{
39
39
  type: vue.PropType<number | undefined>;
40
40
  default: number;
41
41
  };
42
+ mentionEmptyText: {
43
+ type: vue.PropType<string | ((query: string) => string) | undefined>;
44
+ default: string;
45
+ };
42
46
  variables: {
43
47
  type: vue.PropType<VariableSuggestionItem[] | undefined>;
44
48
  default: () => never[];
@@ -88,6 +92,10 @@ declare const MpRichTextEditor: vue.DefineComponent<{
88
92
  type: vue.PropType<number | undefined>;
89
93
  default: number;
90
94
  };
95
+ mentionEmptyText: {
96
+ type: vue.PropType<string | ((query: string) => string) | undefined>;
97
+ default: string;
98
+ };
91
99
  variables: {
92
100
  type: vue.PropType<VariableSuggestionItem[] | undefined>;
93
101
  default: () => never[];
@@ -102,19 +110,20 @@ declare const MpRichTextEditor: vue.DefineComponent<{
102
110
  type: vue.PropType<((url: string) => string) | undefined>;
103
111
  };
104
112
  }>> & {
105
- onPaste?: ((...args: any[]) => any) | undefined;
106
- onFocus?: ((...args: any[]) => any) | undefined;
107
- onBlur?: ((...args: any[]) => any) | undefined;
108
113
  onChange?: ((...args: any[]) => any) | undefined;
114
+ onBlur?: ((...args: any[]) => any) | undefined;
115
+ onFocus?: ((...args: any[]) => any) | undefined;
109
116
  onAction?: ((...args: any[]) => any) | undefined;
117
+ onPaste?: ((...args: any[]) => any) | undefined;
110
118
  onSuggestionsChange?: ((...args: any[]) => any) | undefined;
111
119
  }, {
112
- suggestions: MentionSuggestionSource | undefined;
113
- maxSuggestions: number | undefined;
114
- variables: VariableSuggestionItem[] | undefined;
115
120
  isInvalid: boolean;
116
121
  isDisabled: boolean;
117
122
  hasBorder: boolean | undefined;
123
+ suggestions: MentionSuggestionSource | undefined;
124
+ maxSuggestions: number | undefined;
125
+ mentionEmptyText: string | ((query: string) => string) | undefined;
126
+ variables: VariableSuggestionItem[] | undefined;
118
127
  }, {}>;
119
128
 
120
129
  export { MpRichTextEditor };
@@ -76,6 +76,10 @@ var richTextEditorProps = {
76
76
  type: Number,
77
77
  default: 50
78
78
  },
79
+ mentionEmptyText: {
80
+ type: [String, Function],
81
+ default: "No result"
82
+ },
79
83
  variables: {
80
84
  type: Array,
81
85
  default: () => []
@@ -1810,7 +1814,8 @@ var import_css7 = require("@mekari/pixel3-styled-system/css");
1810
1814
  var import_pixel3_avatar = require("@mekari/pixel3-avatar");
1811
1815
  var import_pixel3_popover4 = require("@mekari/pixel3-popover");
1812
1816
  var import_pixel3_text3 = require("@mekari/pixel3-text");
1813
- var import_pixel3_spinner = require("@mekari/pixel3-spinner");
1817
+ var import_pixel3_skeleton = require("@mekari/pixel3-skeleton");
1818
+ var SKELETON_ROW_COUNT = 3;
1814
1819
  var avatarVariantColors = ["violet", "lime", "amber", "sky", "pink", "teal", "rose", "stone"];
1815
1820
  var getAvatarVariantColor = /* @__PURE__ */ __name((index) => {
1816
1821
  return avatarVariantColors[index % avatarVariantColors.length];
@@ -1829,6 +1834,10 @@ var MentionList = (0, import_vue21.defineComponent)({
1829
1834
  isLoading: {
1830
1835
  type: Boolean,
1831
1836
  default: false
1837
+ },
1838
+ emptyText: {
1839
+ type: String,
1840
+ default: "No result"
1832
1841
  }
1833
1842
  },
1834
1843
  setup(props, {
@@ -1836,6 +1845,16 @@ var MentionList = (0, import_vue21.defineComponent)({
1836
1845
  }) {
1837
1846
  const selectedIndex = (0, import_vue21.ref)(0);
1838
1847
  const listRef = (0, import_vue21.ref)(null);
1848
+ const hasResolvedNonEmptyBatch = (0, import_vue21.ref)(false);
1849
+ (0, import_vue21.watch)(() => props.items, (items) => {
1850
+ if (items.length > 0) {
1851
+ hasResolvedNonEmptyBatch.value = true;
1852
+ }
1853
+ }, {
1854
+ immediate: true
1855
+ });
1856
+ const hasAvatarData = (0, import_vue21.computed)(() => !hasResolvedNonEmptyBatch.value || props.items.some((item) => item.avatar));
1857
+ const hasDescriptionData = (0, import_vue21.computed)(() => !hasResolvedNonEmptyBatch.value || props.items.some((item) => item.description));
1839
1858
  const scrollToFocusedItem = /* @__PURE__ */ __name(() => {
1840
1859
  (0, import_vue21.nextTick)(() => {
1841
1860
  if (!listRef.value)
@@ -1916,20 +1935,54 @@ var MentionList = (0, import_vue21.defineComponent)({
1916
1935
  default: () => [props.isLoading && (0, import_vue20.createVNode)("div", {
1917
1936
  "class": (0, import_css7.css)({
1918
1937
  display: "flex",
1919
- justifyContent: "center",
1920
- px: "3",
1921
- py: "3"
1938
+ flexDirection: "column",
1939
+ gap: "3",
1940
+ p: "3",
1941
+ width: "full"
1942
+ })
1943
+ }, [Array.from({
1944
+ length: SKELETON_ROW_COUNT
1945
+ }, (_, index) => (0, import_vue20.createVNode)("div", {
1946
+ "key": index,
1947
+ "class": (0, import_css7.css)({
1948
+ display: "flex",
1949
+ alignItems: "center",
1950
+ gap: "2",
1951
+ width: "full"
1952
+ })
1953
+ }, [hasAvatarData.value && (0, import_vue20.createVNode)(import_pixel3_skeleton.MpSkeleton, {
1954
+ "class": (0, import_css7.css)({
1955
+ width: "9",
1956
+ height: "9",
1957
+ rounded: "full"
1958
+ })
1959
+ }, null), (0, import_vue20.createVNode)("div", {
1960
+ "class": (0, import_css7.css)({
1961
+ display: "flex",
1962
+ flexDirection: "column",
1963
+ gap: "1",
1964
+ width: "full"
1965
+ })
1966
+ }, [(0, import_vue20.createVNode)(import_pixel3_skeleton.MpSkeleton, {
1967
+ "class": (0, import_css7.css)({
1968
+ width: "40%",
1969
+ height: "14px",
1970
+ rounded: "sm"
1971
+ })
1972
+ }, null), hasDescriptionData.value && (0, import_vue20.createVNode)(import_pixel3_skeleton.MpSkeleton, {
1973
+ "class": (0, import_css7.css)({
1974
+ width: "70%",
1975
+ height: "12px",
1976
+ rounded: "sm"
1922
1977
  })
1923
- }, [(0, import_vue20.createVNode)(import_pixel3_spinner.MpSpinner, {
1924
- "size": "sm"
1925
- }, null)]), !props.isLoading && !props.items.length && (0, import_vue20.createVNode)(import_pixel3_text3.MpText, {
1978
+ }, null)])]))]), !props.isLoading && !props.items.length && (0, import_vue20.createVNode)(import_pixel3_text3.MpText, {
1926
1979
  "color": "text.secondary",
1927
1980
  "class": (0, import_css7.css)({
1928
1981
  px: "3",
1929
1982
  py: "2"
1930
1983
  })
1931
1984
  }, {
1932
- default: () => [(0, import_vue20.createTextVNode)("No result")]
1985
+ default: () => [props.emptyText]
1933
1986
  }), !props.isLoading && props.items.map((item, index) => {
1934
1987
  return (0, import_vue20.createVNode)(import_pixel3_popover4.MpPopoverListItem, {
1935
1988
  "key": `${item.id}-${index}`,
@@ -1998,21 +2051,24 @@ var getFilteredSuggestionItems = /* @__PURE__ */ __name((items, query, maxItems)
1998
2051
  }).slice(0, maxItems);
1999
2052
  }, "getFilteredSuggestionItems");
2000
2053
  var createMentionSuggestion = /* @__PURE__ */ __name((getSuggestionSource = () => [], options = {}) => {
2001
- var _a;
2054
+ var _a, _b;
2002
2055
  const maxItems = (_a = options.maxItems) != null ? _a : 50;
2056
+ const emptyTextOption = (_b = options.emptyText) != null ? _b : "No result";
2057
+ const resolveEmptyText = /* @__PURE__ */ __name((query) => typeof emptyTextOption === "function" ? emptyTextOption(query) : emptyTextOption, "resolveEmptyText");
2058
+ let latestRequestId = 0;
2003
2059
  return {
2004
2060
  items: async ({
2005
2061
  query
2006
2062
  }) => {
2007
- var _a2, _b, _c;
2063
+ var _a2, _b2;
2064
+ const requestId = ++latestRequestId;
2008
2065
  const source = getSuggestionSource();
2009
- if (typeof source === "function") {
2010
- const items2 = ((_a2 = await source(query)) != null ? _a2 : []).slice(0, maxItems);
2011
- (_b = options.onSuggestionsChange) == null ? void 0 : _b.call(options, items2);
2012
- return items2;
2066
+ const items = typeof source === "function" ? ((_a2 = await source(query)) != null ? _a2 : []).slice(0, maxItems) : getFilteredSuggestionItems(source != null ? source : [], query, maxItems);
2067
+ if (requestId !== latestRequestId) {
2068
+ return new Promise(() => {
2069
+ });
2013
2070
  }
2014
- const items = getFilteredSuggestionItems(source != null ? source : [], query, maxItems);
2015
- (_c = options.onSuggestionsChange) == null ? void 0 : _c.call(options, items);
2071
+ (_b2 = options.onSuggestionsChange) == null ? void 0 : _b2.call(options, items);
2016
2072
  return items;
2017
2073
  },
2018
2074
  render: () => {
@@ -2115,7 +2171,8 @@ var createMentionSuggestion = /* @__PURE__ */ __name((getSuggestionSource = () =
2115
2171
  props: {
2116
2172
  items: [],
2117
2173
  command: props.command,
2118
- isLoading: true
2174
+ isLoading: true,
2175
+ emptyText: resolveEmptyText(props.query)
2119
2176
  }
2120
2177
  });
2121
2178
  popoverWrapper = document.createElement("div");
@@ -2133,7 +2190,8 @@ var createMentionSuggestion = /* @__PURE__ */ __name((getSuggestionSource = () =
2133
2190
  component == null ? void 0 : component.updateProps({
2134
2191
  items: props.items,
2135
2192
  command: props.command,
2136
- isLoading: false
2193
+ isLoading: false,
2194
+ emptyText: resolveEmptyText(props.query)
2137
2195
  });
2138
2196
  updatePopoverPosition();
2139
2197
  },
@@ -2150,17 +2208,18 @@ var createMentionSuggestion = /* @__PURE__ */ __name((getSuggestionSource = () =
2150
2208
  component == null ? void 0 : component.updateProps({
2151
2209
  items: props.items,
2152
2210
  command: props.command,
2153
- isLoading: false
2211
+ isLoading: false,
2212
+ emptyText: resolveEmptyText(props.query)
2154
2213
  });
2155
2214
  updatePopoverPosition();
2156
2215
  },
2157
2216
  onKeyDown: (props) => {
2158
- var _a2, _b;
2217
+ var _a2, _b2;
2159
2218
  if (props.event.key === "Escape") {
2160
2219
  destroyMentionPopover();
2161
2220
  return true;
2162
2221
  }
2163
- return (_b = (_a2 = component == null ? void 0 : component.ref) == null ? void 0 : _a2.onKeyDown(props)) != null ? _b : false;
2222
+ return (_b2 = (_a2 = component == null ? void 0 : component.ref) == null ? void 0 : _a2.onKeyDown(props)) != null ? _b2 : false;
2164
2223
  },
2165
2224
  onExit: () => {
2166
2225
  destroyMentionPopover();
@@ -2422,6 +2481,7 @@ var MpRichTextEditor = (0, import_vue23.defineComponent)({
2422
2481
  ...typeof props.suggestions === "function" || props.suggestions && props.suggestions.length > 0 ? [import_extension_mention.default.configure({
2423
2482
  suggestion: createMentionSuggestion(() => props.suggestions, {
2424
2483
  maxItems: props.maxSuggestions,
2484
+ emptyText: props.mentionEmptyText,
2425
2485
  onSuggestionsChange: (items) => emit("suggestionsChange", items)
2426
2486
  })
2427
2487
  })] : [],
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  MpRichTextEditor
3
- } from "./chunk-E4R6ETA7.mjs";
3
+ } from "./chunk-LUWDIXAC.mjs";
4
4
  import "./chunk-RX7ZEE2M.mjs";
5
5
  import "./chunk-HIHIKPNN.mjs";
6
6
  import "./chunk-X2CB42A3.mjs";
7
7
  import "./chunk-COZ45QUD.mjs";
8
8
  import "./chunk-FCLBNBXD.mjs";
9
9
  import "./chunk-ENKUUZPM.mjs";
10
- import "./chunk-RVXAG7LK.mjs";
10
+ import "./chunk-6SZJ4DXO.mjs";
11
11
  import "./chunk-ZRAXSVO5.mjs";
12
12
  import "./chunk-ZAXJ3BEP.mjs";
13
- import "./chunk-B5BN5T5O.mjs";
14
- import "./chunk-RTEK53TL.mjs";
15
- import "./chunk-ELFAGDKG.mjs";
13
+ import "./chunk-QJYUKM5Q.mjs";
14
+ import "./chunk-7T3KAUCV.mjs";
15
+ import "./chunk-NC3P3FRE.mjs";
16
16
  import "./chunk-BWRU2WZN.mjs";
17
17
  import "./chunk-76GEEOAG.mjs";
18
18
  import "./chunk-YWVVMJGP.mjs";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  MpRTEStyleProvider
3
- } from "./chunk-RVXAG7LK.mjs";
3
+ } from "./chunk-6SZJ4DXO.mjs";
4
4
  import "./chunk-ZRAXSVO5.mjs";
5
5
  import "./chunk-ZAXJ3BEP.mjs";
6
- import "./chunk-B5BN5T5O.mjs";
6
+ import "./chunk-QJYUKM5Q.mjs";
7
7
  import "./chunk-QZ7VFGWC.mjs";
8
8
  export {
9
9
  MpRTEStyleProvider
@@ -4,6 +4,7 @@ import '@mekari/pixel3-utils';
4
4
 
5
5
  interface CreateMentionSuggestionOptions {
6
6
  maxItems?: number;
7
+ emptyText?: string | ((query: string) => string);
7
8
  onSuggestionsChange?: (items: MentionSuggestionItem[]) => void;
8
9
  }
9
10
  declare const createMentionSuggestion: (getSuggestionSource?: () => MentionSuggestionSource | undefined, options?: CreateMentionSuggestionOptions) => MentionOptions['suggestion'];
@@ -4,6 +4,7 @@ import '@mekari/pixel3-utils';
4
4
 
5
5
  interface CreateMentionSuggestionOptions {
6
6
  maxItems?: number;
7
+ emptyText?: string | ((query: string) => string);
7
8
  onSuggestionsChange?: (items: MentionSuggestionItem[]) => void;
8
9
  }
9
10
  declare const createMentionSuggestion: (getSuggestionSource?: () => MentionSuggestionSource | undefined, options?: CreateMentionSuggestionOptions) => MentionOptions['suggestion'];
@@ -34,7 +34,8 @@ var import_css = require("@mekari/pixel3-styled-system/css");
34
34
  var import_pixel3_avatar = require("@mekari/pixel3-avatar");
35
35
  var import_pixel3_popover = require("@mekari/pixel3-popover");
36
36
  var import_pixel3_text = require("@mekari/pixel3-text");
37
- var import_pixel3_spinner = require("@mekari/pixel3-spinner");
37
+ var import_pixel3_skeleton = require("@mekari/pixel3-skeleton");
38
+ var SKELETON_ROW_COUNT = 3;
38
39
  var avatarVariantColors = ["violet", "lime", "amber", "sky", "pink", "teal", "rose", "stone"];
39
40
  var getAvatarVariantColor = /* @__PURE__ */ __name((index) => {
40
41
  return avatarVariantColors[index % avatarVariantColors.length];
@@ -53,6 +54,10 @@ var MentionList = (0, import_vue2.defineComponent)({
53
54
  isLoading: {
54
55
  type: Boolean,
55
56
  default: false
57
+ },
58
+ emptyText: {
59
+ type: String,
60
+ default: "No result"
56
61
  }
57
62
  },
58
63
  setup(props, {
@@ -60,6 +65,16 @@ var MentionList = (0, import_vue2.defineComponent)({
60
65
  }) {
61
66
  const selectedIndex = (0, import_vue2.ref)(0);
62
67
  const listRef = (0, import_vue2.ref)(null);
68
+ const hasResolvedNonEmptyBatch = (0, import_vue2.ref)(false);
69
+ (0, import_vue2.watch)(() => props.items, (items) => {
70
+ if (items.length > 0) {
71
+ hasResolvedNonEmptyBatch.value = true;
72
+ }
73
+ }, {
74
+ immediate: true
75
+ });
76
+ const hasAvatarData = (0, import_vue2.computed)(() => !hasResolvedNonEmptyBatch.value || props.items.some((item) => item.avatar));
77
+ const hasDescriptionData = (0, import_vue2.computed)(() => !hasResolvedNonEmptyBatch.value || props.items.some((item) => item.description));
63
78
  const scrollToFocusedItem = /* @__PURE__ */ __name(() => {
64
79
  (0, import_vue2.nextTick)(() => {
65
80
  if (!listRef.value)
@@ -140,20 +155,54 @@ var MentionList = (0, import_vue2.defineComponent)({
140
155
  default: () => [props.isLoading && (0, import_vue.createVNode)("div", {
141
156
  "class": (0, import_css.css)({
142
157
  display: "flex",
143
- justifyContent: "center",
144
- px: "3",
145
- py: "3"
158
+ flexDirection: "column",
159
+ gap: "3",
160
+ p: "3",
161
+ width: "full"
162
+ })
163
+ }, [Array.from({
164
+ length: SKELETON_ROW_COUNT
165
+ }, (_, index) => (0, import_vue.createVNode)("div", {
166
+ "key": index,
167
+ "class": (0, import_css.css)({
168
+ display: "flex",
169
+ alignItems: "center",
170
+ gap: "2",
171
+ width: "full"
172
+ })
173
+ }, [hasAvatarData.value && (0, import_vue.createVNode)(import_pixel3_skeleton.MpSkeleton, {
174
+ "class": (0, import_css.css)({
175
+ width: "9",
176
+ height: "9",
177
+ rounded: "full"
146
178
  })
147
- }, [(0, import_vue.createVNode)(import_pixel3_spinner.MpSpinner, {
148
- "size": "sm"
149
- }, null)]), !props.isLoading && !props.items.length && (0, import_vue.createVNode)(import_pixel3_text.MpText, {
179
+ }, null), (0, import_vue.createVNode)("div", {
180
+ "class": (0, import_css.css)({
181
+ display: "flex",
182
+ flexDirection: "column",
183
+ gap: "1",
184
+ width: "full"
185
+ })
186
+ }, [(0, import_vue.createVNode)(import_pixel3_skeleton.MpSkeleton, {
187
+ "class": (0, import_css.css)({
188
+ width: "40%",
189
+ height: "14px",
190
+ rounded: "sm"
191
+ })
192
+ }, null), hasDescriptionData.value && (0, import_vue.createVNode)(import_pixel3_skeleton.MpSkeleton, {
193
+ "class": (0, import_css.css)({
194
+ width: "70%",
195
+ height: "12px",
196
+ rounded: "sm"
197
+ })
198
+ }, null)])]))]), !props.isLoading && !props.items.length && (0, import_vue.createVNode)(import_pixel3_text.MpText, {
150
199
  "color": "text.secondary",
151
200
  "class": (0, import_css.css)({
152
201
  px: "3",
153
202
  py: "2"
154
203
  })
155
204
  }, {
156
- default: () => [(0, import_vue.createTextVNode)("No result")]
205
+ default: () => [props.emptyText]
157
206
  }), !props.isLoading && props.items.map((item, index) => {
158
207
  return (0, import_vue.createVNode)(import_pixel3_popover.MpPopoverListItem, {
159
208
  "key": `${item.id}-${index}`,
@@ -222,21 +271,24 @@ var getFilteredSuggestionItems = /* @__PURE__ */ __name((items, query, maxItems)
222
271
  }).slice(0, maxItems);
223
272
  }, "getFilteredSuggestionItems");
224
273
  var createMentionSuggestion = /* @__PURE__ */ __name((getSuggestionSource = () => [], options = {}) => {
225
- var _a;
274
+ var _a, _b;
226
275
  const maxItems = (_a = options.maxItems) != null ? _a : 50;
276
+ const emptyTextOption = (_b = options.emptyText) != null ? _b : "No result";
277
+ const resolveEmptyText = /* @__PURE__ */ __name((query) => typeof emptyTextOption === "function" ? emptyTextOption(query) : emptyTextOption, "resolveEmptyText");
278
+ let latestRequestId = 0;
227
279
  return {
228
280
  items: async ({
229
281
  query
230
282
  }) => {
231
- var _a2, _b, _c;
283
+ var _a2, _b2;
284
+ const requestId = ++latestRequestId;
232
285
  const source = getSuggestionSource();
233
- if (typeof source === "function") {
234
- const items2 = ((_a2 = await source(query)) != null ? _a2 : []).slice(0, maxItems);
235
- (_b = options.onSuggestionsChange) == null ? void 0 : _b.call(options, items2);
236
- return items2;
286
+ const items = typeof source === "function" ? ((_a2 = await source(query)) != null ? _a2 : []).slice(0, maxItems) : getFilteredSuggestionItems(source != null ? source : [], query, maxItems);
287
+ if (requestId !== latestRequestId) {
288
+ return new Promise(() => {
289
+ });
237
290
  }
238
- const items = getFilteredSuggestionItems(source != null ? source : [], query, maxItems);
239
- (_c = options.onSuggestionsChange) == null ? void 0 : _c.call(options, items);
291
+ (_b2 = options.onSuggestionsChange) == null ? void 0 : _b2.call(options, items);
240
292
  return items;
241
293
  },
242
294
  render: () => {
@@ -339,7 +391,8 @@ var createMentionSuggestion = /* @__PURE__ */ __name((getSuggestionSource = () =
339
391
  props: {
340
392
  items: [],
341
393
  command: props.command,
342
- isLoading: true
394
+ isLoading: true,
395
+ emptyText: resolveEmptyText(props.query)
343
396
  }
344
397
  });
345
398
  popoverWrapper = document.createElement("div");
@@ -357,7 +410,8 @@ var createMentionSuggestion = /* @__PURE__ */ __name((getSuggestionSource = () =
357
410
  component == null ? void 0 : component.updateProps({
358
411
  items: props.items,
359
412
  command: props.command,
360
- isLoading: false
413
+ isLoading: false,
414
+ emptyText: resolveEmptyText(props.query)
361
415
  });
362
416
  updatePopoverPosition();
363
417
  },
@@ -374,17 +428,18 @@ var createMentionSuggestion = /* @__PURE__ */ __name((getSuggestionSource = () =
374
428
  component == null ? void 0 : component.updateProps({
375
429
  items: props.items,
376
430
  command: props.command,
377
- isLoading: false
431
+ isLoading: false,
432
+ emptyText: resolveEmptyText(props.query)
378
433
  });
379
434
  updatePopoverPosition();
380
435
  },
381
436
  onKeyDown: (props) => {
382
- var _a2, _b;
437
+ var _a2, _b2;
383
438
  if (props.event.key === "Escape") {
384
439
  destroyMentionPopover();
385
440
  return true;
386
441
  }
387
- return (_b = (_a2 = component == null ? void 0 : component.ref) == null ? void 0 : _a2.onKeyDown(props)) != null ? _b : false;
442
+ return (_b2 = (_a2 = component == null ? void 0 : component.ref) == null ? void 0 : _a2.onKeyDown(props)) != null ? _b2 : false;
388
443
  },
389
444
  onExit: () => {
390
445
  destroyMentionPopover();
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createMentionSuggestion
3
- } from "./chunk-RTEK53TL.mjs";
4
- import "./chunk-ELFAGDKG.mjs";
3
+ } from "./chunk-7T3KAUCV.mjs";
4
+ import "./chunk-NC3P3FRE.mjs";
5
5
  import "./chunk-QZ7VFGWC.mjs";
6
6
  export {
7
7
  createMentionSuggestion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mekari/pixel3-rich-text-editor",
3
3
  "description": "Mekari Pixel 3 | Rich text editor component is used to content editor based Tiptap.js",
4
- "version": "0.2.1-dev.1",
4
+ "version": "0.3.0-dev.2",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
7
7
  "files": [
@@ -42,16 +42,16 @@
42
42
  "@tiptap/suggestion": "2.7.4",
43
43
  "@tiptap/vue-3": "2.7.4",
44
44
  "@mekari/pixel3-avatar": "0.0.30-dev.1",
45
- "@mekari/pixel3-form-control": "0.0.25-dev.1",
46
- "@mekari/pixel3-divider": "0.0.25-dev.1",
47
45
  "@mekari/pixel3-color-picker": "0.2.4-dev.1",
46
+ "@mekari/pixel3-divider": "0.0.25-dev.1",
48
47
  "@mekari/pixel3-button": "0.2.5-dev.1",
48
+ "@mekari/pixel3-form-control": "0.0.25-dev.1",
49
49
  "@mekari/pixel3-input": "0.0.30-dev.1",
50
50
  "@mekari/pixel3-popover": "0.0.30-dev.1",
51
51
  "@mekari/pixel3-scrollbar": "0.1.9-dev.1",
52
- "@mekari/pixel3-spinner": "0.0.30-dev.1",
53
- "@mekari/pixel3-styled-system": "0.3.1-dev.1",
52
+ "@mekari/pixel3-skeleton": "0.1.8-dev.1",
54
53
  "@mekari/pixel3-text": "0.0.25-dev.1",
54
+ "@mekari/pixel3-styled-system": "0.3.1-dev.1",
55
55
  "@mekari/pixel3-utils": "0.1.0"
56
56
  },
57
57
  "peerDependencies": {