@vertexvis/ui 0.1.0-canary.14 → 0.1.0-canary.15

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.
@@ -32,7 +32,7 @@ const radio = require('./radio-bff991d2.js');
32
32
  const radioGroup = require('./radio-group-d628f631.js');
33
33
  const resizable = require('./resizable-e4248256.js');
34
34
  const resultList = require('./result-list-241ffe8d.js');
35
- const searchBar = require('./search-bar-91cbcd07.js');
35
+ const searchBar = require('./search-bar-2e7ee35a.js');
36
36
  const select = require('./select-5f8aecfe.js');
37
37
  const slider = require('./slider-13594e49.js');
38
38
  const spinner = require('./spinner-bb990a42.js');
@@ -55,12 +55,24 @@ const getWindowSelection = () => {
55
55
  }
56
56
  return undefined;
57
57
  };
58
+ const nodeHasChildNodes = (node) => {
59
+ return node.hasChildNodes();
60
+ };
58
61
  const createDocumentRange = () => {
59
62
  return document.createRange();
60
63
  };
61
64
  const createTextNode = (text) => {
62
65
  return new Text(text);
63
66
  };
67
+ const createBreak = () => {
68
+ return document.createElement('br');
69
+ };
70
+ const isHtmlElement = (node) => {
71
+ return node instanceof HTMLElement;
72
+ };
73
+ const isBrElement = (node) => {
74
+ return node instanceof HTMLBRElement;
75
+ };
64
76
 
65
77
  const createResultUri = (result) => {
66
78
  return `${result.type}:${result.id}`;
@@ -71,15 +83,56 @@ const createSearchResultReplacement = (result, before, after) => {
71
83
  before: createTextNode(before),
72
84
  beforeSpace: createTextNode(createHairSpace()),
73
85
  result: createTextNode(urn),
74
- afterSpace: after != null ? createTextNode(createNoBreakSpace()) : undefined,
86
+ afterSpace: after != null
87
+ ? createTextNode(createNoBreakSpace())
88
+ : createTextNode(createHairSpace()),
75
89
  after: after != null ? createTextNode(after) : undefined,
76
90
  };
77
91
  };
78
- const getNodesForSearchResultReplacement = (replacement) => {
92
+ /**
93
+ * Newline characters and spaces are represented slightly differently within a
94
+ * content editable element between browsers. This method standardizes the
95
+ * representation of those characters to avoid having to write branching logic
96
+ * to support each individual browser.
97
+ */
98
+ const standardizeNewlinesAndSpaces = (node) => {
99
+ const content = node.textContent;
100
+ if (content === '\n') {
101
+ return [createBreak()];
102
+ }
103
+ else if (content != null && content.includes('\n')) {
104
+ const split = content.split('\n');
105
+ return split.reduce((res, substr, i) => {
106
+ const previous = split[i - 1];
107
+ // Ignore the empty string if the prior element was converted
108
+ // to a breaking element to prevent duplication of newlines.
109
+ if (substr === '' && previous !== '') {
110
+ return res;
111
+ }
112
+ return [
113
+ ...res,
114
+ // Standard spaces are not always respected with in `Text`
115
+ // elements when appended to a contenteditable element. This
116
+ // conversion preserves that spacing.
117
+ createTextNode(substr.replace(/ /g, createNoBreakSpace())),
118
+ createBreak(),
119
+ ];
120
+ }, []);
121
+ }
122
+ return [node];
123
+ };
124
+ const getNodesForSearchResultReplacement = (replacement, isBreaking = false) => {
79
125
  const keys = Object.keys(replacement);
80
- return keys
126
+ const replacementElements = keys
81
127
  .map((key) => replacement[key])
82
128
  .filter((node) => node != null);
129
+ // If the element is intended to replace a breaking element such
130
+ // as a `<div>` wrapper, a newline is required alongside the standard
131
+ // replacement elements.
132
+ if (isBreaking) {
133
+ return [createTextNode('\n'), ...replacementElements];
134
+ }
135
+ return replacementElements;
83
136
  };
84
137
  /**
85
138
  * We leverage a couple unique spaces to represent mentions, allowing for
@@ -114,13 +167,34 @@ const SearchBar = class {
114
167
  this.inputFocus = index.createEvent(this, "inputFocus", 7);
115
168
  this.inputBlur = index.createEvent(this, "inputBlur", 7);
116
169
  this.rawElements = [];
170
+ this.attemptReplaceElement = (child, other, replacement, isBreaking = false) => {
171
+ // In the case that the child we're evaluating has its own children
172
+ // (often a wrapper `<div>`), we want to evaluate whether any of its
173
+ // children is the target to replace.
174
+ if (nodeHasChildNodes(child) &&
175
+ Array.from(child.childNodes).some((c) => nodeHasChildNodes(c) || this.isIdenticalElement(c, other))) {
176
+ return Array.from(child.childNodes).reduce((res, c) => [
177
+ ...res,
178
+ ...this.attemptReplaceElement(c, other, replacement,
179
+ // If the element we're evaluating is a wrapper, we want to
180
+ // consider it a breaking element and add a newline to the
181
+ // replaced element only if the previous node is a `Text` node.
182
+ !isHtmlElement(child.previousSibling)),
183
+ ], []);
184
+ }
185
+ else {
186
+ return this.isIdenticalElement(child, other)
187
+ ? getNodesForSearchResultReplacement(replacement, isBreaking)
188
+ : [child];
189
+ }
190
+ };
117
191
  this.isIdenticalElement = (child, other) => {
118
192
  return (child === this.triggeredElement ||
119
193
  this.getTextContent(child) === this.getTextContent(other));
120
194
  };
121
195
  this.getTextContent = (node) => {
122
196
  var _a;
123
- if (node instanceof HTMLElement) {
197
+ if (isHtmlElement(node)) {
124
198
  return node.innerText;
125
199
  }
126
200
  return (_a = node.textContent) !== null && _a !== void 0 ? _a : '';
@@ -197,21 +271,54 @@ const SearchBar = class {
197
271
  selection.addRange(range);
198
272
  }
199
273
  };
200
- this.getContentAsString = () => {
201
- if (this.contentEl != null) {
202
- return trimNonstandardSpaces(Array.from(this.contentEl.childNodes).reduce((res, n) => {
274
+ this.getContentAsString = (element) => {
275
+ if (element != null) {
276
+ const res = trimNonstandardSpaces(Array.from(element.childNodes).reduce((res, n) => {
203
277
  var _a;
204
- if (n instanceof HTMLElement &&
205
- n.getAttribute('data-replaced') === 'true') {
278
+ const previousSiblingIsBlock = n.previousSibling == null || isHtmlElement(n.previousSibling);
279
+ if (isHtmlElement(n) && n.getAttribute('data-replaced') === 'true') {
280
+ /**
281
+ * If an element has been replaced visually, append the original
282
+ * value prior to being replaced.
283
+ */
206
284
  return `${res}${n.getAttribute('data-original')}`;
207
285
  }
208
- else if (n instanceof HTMLElement) {
209
- return `${res}${n.innerText}`;
286
+ else if (isHtmlElement(n) && n.childElementCount > 0) {
287
+ /**
288
+ * If an element is a wrapper, we want to treat it as a block element,
289
+ * ensuring newlines before and after the content.
290
+ * Additionally, we want to evaluate each of its children independently.
291
+ * Some browsers will conditionally wrap content in additional wrapper
292
+ * elements we need to unravel.
293
+ */
294
+ return `${res}${previousSiblingIsBlock ? '' : '\n'}${this.getContentAsString(n)}`;
295
+ }
296
+ else if (isBrElement(n)) {
297
+ /**
298
+ * If an element is a `<br>` element, we want to simply represent
299
+ * it as a newline in the returned string.
300
+ */
301
+ return `${res}\n`;
302
+ }
303
+ else if (isHtmlElement(n)) {
304
+ /**
305
+ * If an element is a wrapper, we want to treat it as a block element,
306
+ * ensuring newlines before and after the content.
307
+ * If the prior element is also to be treated as a block format, we
308
+ * will omit the newline before the content to avoid duplicating the
309
+ * behavior.
310
+ */
311
+ return `${res}${previousSiblingIsBlock ? '' : '\n'}${n.innerText}\n`;
210
312
  }
211
313
  else {
314
+ /**
315
+ * If a node is simply a `Text` node, we just want to append the text
316
+ * if defined.
317
+ */
212
318
  return `${res}${(_a = n.textContent) !== null && _a !== void 0 ? _a : ''}`;
213
319
  }
214
320
  }, ''));
321
+ return res;
215
322
  }
216
323
  return '';
217
324
  };
@@ -287,12 +394,13 @@ const SearchBar = class {
287
394
  replacement.before,
288
395
  replacement.beforeSpace,
289
396
  replacement.result,
397
+ replacement.afterSpace,
290
398
  ];
291
399
  }
292
400
  return res;
293
401
  }, [])
294
402
  : [];
295
- this.rawElements = [...parts, createTextNode(nextSubstr)];
403
+ this.rawElements = [...parts, createTextNode(nextSubstr)].reduce((res, p) => [...res, ...standardizeNewlinesAndSpaces(p)], []);
296
404
  this.updateContent(this.replacements);
297
405
  }
298
406
  }
@@ -300,7 +408,7 @@ const SearchBar = class {
300
408
  if (this.contentEl != null && !fastDeepEqual(newValue, oldValue)) {
301
409
  this.contentEl.innerHTML = '';
302
410
  this.displayedElements = this.rawElements.map((el) => {
303
- const raw = el instanceof HTMLElement ? el.innerText : el.textContent;
411
+ const raw = isHtmlElement(el) ? el.innerText : el.textContent;
304
412
  const replacement = this.replacements.find((r) => raw === null || raw === void 0 ? void 0 : raw.includes(createResultUri(r)));
305
413
  if (raw != null && replacement != null) {
306
414
  const replacementElement = this.createReplacedElement(raw, replacement);
@@ -315,7 +423,7 @@ const SearchBar = class {
315
423
  if (this.lastReplacedSpace != null) {
316
424
  this.moveCursorToNodeEnd(this.lastReplacedSpace);
317
425
  }
318
- this.inputChanged.emit(this.getContentAsString());
426
+ this.inputChanged.emit(this.getContentAsString(this.contentEl));
319
427
  }
320
428
  }
321
429
  render() {
@@ -327,7 +435,7 @@ const SearchBar = class {
327
435
  blank: this.variant === 'blank',
328
436
  disabled: this.disabled,
329
437
  });
330
- return (index.h(index.Host, null, index.h("div", { class: classes }, index.h("span", { class: "content-input", role: "textbox", contentEditable: "true", "aria-multiline": "true", "data-placeholder": this.placeholder, ref: (el) => (this.contentEl = el), onKeyDown: this.handleKeyDown, onKeyUp: this.handleCursorPositionUpdate, onClick: this.handleCursorPositionUpdate, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur })), index.h("vertex-result-list", { position: this.cursorPosition, placement: this.placement, open: this.hasTriggered &&
438
+ return (index.h(index.Host, null, index.h("div", { class: classes }, index.h("span", { class: "content-input", role: "textbox", contentEditable: "true", "aria-multiline": "true", "data-placeholder": this.placeholder, ref: (el) => (this.contentEl = el), onKeyDown: this.handleKeyDown, onKeyUp: this.handleKeyUp, onClick: this.handleCursorPositionUpdate, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur })), index.h("vertex-result-list", { position: this.cursorPosition, placement: this.placement, open: this.hasTriggered &&
331
439
  this.resultItems != null &&
332
440
  this.resultItems.length > 0, items: (_a = this.resultItems) !== null && _a !== void 0 ? _a : [], onEnterPressed: this.handleResultClick, onResultClick: this.handleResultClick }, index.h("slot", { name: "results" })), index.h("slot", { name: "replaced" })));
333
441
  }
@@ -343,13 +451,13 @@ const SearchBar = class {
343
451
  this.cursorPosition = this.getCursorPosition();
344
452
  }
345
453
  async handleInput() {
346
- this.inputChanged.emit(this.getContentAsString());
454
+ this.inputChanged.emit(this.getContentAsString(this.contentEl));
347
455
  }
348
456
  handleClick() {
349
457
  this.handleCursorPositionUpdate();
350
458
  }
351
459
  handleWindowClick(event) {
352
- if (event.target instanceof HTMLElement &&
460
+ if (isHtmlElement(event.target) &&
353
461
  event.target.getAttribute('data-replaced') === 'true' &&
354
462
  event.target.nextSibling != null) {
355
463
  this.moveCursorToNodeEnd(event.target.nextSibling, true);
@@ -366,7 +474,7 @@ const SearchBar = class {
366
474
  var _a;
367
475
  const triggeredRange = this.triggeredRange;
368
476
  const triggeredElement = this.triggeredElement;
369
- const value = triggeredElement instanceof HTMLElement
477
+ const value = isHtmlElement(triggeredElement)
370
478
  ? triggeredElement.innerText
371
479
  : triggeredElement === null || triggeredElement === void 0 ? void 0 : triggeredElement.textContent;
372
480
  if (this.contentEl != null &&
@@ -380,12 +488,10 @@ const SearchBar = class {
380
488
  const replacement = createSearchResultReplacement(event.detail, before, after);
381
489
  this.lastReplacedSpace = replacement.afterSpace;
382
490
  this.rawElements = Array.from(this.contentEl.childNodes).reduce((re, e) => {
383
- if (this.isIdenticalElement(e, triggeredElement)) {
384
- return [...re, ...getNodesForSearchResultReplacement(replacement)];
385
- }
386
- else {
387
- return [...re, e];
388
- }
491
+ return [
492
+ ...re,
493
+ ...this.attemptReplaceElement(e, triggeredElement, replacement),
494
+ ];
389
495
  }, []);
390
496
  this.hasTriggered = false;
391
497
  this.resultReplaced.emit(event.detail);
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const searchBar = require('./search-bar-91cbcd07.js');
5
+ const searchBar = require('./search-bar-2e7ee35a.js');
6
6
  require('./index-6a92256c.js');
7
7
  require('./index-e1b40fa6.js');
8
8
  require('./templates-e7b3ffbb.js');
@@ -4,9 +4,26 @@ export const getWindowSelection = () => {
4
4
  }
5
5
  return undefined;
6
6
  };
7
+ export const nodeHasChildNodes = (node) => {
8
+ return node.hasChildNodes();
9
+ };
7
10
  export const createDocumentRange = () => {
8
11
  return document.createRange();
9
12
  };
10
13
  export const createTextNode = (text) => {
11
14
  return new Text(text);
12
15
  };
16
+ export const createBreak = () => {
17
+ return document.createElement('br');
18
+ };
19
+ export const createWrappingDiv = (nodes) => {
20
+ const el = document.createElement('div');
21
+ el.append(...nodes);
22
+ return el;
23
+ };
24
+ export const isHtmlElement = (node) => {
25
+ return node instanceof HTMLElement;
26
+ };
27
+ export const isBrElement = (node) => {
28
+ return node instanceof HTMLBRElement;
29
+ };
@@ -1,4 +1,4 @@
1
- import { createTextNode } from './dom';
1
+ import { createBreak, createTextNode } from './dom';
2
2
  export const createResultUri = (result) => {
3
3
  return `${result.type}:${result.id}`;
4
4
  };
@@ -8,15 +8,56 @@ export const createSearchResultReplacement = (result, before, after) => {
8
8
  before: createTextNode(before),
9
9
  beforeSpace: createTextNode(createHairSpace()),
10
10
  result: createTextNode(urn),
11
- afterSpace: after != null ? createTextNode(createNoBreakSpace()) : undefined,
11
+ afterSpace: after != null
12
+ ? createTextNode(createNoBreakSpace())
13
+ : createTextNode(createHairSpace()),
12
14
  after: after != null ? createTextNode(after) : undefined,
13
15
  };
14
16
  };
15
- export const getNodesForSearchResultReplacement = (replacement) => {
17
+ /**
18
+ * Newline characters and spaces are represented slightly differently within a
19
+ * content editable element between browsers. This method standardizes the
20
+ * representation of those characters to avoid having to write branching logic
21
+ * to support each individual browser.
22
+ */
23
+ export const standardizeNewlinesAndSpaces = (node) => {
24
+ const content = node.textContent;
25
+ if (content === '\n') {
26
+ return [createBreak()];
27
+ }
28
+ else if (content != null && content.includes('\n')) {
29
+ const split = content.split('\n');
30
+ return split.reduce((res, substr, i) => {
31
+ const previous = split[i - 1];
32
+ // Ignore the empty string if the prior element was converted
33
+ // to a breaking element to prevent duplication of newlines.
34
+ if (substr === '' && previous !== '') {
35
+ return res;
36
+ }
37
+ return [
38
+ ...res,
39
+ // Standard spaces are not always respected with in `Text`
40
+ // elements when appended to a contenteditable element. This
41
+ // conversion preserves that spacing.
42
+ createTextNode(substr.replace(/ /g, createNoBreakSpace())),
43
+ createBreak(),
44
+ ];
45
+ }, []);
46
+ }
47
+ return [node];
48
+ };
49
+ export const getNodesForSearchResultReplacement = (replacement, isBreaking = false) => {
16
50
  const keys = Object.keys(replacement);
17
- return keys
51
+ const replacementElements = keys
18
52
  .map((key) => replacement[key])
19
53
  .filter((node) => node != null);
54
+ // If the element is intended to replace a breaking element such
55
+ // as a `<div>` wrapper, a newline is required alongside the standard
56
+ // replacement elements.
57
+ if (isBreaking) {
58
+ return [createTextNode('\n'), ...replacementElements];
59
+ }
60
+ return replacementElements;
20
61
  };
21
62
  /**
22
63
  * We leverage a couple unique spaces to represent mentions, allowing for
@@ -2,18 +2,39 @@ import { h, Host, } from '@stencil/core';
2
2
  import classNames from 'classnames';
3
3
  import deepEqual from 'fast-deep-equal';
4
4
  import { generateInstanceFromTemplate } from '../../util/templates/templates';
5
- import { createDocumentRange, createTextNode, getWindowSelection } from './dom';
6
- import { createResultUri, createSearchResultReplacement, getNodesForSearchResultReplacement, trimNonstandardSpaces, } from './lib';
5
+ import { createDocumentRange, createTextNode, getWindowSelection, isBrElement, isHtmlElement, nodeHasChildNodes, } from './dom';
6
+ import { createResultUri, createSearchResultReplacement, getNodesForSearchResultReplacement, standardizeNewlinesAndSpaces, trimNonstandardSpaces, } from './lib';
7
7
  export class SearchBar {
8
8
  constructor() {
9
9
  this.rawElements = [];
10
+ this.attemptReplaceElement = (child, other, replacement, isBreaking = false) => {
11
+ // In the case that the child we're evaluating has its own children
12
+ // (often a wrapper `<div>`), we want to evaluate whether any of its
13
+ // children is the target to replace.
14
+ if (nodeHasChildNodes(child) &&
15
+ Array.from(child.childNodes).some((c) => nodeHasChildNodes(c) || this.isIdenticalElement(c, other))) {
16
+ return Array.from(child.childNodes).reduce((res, c) => [
17
+ ...res,
18
+ ...this.attemptReplaceElement(c, other, replacement,
19
+ // If the element we're evaluating is a wrapper, we want to
20
+ // consider it a breaking element and add a newline to the
21
+ // replaced element only if the previous node is a `Text` node.
22
+ !isHtmlElement(child.previousSibling)),
23
+ ], []);
24
+ }
25
+ else {
26
+ return this.isIdenticalElement(child, other)
27
+ ? getNodesForSearchResultReplacement(replacement, isBreaking)
28
+ : [child];
29
+ }
30
+ };
10
31
  this.isIdenticalElement = (child, other) => {
11
32
  return (child === this.triggeredElement ||
12
33
  this.getTextContent(child) === this.getTextContent(other));
13
34
  };
14
35
  this.getTextContent = (node) => {
15
36
  var _a;
16
- if (node instanceof HTMLElement) {
37
+ if (isHtmlElement(node)) {
17
38
  return node.innerText;
18
39
  }
19
40
  return (_a = node.textContent) !== null && _a !== void 0 ? _a : '';
@@ -90,21 +111,54 @@ export class SearchBar {
90
111
  selection.addRange(range);
91
112
  }
92
113
  };
93
- this.getContentAsString = () => {
94
- if (this.contentEl != null) {
95
- return trimNonstandardSpaces(Array.from(this.contentEl.childNodes).reduce((res, n) => {
114
+ this.getContentAsString = (element) => {
115
+ if (element != null) {
116
+ const res = trimNonstandardSpaces(Array.from(element.childNodes).reduce((res, n) => {
96
117
  var _a;
97
- if (n instanceof HTMLElement &&
98
- n.getAttribute('data-replaced') === 'true') {
118
+ const previousSiblingIsBlock = n.previousSibling == null || isHtmlElement(n.previousSibling);
119
+ if (isHtmlElement(n) && n.getAttribute('data-replaced') === 'true') {
120
+ /**
121
+ * If an element has been replaced visually, append the original
122
+ * value prior to being replaced.
123
+ */
99
124
  return `${res}${n.getAttribute('data-original')}`;
100
125
  }
101
- else if (n instanceof HTMLElement) {
102
- return `${res}${n.innerText}`;
126
+ else if (isHtmlElement(n) && n.childElementCount > 0) {
127
+ /**
128
+ * If an element is a wrapper, we want to treat it as a block element,
129
+ * ensuring newlines before and after the content.
130
+ * Additionally, we want to evaluate each of its children independently.
131
+ * Some browsers will conditionally wrap content in additional wrapper
132
+ * elements we need to unravel.
133
+ */
134
+ return `${res}${previousSiblingIsBlock ? '' : '\n'}${this.getContentAsString(n)}`;
135
+ }
136
+ else if (isBrElement(n)) {
137
+ /**
138
+ * If an element is a `<br>` element, we want to simply represent
139
+ * it as a newline in the returned string.
140
+ */
141
+ return `${res}\n`;
142
+ }
143
+ else if (isHtmlElement(n)) {
144
+ /**
145
+ * If an element is a wrapper, we want to treat it as a block element,
146
+ * ensuring newlines before and after the content.
147
+ * If the prior element is also to be treated as a block format, we
148
+ * will omit the newline before the content to avoid duplicating the
149
+ * behavior.
150
+ */
151
+ return `${res}${previousSiblingIsBlock ? '' : '\n'}${n.innerText}\n`;
103
152
  }
104
153
  else {
154
+ /**
155
+ * If a node is simply a `Text` node, we just want to append the text
156
+ * if defined.
157
+ */
105
158
  return `${res}${(_a = n.textContent) !== null && _a !== void 0 ? _a : ''}`;
106
159
  }
107
160
  }, ''));
161
+ return res;
108
162
  }
109
163
  return '';
110
164
  };
@@ -180,12 +234,13 @@ export class SearchBar {
180
234
  replacement.before,
181
235
  replacement.beforeSpace,
182
236
  replacement.result,
237
+ replacement.afterSpace,
183
238
  ];
184
239
  }
185
240
  return res;
186
241
  }, [])
187
242
  : [];
188
- this.rawElements = [...parts, createTextNode(nextSubstr)];
243
+ this.rawElements = [...parts, createTextNode(nextSubstr)].reduce((res, p) => [...res, ...standardizeNewlinesAndSpaces(p)], []);
189
244
  this.updateContent(this.replacements);
190
245
  }
191
246
  }
@@ -193,7 +248,7 @@ export class SearchBar {
193
248
  if (this.contentEl != null && !deepEqual(newValue, oldValue)) {
194
249
  this.contentEl.innerHTML = '';
195
250
  this.displayedElements = this.rawElements.map((el) => {
196
- const raw = el instanceof HTMLElement ? el.innerText : el.textContent;
251
+ const raw = isHtmlElement(el) ? el.innerText : el.textContent;
197
252
  const replacement = this.replacements.find((r) => raw === null || raw === void 0 ? void 0 : raw.includes(createResultUri(r)));
198
253
  if (raw != null && replacement != null) {
199
254
  const replacementElement = this.createReplacedElement(raw, replacement);
@@ -208,7 +263,7 @@ export class SearchBar {
208
263
  if (this.lastReplacedSpace != null) {
209
264
  this.moveCursorToNodeEnd(this.lastReplacedSpace);
210
265
  }
211
- this.inputChanged.emit(this.getContentAsString());
266
+ this.inputChanged.emit(this.getContentAsString(this.contentEl));
212
267
  }
213
268
  }
214
269
  render() {
@@ -220,7 +275,7 @@ export class SearchBar {
220
275
  blank: this.variant === 'blank',
221
276
  disabled: this.disabled,
222
277
  });
223
- return (h(Host, null, h("div", { class: classes }, h("span", { class: "content-input", role: "textbox", contentEditable: "true", "aria-multiline": "true", "data-placeholder": this.placeholder, ref: (el) => (this.contentEl = el), onKeyDown: this.handleKeyDown, onKeyUp: this.handleCursorPositionUpdate, onClick: this.handleCursorPositionUpdate, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur })), h("vertex-result-list", { position: this.cursorPosition, placement: this.placement, open: this.hasTriggered &&
278
+ return (h(Host, null, h("div", { class: classes }, h("span", { class: "content-input", role: "textbox", contentEditable: "true", "aria-multiline": "true", "data-placeholder": this.placeholder, ref: (el) => (this.contentEl = el), onKeyDown: this.handleKeyDown, onKeyUp: this.handleKeyUp, onClick: this.handleCursorPositionUpdate, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur })), h("vertex-result-list", { position: this.cursorPosition, placement: this.placement, open: this.hasTriggered &&
224
279
  this.resultItems != null &&
225
280
  this.resultItems.length > 0, items: (_a = this.resultItems) !== null && _a !== void 0 ? _a : [], onEnterPressed: this.handleResultClick, onResultClick: this.handleResultClick }, h("slot", { name: "results" })), h("slot", { name: "replaced" })));
226
281
  }
@@ -236,13 +291,13 @@ export class SearchBar {
236
291
  this.cursorPosition = this.getCursorPosition();
237
292
  }
238
293
  async handleInput() {
239
- this.inputChanged.emit(this.getContentAsString());
294
+ this.inputChanged.emit(this.getContentAsString(this.contentEl));
240
295
  }
241
296
  handleClick() {
242
297
  this.handleCursorPositionUpdate();
243
298
  }
244
299
  handleWindowClick(event) {
245
- if (event.target instanceof HTMLElement &&
300
+ if (isHtmlElement(event.target) &&
246
301
  event.target.getAttribute('data-replaced') === 'true' &&
247
302
  event.target.nextSibling != null) {
248
303
  this.moveCursorToNodeEnd(event.target.nextSibling, true);
@@ -259,7 +314,7 @@ export class SearchBar {
259
314
  var _a;
260
315
  const triggeredRange = this.triggeredRange;
261
316
  const triggeredElement = this.triggeredElement;
262
- const value = triggeredElement instanceof HTMLElement
317
+ const value = isHtmlElement(triggeredElement)
263
318
  ? triggeredElement.innerText
264
319
  : triggeredElement === null || triggeredElement === void 0 ? void 0 : triggeredElement.textContent;
265
320
  if (this.contentEl != null &&
@@ -273,12 +328,10 @@ export class SearchBar {
273
328
  const replacement = createSearchResultReplacement(event.detail, before, after);
274
329
  this.lastReplacedSpace = replacement.afterSpace;
275
330
  this.rawElements = Array.from(this.contentEl.childNodes).reduce((re, e) => {
276
- if (this.isIdenticalElement(e, triggeredElement)) {
277
- return [...re, ...getNodesForSearchResultReplacement(replacement)];
278
- }
279
- else {
280
- return [...re, e];
281
- }
331
+ return [
332
+ ...re,
333
+ ...this.attemptReplaceElement(e, triggeredElement, replacement),
334
+ ];
282
335
  }, []);
283
336
  this.hasTriggered = false;
284
337
  this.resultReplaced.emit(event.detail);
@@ -1 +1 @@
1
- import{d as e,N as t,w as a,p as o,a as r,b as i}from"./p-6834631c.js";export{s as setNonce}from"./p-6834631c.js";(()=>{const i=Array.from(e.querySelectorAll("script")).find((e=>new RegExp(`/${t}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===t)),n={};return n.resourcesUrl=new URL(".",new URL(i.getAttribute("data-resources-url")||i.src,a.location.href)).href,((o,i)=>{const n=`__sc_import_${t.replace(/\s|-/g,"_")}`;try{a[n]=new Function("w",`return import(w);//${Math.random()}`)}catch(t){const l=new Map;a[n]=t=>{var c;const s=new URL(t,o).href;let p=l.get(s);if(!p){const t=e.createElement("script");t.type="module",t.crossOrigin=i.crossOrigin,t.src=URL.createObjectURL(new Blob([`import * as m from '${s}'; window.${n}.m = m;`],{type:"application/javascript"}));const o=null!==(c=r.t)&&void 0!==c?c:function(e){var t,a,o;return null!==(o=null===(a=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===a?void 0:a.getAttribute("content"))&&void 0!==o?o:void 0}(e);null!=o&&t.setAttribute("nonce",o),p=new Promise((e=>{t.onload=()=>{e(a[n].m),t.remove()}})),l.set(s,p),e.head.appendChild(t)}return p}}})(n.resourcesUrl,i),a.customElements?o(n):__sc_import_components("./p-c3ec6642.js").then((()=>n))})().then((e=>i([["p-24c72960",[[6,"vertex-click-to-edit-textfield",{placeholder:[1],fontSize:[1,"font-size"],disabled:[516],multiline:[4],minRows:[2,"min-rows"],maxRows:[2,"max-rows"],value:[1032],autoFocus:[4,"auto-focus"],editing:[1540],hasError:[4,"has-error"]}]]],["p-226e83a6",[[1,"vertex-collapsible",{label:[1],open:[1540]}]]],["p-41ced35c",[[1,"vertex-context-menu",{targetSelector:[1,"target-selector"],animated:[4],position:[32],open:[32]}]]],["p-0f8b9ede",[[1,"vertex-dialog",{open:[1540],fullscreen:[4],resizable:[4],width:[32],height:[32],minWidth:[32],minHeight:[32],maxWidth:[32],maxHeight:[32],isResizing:[32]},[[4,"keydown","keyDownListener"]]]]],["p-e7336466",[[1,"vertex-draggable-popover",{position:[1],boundarySelector:[1,"boundary-selector"],boundaryPadding:[2,"boundary-padding"],anchorPosition:[32],lastPosition:[32],dragging:[32]}]]],["p-e3d0c2d1",[[1,"vertex-dropdown-menu",{animated:[4],placement:[1],open:[32]}]]],["p-fe7e7a74",[[1,"vertex-help-tooltip",{animated:[4],placement:[1],open:[32]}]]],["p-cfe369bf",[[6,"vertex-search-bar",{variant:[1],disabled:[4],triggerCharacter:[1,"trigger-character"],breakCharacters:[16],resultItems:[16],placement:[1],value:[1],placeholder:[1],replacements:[1040],replacementUriType:[1,"replacement-uri-type"],cursorPosition:[32],displayedElements:[32],hasTriggered:[32]}]]],["p-7cfb3736",[[1,"vertex-select",{value:[513],placeholder:[513],disabled:[516],animated:[4],hideSelected:[4,"hide-selected"],resizeObserverFactory:[16],open:[32],position:[32],displayValue:[32]}]]],["p-16719272",[[1,"vertex-slider",{min:[2],max:[2],valueLabelDisplay:[1,"value-label-display"],step:[8],size:[1],value:[1026],disabled:[4]}]]],["p-756c9977",[[1,"vertex-toast",{content:[1],placement:[1],duration:[2],animated:[4],open:[4],type:[1],isOpen:[32]}]]],["p-7f64b251",[[1,"vertex-color-circle-picker",{colors:[1],supplementalColors:[1,"supplemental-colors"],theme:[513],lightenPercentage:[2,"lighten-percentage"],darkenPercentage:[2,"darken-percentage"],selected:[1537],direction:[1]}]]],["p-35e7ab78",[[1,"vertex-color-picker",{value:[1537],disabled:[4]}]]],["p-53515813",[[1,"vertex-toggle",{variant:[1],disabled:[4],checked:[1540]}]]],["p-bca6275a",[[1,"vertex-avatar",{firstName:[1,"first-name"],lastName:[1,"last-name"],value:[1],active:[4],variant:[1]}]]],["p-91123ff6",[[1,"vertex-avatar-group"]]],["p-0b4406fa",[[1,"vertex-badge",{badgeText:[1,"badge-text"],badgeColor:[1,"badge-color"]}]]],["p-fca52578",[[1,"vertex-button",{type:[1],color:[1],variant:[1],size:[1],expand:[1],href:[1],target:[1],disabled:[516]}]]],["p-6d4f055b",[[1,"vertex-card",{mode:[1]}]]],["p-211c1186",[[1,"vertex-card-group",{selected:[516],hovered:[516],expanded:[516]}]]],["p-d7c0c287",[[1,"vertex-chip",{variant:[1],color:[1]}]]],["p-a2018217",[[1,"vertex-logo-loading"]]],["p-cc2e3192",[[1,"vertex-menu-divider"]]],["p-573b8ec6",[[1,"vertex-menu-item",{disabled:[516]}]]],["p-33400eed",[[2,"vertex-radio",{disabled:[516],value:[513],label:[513],name:[513],checked:[516]}]]],["p-8b85ea4a",[[1,"vertex-radio-group",{name:[513],value:[1537]}]]],["p-ea4a2f74",[[1,"vertex-resizable",{horizontalDirection:[1,"horizontal-direction"],verticalDirection:[1,"vertical-direction"],initialHorizontalScale:[2,"initial-horizontal-scale"],initialVerticalScale:[2,"initial-vertical-scale"],initializeWithOffset:[4,"initialize-with-offset"],parentSelector:[1,"parent-selector"],verticalSiblingSelector:[1,"vertical-sibling-selector"],horizontalSiblingSelector:[1,"horizontal-sibling-selector"],contentSelector:[1,"content-selector"],position:[1],dimensionsComputed:[1540,"dimensions-computed"],width:[32],minWidth:[32],maxWidth:[32],height:[32],minHeight:[32],maxHeight:[32],left:[32],top:[32],hoveredLocation:[32],dragStartLocation:[32],updateDimensions:[64]}]]],["p-69375605",[[1,"vertex-spinner",{color:[1],size:[1]}]]],["p-2ae8175d",[[1,"vertex-tab",{label:[1],active:[4]}]]],["p-3dd7a75f",[[1,"vertex-tabs",{active:[1025],labels:[32],activeBounds:[32],activeButtonEl:[32]}]]],["p-80c989fa",[[1,"vertex-expandable",{expanded:[1540],expanding:[1540],collapsing:[1540],controlled:[516],expandType:[513,"expand-type"],animated:[4],contentScrollHeight:[32]}]]],["p-ee496965",[[1,"vertex-result-list",{items:[16],itemsJson:[1,"items"],viewportStartIndex:[1026,"viewport-start-index"],viewportEndIndex:[1026,"viewport-end-index"],resultHeight:[1026,"result-height"],overScanCount:[2,"over-scan-count"],placement:[1],position:[1],open:[4],listHeight:[32],parsedResults:[32],scrollTop:[32],lastStartIndex:[32],lastFocusedIndex:[32],stateMap:[32]}]]],["p-406e73da",[[6,"vertex-textfield",{type:[1],name:[1],variant:[1],fontSize:[1,"font-size"],multiline:[4],minRows:[2,"min-rows"],maxRows:[2,"max-rows"],placeholder:[1],autoFocus:[4,"auto-focus"],autoComplete:[1,"auto-complete"],autoCorrect:[1,"auto-correct"],value:[1032],disabled:[516],hasError:[4,"has-error"],updateInput:[64],blurInput:[64],getInputValue:[64],selectAll:[64]}]]],["p-d3fd9ca3",[[1,"vertex-tooltip",{content:[1],disabled:[4],placement:[1],delay:[2],animated:[4],open:[32]}]]],["p-20a74d5d",[[1,"vertex-color-circle",{color:[513],supplementalColor:[513,"supplemental-color"],theme:[513],lightenPercentage:[2,"lighten-percentage"],darkenPercentage:[2,"darken-percentage"],lightened:[1537],darkened:[1537]}]]],["p-9c384f6c",[[1,"vertex-auto-resize-textarea",{textareaSelector:[1,"textarea-selector"],initialValue:[1,"initial-value"],minRows:[514,"min-rows"],maxRows:[514,"max-rows"],textValue:[32]}]]],["p-0517ca62",[[1,"vertex-menu",{animated:[4],open:[1540],placement:[1],fallbackPlacements:[16],backdrop:[4],position:[1040],popoverProps:[16]}]]],["p-f100f918",[[1,"vertex-icon-button",{iconName:[1,"icon-name"],disabled:[516],variant:[1],iconColor:[1,"icon-color"],iconSize:[1,"icon-size"]}]]],["p-8567289c",[[1,"vertex-icon",{name:[1],size:[1]}]]],["p-606596de",[[1,"vertex-popover",{open:[1540],placement:[1],position:[1025],anchorBounds:[16],backdrop:[4],animated:[4],anchorSelector:[1,"anchor-selector"],boundarySelector:[1,"boundary-selector"],resizeBehavior:[1,"resize-behavior"],overflowBehavior:[16],flipBehavior:[16],offsetBehavior:[2,"offset-behavior"],updateOnResize:[4,"update-on-resize"],resizeObserverFactory:[16],opened:[32],computedPlacement:[32]}]]]],e)));
1
+ import{d as e,N as t,w as a,p as o,a as r,b as i}from"./p-6834631c.js";export{s as setNonce}from"./p-6834631c.js";(()=>{const i=Array.from(e.querySelectorAll("script")).find((e=>new RegExp(`/${t}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===t)),n={};return n.resourcesUrl=new URL(".",new URL(i.getAttribute("data-resources-url")||i.src,a.location.href)).href,((o,i)=>{const n=`__sc_import_${t.replace(/\s|-/g,"_")}`;try{a[n]=new Function("w",`return import(w);//${Math.random()}`)}catch(t){const l=new Map;a[n]=t=>{var c;const s=new URL(t,o).href;let p=l.get(s);if(!p){const t=e.createElement("script");t.type="module",t.crossOrigin=i.crossOrigin,t.src=URL.createObjectURL(new Blob([`import * as m from '${s}'; window.${n}.m = m;`],{type:"application/javascript"}));const o=null!==(c=r.t)&&void 0!==c?c:function(e){var t,a,o;return null!==(o=null===(a=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===a?void 0:a.getAttribute("content"))&&void 0!==o?o:void 0}(e);null!=o&&t.setAttribute("nonce",o),p=new Promise((e=>{t.onload=()=>{e(a[n].m),t.remove()}})),l.set(s,p),e.head.appendChild(t)}return p}}})(n.resourcesUrl,i),a.customElements?o(n):__sc_import_components("./p-c3ec6642.js").then((()=>n))})().then((e=>i([["p-24c72960",[[6,"vertex-click-to-edit-textfield",{placeholder:[1],fontSize:[1,"font-size"],disabled:[516],multiline:[4],minRows:[2,"min-rows"],maxRows:[2,"max-rows"],value:[1032],autoFocus:[4,"auto-focus"],editing:[1540],hasError:[4,"has-error"]}]]],["p-226e83a6",[[1,"vertex-collapsible",{label:[1],open:[1540]}]]],["p-41ced35c",[[1,"vertex-context-menu",{targetSelector:[1,"target-selector"],animated:[4],position:[32],open:[32]}]]],["p-0f8b9ede",[[1,"vertex-dialog",{open:[1540],fullscreen:[4],resizable:[4],width:[32],height:[32],minWidth:[32],minHeight:[32],maxWidth:[32],maxHeight:[32],isResizing:[32]},[[4,"keydown","keyDownListener"]]]]],["p-e7336466",[[1,"vertex-draggable-popover",{position:[1],boundarySelector:[1,"boundary-selector"],boundaryPadding:[2,"boundary-padding"],anchorPosition:[32],lastPosition:[32],dragging:[32]}]]],["p-e3d0c2d1",[[1,"vertex-dropdown-menu",{animated:[4],placement:[1],open:[32]}]]],["p-fe7e7a74",[[1,"vertex-help-tooltip",{animated:[4],placement:[1],open:[32]}]]],["p-6a49c365",[[6,"vertex-search-bar",{variant:[1],disabled:[4],triggerCharacter:[1,"trigger-character"],breakCharacters:[16],resultItems:[16],placement:[1],value:[1],placeholder:[1],replacements:[1040],replacementUriType:[1,"replacement-uri-type"],cursorPosition:[32],displayedElements:[32],hasTriggered:[32]}]]],["p-7cfb3736",[[1,"vertex-select",{value:[513],placeholder:[513],disabled:[516],animated:[4],hideSelected:[4,"hide-selected"],resizeObserverFactory:[16],open:[32],position:[32],displayValue:[32]}]]],["p-16719272",[[1,"vertex-slider",{min:[2],max:[2],valueLabelDisplay:[1,"value-label-display"],step:[8],size:[1],value:[1026],disabled:[4]}]]],["p-756c9977",[[1,"vertex-toast",{content:[1],placement:[1],duration:[2],animated:[4],open:[4],type:[1],isOpen:[32]}]]],["p-7f64b251",[[1,"vertex-color-circle-picker",{colors:[1],supplementalColors:[1,"supplemental-colors"],theme:[513],lightenPercentage:[2,"lighten-percentage"],darkenPercentage:[2,"darken-percentage"],selected:[1537],direction:[1]}]]],["p-35e7ab78",[[1,"vertex-color-picker",{value:[1537],disabled:[4]}]]],["p-53515813",[[1,"vertex-toggle",{variant:[1],disabled:[4],checked:[1540]}]]],["p-bca6275a",[[1,"vertex-avatar",{firstName:[1,"first-name"],lastName:[1,"last-name"],value:[1],active:[4],variant:[1]}]]],["p-91123ff6",[[1,"vertex-avatar-group"]]],["p-0b4406fa",[[1,"vertex-badge",{badgeText:[1,"badge-text"],badgeColor:[1,"badge-color"]}]]],["p-fca52578",[[1,"vertex-button",{type:[1],color:[1],variant:[1],size:[1],expand:[1],href:[1],target:[1],disabled:[516]}]]],["p-6d4f055b",[[1,"vertex-card",{mode:[1]}]]],["p-211c1186",[[1,"vertex-card-group",{selected:[516],hovered:[516],expanded:[516]}]]],["p-d7c0c287",[[1,"vertex-chip",{variant:[1],color:[1]}]]],["p-a2018217",[[1,"vertex-logo-loading"]]],["p-cc2e3192",[[1,"vertex-menu-divider"]]],["p-573b8ec6",[[1,"vertex-menu-item",{disabled:[516]}]]],["p-33400eed",[[2,"vertex-radio",{disabled:[516],value:[513],label:[513],name:[513],checked:[516]}]]],["p-8b85ea4a",[[1,"vertex-radio-group",{name:[513],value:[1537]}]]],["p-ea4a2f74",[[1,"vertex-resizable",{horizontalDirection:[1,"horizontal-direction"],verticalDirection:[1,"vertical-direction"],initialHorizontalScale:[2,"initial-horizontal-scale"],initialVerticalScale:[2,"initial-vertical-scale"],initializeWithOffset:[4,"initialize-with-offset"],parentSelector:[1,"parent-selector"],verticalSiblingSelector:[1,"vertical-sibling-selector"],horizontalSiblingSelector:[1,"horizontal-sibling-selector"],contentSelector:[1,"content-selector"],position:[1],dimensionsComputed:[1540,"dimensions-computed"],width:[32],minWidth:[32],maxWidth:[32],height:[32],minHeight:[32],maxHeight:[32],left:[32],top:[32],hoveredLocation:[32],dragStartLocation:[32],updateDimensions:[64]}]]],["p-69375605",[[1,"vertex-spinner",{color:[1],size:[1]}]]],["p-2ae8175d",[[1,"vertex-tab",{label:[1],active:[4]}]]],["p-3dd7a75f",[[1,"vertex-tabs",{active:[1025],labels:[32],activeBounds:[32],activeButtonEl:[32]}]]],["p-80c989fa",[[1,"vertex-expandable",{expanded:[1540],expanding:[1540],collapsing:[1540],controlled:[516],expandType:[513,"expand-type"],animated:[4],contentScrollHeight:[32]}]]],["p-ee496965",[[1,"vertex-result-list",{items:[16],itemsJson:[1,"items"],viewportStartIndex:[1026,"viewport-start-index"],viewportEndIndex:[1026,"viewport-end-index"],resultHeight:[1026,"result-height"],overScanCount:[2,"over-scan-count"],placement:[1],position:[1],open:[4],listHeight:[32],parsedResults:[32],scrollTop:[32],lastStartIndex:[32],lastFocusedIndex:[32],stateMap:[32]}]]],["p-406e73da",[[6,"vertex-textfield",{type:[1],name:[1],variant:[1],fontSize:[1,"font-size"],multiline:[4],minRows:[2,"min-rows"],maxRows:[2,"max-rows"],placeholder:[1],autoFocus:[4,"auto-focus"],autoComplete:[1,"auto-complete"],autoCorrect:[1,"auto-correct"],value:[1032],disabled:[516],hasError:[4,"has-error"],updateInput:[64],blurInput:[64],getInputValue:[64],selectAll:[64]}]]],["p-d3fd9ca3",[[1,"vertex-tooltip",{content:[1],disabled:[4],placement:[1],delay:[2],animated:[4],open:[32]}]]],["p-20a74d5d",[[1,"vertex-color-circle",{color:[513],supplementalColor:[513,"supplemental-color"],theme:[513],lightenPercentage:[2,"lighten-percentage"],darkenPercentage:[2,"darken-percentage"],lightened:[1537],darkened:[1537]}]]],["p-9c384f6c",[[1,"vertex-auto-resize-textarea",{textareaSelector:[1,"textarea-selector"],initialValue:[1,"initial-value"],minRows:[514,"min-rows"],maxRows:[514,"max-rows"],textValue:[32]}]]],["p-0517ca62",[[1,"vertex-menu",{animated:[4],open:[1540],placement:[1],fallbackPlacements:[16],backdrop:[4],position:[1040],popoverProps:[16]}]]],["p-f100f918",[[1,"vertex-icon-button",{iconName:[1,"icon-name"],disabled:[516],variant:[1],iconColor:[1,"icon-color"],iconSize:[1,"icon-size"]}]]],["p-8567289c",[[1,"vertex-icon",{name:[1],size:[1]}]]],["p-606596de",[[1,"vertex-popover",{open:[1540],placement:[1],position:[1025],anchorBounds:[16],backdrop:[4],animated:[4],anchorSelector:[1,"anchor-selector"],boundarySelector:[1,"boundary-selector"],resizeBehavior:[1,"resize-behavior"],overflowBehavior:[16],flipBehavior:[16],offsetBehavior:[2,"offset-behavior"],updateOnResize:[4,"update-on-resize"],resizeObserverFactory:[16],opened:[32],computedPlacement:[32]}]]]],e)));
@@ -1 +1 @@
1
- export{A as AutoResizeTextArea}from"./p-bec53c3a.js";export{A as Avatar}from"./p-c2c076f1.js";export{A as AvatarGroup}from"./p-81cb4da4.js";export{B as Badge}from"./p-29d7697f.js";export{B as Button}from"./p-64e8b92c.js";export{C as Card}from"./p-a3c04bbd.js";export{C as CardGroup}from"./p-ff4a1c3a.js";export{C as Chip}from"./p-a6614625.js";export{C as ClickToEditTextField}from"./p-0e628c05.js";export{C as Collapsible}from"./p-8fe0084d.js";export{C as ColorCircle}from"./p-d9b9aebe.js";export{C as ColorCirclePicker}from"./p-9374ef6c.js";export{C as ColorPicker}from"./p-8434602f.js";export{C as ContextMenu}from"./p-f2bc7ec5.js";export{D as Dialog}from"./p-165aed7d.js";export{D as DraggablePopover}from"./p-41a7564c.js";export{D as DropdownMenu}from"./p-39133bc7.js";export{E as Expandable}from"./p-6a640a2c.js";export{H as HelpTooltip}from"./p-2cff3285.js";export{I as Icon}from"./p-438990ec.js";export{I as IconButton}from"./p-d51b8fb1.js";export{L as LogoLoading}from"./p-817bf6ff.js";export{M as Menu}from"./p-7b75e004.js";export{M as MenuDivider}from"./p-c939fa4e.js";export{M as MenuItem}from"./p-988058f9.js";export{P as Popover}from"./p-c2706288.js";export{R as Radio}from"./p-36c853c4.js";export{R as RadioGroup}from"./p-f693e6f8.js";export{R as Resizable}from"./p-6ec189d2.js";export{R as ResultList}from"./p-6b862967.js";export{S as SearchBar}from"./p-db34f10c.js";export{S as Select}from"./p-912f6e24.js";export{S as Slider}from"./p-cd6ddb10.js";export{S as Spinner}from"./p-09ba50c3.js";export{T as Tab}from"./p-96f55673.js";export{T as Tabs}from"./p-76b961b8.js";export{T as TextField}from"./p-43b1b3f9.js";export{T as Toast}from"./p-3dd08a0f.js";export{T as Toggle}from"./p-59fb829f.js";export{T as Tooltip}from"./p-ff7c70b9.js";import"./p-6834631c.js";import"./p-b2c7b113.js";import"./p-fe062eb0.js";import"./p-213670fa.js";import"./p-1356f525.js";import"./p-59032668.js";import"./p-69496858.js";
1
+ export{A as AutoResizeTextArea}from"./p-bec53c3a.js";export{A as Avatar}from"./p-c2c076f1.js";export{A as AvatarGroup}from"./p-81cb4da4.js";export{B as Badge}from"./p-29d7697f.js";export{B as Button}from"./p-64e8b92c.js";export{C as Card}from"./p-a3c04bbd.js";export{C as CardGroup}from"./p-ff4a1c3a.js";export{C as Chip}from"./p-a6614625.js";export{C as ClickToEditTextField}from"./p-0e628c05.js";export{C as Collapsible}from"./p-8fe0084d.js";export{C as ColorCircle}from"./p-d9b9aebe.js";export{C as ColorCirclePicker}from"./p-9374ef6c.js";export{C as ColorPicker}from"./p-8434602f.js";export{C as ContextMenu}from"./p-f2bc7ec5.js";export{D as Dialog}from"./p-165aed7d.js";export{D as DraggablePopover}from"./p-41a7564c.js";export{D as DropdownMenu}from"./p-39133bc7.js";export{E as Expandable}from"./p-6a640a2c.js";export{H as HelpTooltip}from"./p-2cff3285.js";export{I as Icon}from"./p-438990ec.js";export{I as IconButton}from"./p-d51b8fb1.js";export{L as LogoLoading}from"./p-817bf6ff.js";export{M as Menu}from"./p-7b75e004.js";export{M as MenuDivider}from"./p-c939fa4e.js";export{M as MenuItem}from"./p-988058f9.js";export{P as Popover}from"./p-c2706288.js";export{R as Radio}from"./p-36c853c4.js";export{R as RadioGroup}from"./p-f693e6f8.js";export{R as Resizable}from"./p-6ec189d2.js";export{R as ResultList}from"./p-6b862967.js";export{S as SearchBar}from"./p-6b6c2260.js";export{S as Select}from"./p-912f6e24.js";export{S as Slider}from"./p-cd6ddb10.js";export{S as Spinner}from"./p-09ba50c3.js";export{T as Tab}from"./p-96f55673.js";export{T as Tabs}from"./p-76b961b8.js";export{T as TextField}from"./p-43b1b3f9.js";export{T as Toast}from"./p-3dd08a0f.js";export{T as Toggle}from"./p-59fb829f.js";export{T as Tooltip}from"./p-ff7c70b9.js";import"./p-6834631c.js";import"./p-b2c7b113.js";import"./p-fe062eb0.js";import"./p-213670fa.js";import"./p-1356f525.js";import"./p-59032668.js";import"./p-69496858.js";
@@ -0,0 +1 @@
1
+ export{S as vertex_search_bar}from"./p-6b6c2260.js";import"./p-6834631c.js";import"./p-fe062eb0.js";import"./p-1356f525.js";import"./p-59032668.js";
@@ -0,0 +1 @@
1
+ import{r as e,e as t,h as r,H as i,g as s}from"./p-6834631c.js";import{c as a}from"./p-fe062eb0.js";import{g as n}from"./p-1356f525.js";var l=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var i,s,a;if(Array.isArray(t)){if((i=t.length)!=r.length)return!1;for(s=i;0!=s--;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((i=(a=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(s=i;0!=s--;)if(!Object.prototype.hasOwnProperty.call(r,a[s]))return!1;for(s=i;0!=s--;){var n=a[s];if(!e(t[n],r[n]))return!1}return!0}return t!=t&&r!=r};const o=()=>{if("undefined"!=typeof window)return window.getSelection()},h=e=>e.hasChildNodes(),c=e=>new Text(e),d=()=>document.createElement("br"),u=e=>e instanceof HTMLElement,v=e=>`${e.type}:${e.id}`,b=(e,t,r)=>{const i=v(e);return{before:c(t),beforeSpace:c(p()),result:c(i),afterSpace:c(null!=r?f():p()),after:null!=r?c(r):void 0}},x=e=>{const t=e.textContent;if("\n"===t)return[d()];if(null!=t&&t.includes("\n")){const e=t.split("\n");return e.reduce(((t,r,i)=>""===r&&""!==e[i-1]?t:[...t,c(r.replace(/ /g,f())),d()]),[])}return[e]},p=()=>String.fromCharCode(8202),f=()=>String.fromCharCode(160),m=class{constructor(r){e(this,r),this.searchChanged=t(this,"searchChanged",7),this.inputChanged=t(this,"inputChanged",7),this.resultReplaced=t(this,"resultReplaced",7),this.inputFocus=t(this,"inputFocus",7),this.inputBlur=t(this,"inputBlur",7),this.rawElements=[],this.attemptReplaceElement=(e,t,r,i=!1)=>h(e)&&Array.from(e.childNodes).some((e=>h(e)||this.isIdenticalElement(e,t)))?Array.from(e.childNodes).reduce(((i,s)=>[...i,...this.attemptReplaceElement(s,t,r,!u(e.previousSibling))]),[]):this.isIdenticalElement(e,t)?((e,t=!1)=>{const r=Object.keys(e).map((t=>e[t])).filter((e=>null!=e));return t?[c("\n"),...r]:r})(r,i):[e],this.isIdenticalElement=(e,t)=>e===this.triggeredElement||this.getTextContent(e)===this.getTextContent(t),this.getTextContent=e=>{var t;return u(e)?e.innerText:null!==(t=e.textContent)&&void 0!==t?t:""},this.handleCursorPositionUpdate=()=>{var e,t;const r=null===(e=o())||void 0===e?void 0:e.getRangeAt(0);if(null!=r){const e=this.readTriggerValue(null!==(t=r.commonAncestorContainer.textContent)&&void 0!==t?t:"",r.startOffset);this.hasTriggered||null==e?this.hasTriggered&&null!=e?(this.triggeredRange=r,this.triggeredElement=r.commonAncestorContainer,this.searchChanged.emit(e.replace(this.triggerCharacter,""))):(this.hasTriggered=!1,this.triggeredRange=void 0,this.triggeredElement=void 0):(this.hasTriggered=!0,this.triggeredRange=r,this.triggeredElement=r.commonAncestorContainer,this.searchChanged.emit(e.replace(this.triggerCharacter,"")))}this.cursorPosition=this.getCursorPosition()},this.readTriggerValue=(e,t)=>{const r=e.replace(String.fromCharCode(160)," "),i=r.substring(0,t),s=r.substring(t),a=`${i.includes(this.triggerCharacter)?i.substring(i.lastIndexOf(this.triggerCharacter)):""}${s.substring(0,this.firstIndexOfBreakCharacter(s))}`;return a.includes(this.triggerCharacter)&&!this.includesBreakCharacter(a)?a:void 0},this.includesBreakCharacter=e=>this.breakCharacters.some((t=>e.includes(t))),this.firstIndexOfBreakCharacter=e=>{const t=this.breakCharacters.map((t=>e.indexOf(t))).filter((e=>e>=0));return t.length>0?Math.min(...t):e.length},this.moveCursorToNodeEnd=(e,t=!1)=>{const r=o();if(null!=r){const i=document.createRange();i.selectNodeContents(e),i.collapse(t),r.removeAllRanges(),r.addRange(i)}},this.getContentAsString=e=>null!=e?Array.from(e.childNodes).reduce(((e,t)=>{var r;const i=null==t.previousSibling||u(t.previousSibling);return u(t)&&"true"===t.getAttribute("data-replaced")?`${e}${t.getAttribute("data-original")}`:u(t)&&t.childElementCount>0?`${e}${i?"":"\n"}${this.getContentAsString(t)}`:t instanceof HTMLBRElement?`${e}\n`:u(t)?`${e}${i?"":"\n"}${t.innerText}\n`:`${e}${null!==(r=t.textContent)&&void 0!==r?r:""}`}),"").replace(/[\u200A]/g,"").replace(/[\u00A0]/g," "):"",this.createReplacedElement=(e,t)=>{const r=this.hostEl.querySelector('template[slot="replaced"]');if(null!=r){const i=n(r);return i.bindings.bind(t),i.element.id=t.id,i.element.style.display="inline-block",i.element.contentEditable="false",i.element.tabIndex=-1,i.element.setAttribute("data-replaced","true"),i.element.setAttribute("data-original",e),i.element}throw new Error("Replaced template not defined.")},this.variant="standard",this.disabled=!1,this.triggerCharacter="@",this.breakCharacters=[" ","\n"],this.resultItems=void 0,this.placement="bottom-start",this.value=void 0,this.placeholder=void 0,this.replacements=[],this.replacementUriType="user",this.cursorPosition=void 0,this.displayedElements=[],this.hasTriggered=!1,this.handleKeyDown=this.handleKeyDown.bind(this),this.handleKeyUp=this.handleKeyUp.bind(this),this.handleResultClick=this.handleResultClick.bind(this),this.handleClick=this.handleClick.bind(this),this.handleWindowClick=this.handleWindowClick.bind(this),this.handleInput=this.handleInput.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleCursorPositionUpdate=this.handleCursorPositionUpdate.bind(this),this.updateContent=this.updateContent.bind(this),this.replaceContent=this.replaceContent.bind(this)}componentDidLoad(){this.replaceContent(this.value)}connectedCallback(){window.addEventListener("click",this.handleWindowClick)}disconnectedCallback(){window.removeEventListener("click",this.handleWindowClick)}replaceContent(e,t){if(null!=e&&e!==t){const t=e.match(new RegExp(`${this.replacementUriType}:[0-9a-z-]{36}`,"g")),r=this.replacements.reduce(((e,t)=>Object.assign(Object.assign({},e),{[v(t)]:t})),{});let i=e;const s=null!=t?null==t?void 0:t.reduce(((e,t)=>{if(null!=r[t]){const s=v(r[t]),a=i.indexOf(s),n=i.substring(0,a),l=i.substring(a+s.length),o=b(r[t],n);return i=l,[...e,o.before,o.beforeSpace,o.result,o.afterSpace]}return e}),[]):[];this.rawElements=[...s,c(i)].reduce(((e,t)=>[...e,...x(t)]),[]),this.updateContent(this.replacements)}}updateContent(e,t){null==this.contentEl||l(e,t)||(this.contentEl.innerHTML="",this.displayedElements=this.rawElements.map((e=>{const t=u(e)?e.innerText:e.textContent,r=this.replacements.find((e=>null==t?void 0:t.includes(v(e))));return null!=t&&null!=r?this.createReplacedElement(t,r):e})),this.displayedElements.forEach((e=>{var t;null===(t=this.contentEl)||void 0===t||t.appendChild("string"==typeof e?c(e):e)})),null!=this.lastReplacedSpace&&this.moveCursorToNodeEnd(this.lastReplacedSpace),this.inputChanged.emit(this.getContentAsString(this.contentEl)))}render(){var e;const t=a("wrapper",{standard:"standard"===this.variant,filled:"filled"===this.variant,underlined:"underlined"===this.variant,blank:"blank"===this.variant,disabled:this.disabled});return r(i,null,r("div",{class:t},r("span",{class:"content-input",role:"textbox",contentEditable:"true","aria-multiline":"true","data-placeholder":this.placeholder,ref:e=>this.contentEl=e,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onClick:this.handleCursorPositionUpdate,onInput:this.handleInput,onFocus:this.handleFocus,onBlur:this.handleBlur})),r("vertex-result-list",{position:this.cursorPosition,placement:this.placement,open:this.hasTriggered&&null!=this.resultItems&&this.resultItems.length>0,items:null!==(e=this.resultItems)&&void 0!==e?e:[],onEnterPressed:this.handleResultClick,onResultClick:this.handleResultClick},r("slot",{name:"results"})),r("slot",{name:"replaced"}))}handleKeyDown(e){this.hasTriggered&&this.breakCharacters.includes(e.key)&&(this.hasTriggered=!1,this.triggeredRange=void 0,this.triggeredElement=void 0)}handleKeyUp(e){this.handleCursorPositionUpdate(),this.cursorPosition=this.getCursorPosition()}async handleInput(){this.inputChanged.emit(this.getContentAsString(this.contentEl))}handleClick(){this.handleCursorPositionUpdate()}handleWindowClick(e){u(e.target)&&"true"===e.target.getAttribute("data-replaced")&&null!=e.target.nextSibling&&this.moveCursorToNodeEnd(e.target.nextSibling,!0)}handleFocus(e){this.inputFocus.emit(e)}handleBlur(e){this.hasTriggered=!1,this.inputBlur.emit(e)}handleResultClick(e){var t;const r=this.triggeredRange,i=this.triggeredElement,s=u(i)?i.innerText:null==i?void 0:i.textContent;if(null!=this.contentEl&&null!=r&&null!=i&&null!=s){const a=null!==(t=this.readTriggerValue(s,r.startOffset))&&void 0!==t?t:"",n=s.split(a),l=b(e.detail,n[0],n[1]);this.lastReplacedSpace=l.afterSpace,this.rawElements=Array.from(this.contentEl.childNodes).reduce(((e,t)=>[...e,...this.attemptReplaceElement(t,i,l)]),[]),this.hasTriggered=!1,this.resultReplaced.emit(e.detail),this.replacements=[...this.replacements.filter((t=>t.id!==e.detail.id)),e.detail]}}getCursorPosition(){var e;const t=o();if(null!=t&&t.rangeCount>0){const r=t.getRangeAt(0).getBoundingClientRect(),i=null===(e=this.contentEl)||void 0===e?void 0:e.getBoundingClientRect(),s=r.bottom||(null==i?void 0:i.bottom)||0,a=r.top||(null==i?void 0:i.top)||0;return{x:r.left||(null==i?void 0:i.left)||0,y:this.placement.includes("top")?a:s}}throw new Error("Unable to retrieve window selection.")}get hostEl(){return s(this)}static get watchers(){return{value:["replaceContent"],replacements:["updateContent"]}}};m.style=".wrapper.sc-vertex-search-bar{display:flex;align-items:center;width:100%;box-sizing:border-box;background:none;border:1px solid transparent;border-radius:4px;font-family:var(--vertex-ui-font-family);font-size:0.875rem;line-height:1.4}.content-input.sc-vertex-search-bar{width:100%;box-sizing:border-box;padding:6px 0.5em 7px;border:1px solid transparent;background:none;font-family:var(--vertex-ui-font-family);font-weight:var(--vertex-ui-font-weight-base);font-size:0.875rem;line-height:1.4;white-space:pre-line}.content-input.sc-vertex-search-bar:focus{outline:none}.standard.sc-vertex-search-bar{border-color:var(--vertex-ui-neutral-400);color:var(--vertex-ui-neutral-800)}.standard.sc-vertex-search-bar .content-input.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-500)}.standard.sc-vertex-search-bar:hover:not(.disabled),.standard.sc-vertex-search-bar:focus{border-color:var(--vertex-ui-neutral-500)}.standard.disabled.sc-vertex-search-bar{border-color:var(--vertex-ui-neutral-200)}.standard.disabled.sc-vertex-search-bar,.standard.disabled.sc-vertex-search-bar .content-input.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-400)}.blank.sc-vertex-search-bar{color:var(--vertex-ui-neutral-800)}.blank.sc-vertex-search-bar:not(:hover) .content-input.sc-vertex-search-bar:focus{border-color:var(--vertex-ui-neutral-400);border-radius:4px}.blank.sc-vertex-search-bar .content-input.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-500)}.blank.sc-vertex-search-bar:hover:not(.disabled) .content-input.sc-vertex-search-bar{border-color:var(--vertex-ui-neutral-400);border-radius:4px}.blank.disabled.sc-vertex-search-bar{border-color:var(--vertex-ui-neutral-200)}.blank.disabled.sc-vertex-search-bar,.blank.disabled.sc-vertex-search-bar .content-input.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-400)}.filled.sc-vertex-search-bar{background-color:var(--vertex-ui-neutral-200);border-color:var(--vertex-ui-neutral-200);color:var(--vertex-ui-neutral-800)}.filled.disabled.sc-vertex-search-bar,.filled.disabled.sc-vertex-search-bar .content-input.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-400)}.filled.sc-vertex-search-bar .content-input.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-700)}.filled.sc-vertex-search-bar:hover:not(.disabled),.filled.sc-vertex-search-bar:focus{border-bottom-color:var(--vertex-ui-blue-600)}.filled.disabled.sc-vertex-search-bar{border-color:var(--vertex-ui-neutral-100)}.filled.disabled.sc-vertex-search-bar,.filled.disabled.sc-vertex-search-bar .content-input.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-400)}.underlined.sc-vertex-search-bar{background-color:var(--vertex-ui-white);border-color:var(--vertex-ui-white) var(--vertex-ui-white) var(--vertex-ui-neutral-400) var(--vertex-ui-white);color:var(--vertex-ui-neutral-800)}.underlined.disabled.sc-vertex-search-bar,.underlined.disabled.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-400)}.underlined.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-700)}.underlined.sc-vertex-search-bar:hover:not(.disabled),.underlined.sc-vertex-search-bar:focus{background-color:var(--vertex-ui-neutral-200);border-color:var(--vertex-ui-neutral-200);border-bottom-color:var(--vertex-ui-blue-600)}.underlined.disabled.sc-vertex-search-bar{border-bottom-color:var(--vertex-ui-neutral-200)}.underlined.disabled.sc-vertex-search-bar,.underlined.disabled.sc-vertex-search-bar .content-input.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-400)}.underlined.has-error.sc-vertex-search-bar{border-bottom-color:var(--vertex-ui-red-600)}";export{m as S}
package/dist/esm/index.js CHANGED
@@ -28,7 +28,7 @@ export { R as Radio } from './radio-39c11ba4.js';
28
28
  export { R as RadioGroup } from './radio-group-7c35d2f0.js';
29
29
  export { R as Resizable } from './resizable-a147709b.js';
30
30
  export { R as ResultList } from './result-list-16c6afbd.js';
31
- export { S as SearchBar } from './search-bar-f12a3599.js';
31
+ export { S as SearchBar } from './search-bar-8d18626e.js';
32
32
  export { S as Select } from './select-d4e135b7.js';
33
33
  export { S as Slider } from './slider-dcdb388f.js';
34
34
  export { S as Spinner } from './spinner-afccea51.js';
@@ -53,12 +53,24 @@ const getWindowSelection = () => {
53
53
  }
54
54
  return undefined;
55
55
  };
56
+ const nodeHasChildNodes = (node) => {
57
+ return node.hasChildNodes();
58
+ };
56
59
  const createDocumentRange = () => {
57
60
  return document.createRange();
58
61
  };
59
62
  const createTextNode = (text) => {
60
63
  return new Text(text);
61
64
  };
65
+ const createBreak = () => {
66
+ return document.createElement('br');
67
+ };
68
+ const isHtmlElement = (node) => {
69
+ return node instanceof HTMLElement;
70
+ };
71
+ const isBrElement = (node) => {
72
+ return node instanceof HTMLBRElement;
73
+ };
62
74
 
63
75
  const createResultUri = (result) => {
64
76
  return `${result.type}:${result.id}`;
@@ -69,15 +81,56 @@ const createSearchResultReplacement = (result, before, after) => {
69
81
  before: createTextNode(before),
70
82
  beforeSpace: createTextNode(createHairSpace()),
71
83
  result: createTextNode(urn),
72
- afterSpace: after != null ? createTextNode(createNoBreakSpace()) : undefined,
84
+ afterSpace: after != null
85
+ ? createTextNode(createNoBreakSpace())
86
+ : createTextNode(createHairSpace()),
73
87
  after: after != null ? createTextNode(after) : undefined,
74
88
  };
75
89
  };
76
- const getNodesForSearchResultReplacement = (replacement) => {
90
+ /**
91
+ * Newline characters and spaces are represented slightly differently within a
92
+ * content editable element between browsers. This method standardizes the
93
+ * representation of those characters to avoid having to write branching logic
94
+ * to support each individual browser.
95
+ */
96
+ const standardizeNewlinesAndSpaces = (node) => {
97
+ const content = node.textContent;
98
+ if (content === '\n') {
99
+ return [createBreak()];
100
+ }
101
+ else if (content != null && content.includes('\n')) {
102
+ const split = content.split('\n');
103
+ return split.reduce((res, substr, i) => {
104
+ const previous = split[i - 1];
105
+ // Ignore the empty string if the prior element was converted
106
+ // to a breaking element to prevent duplication of newlines.
107
+ if (substr === '' && previous !== '') {
108
+ return res;
109
+ }
110
+ return [
111
+ ...res,
112
+ // Standard spaces are not always respected with in `Text`
113
+ // elements when appended to a contenteditable element. This
114
+ // conversion preserves that spacing.
115
+ createTextNode(substr.replace(/ /g, createNoBreakSpace())),
116
+ createBreak(),
117
+ ];
118
+ }, []);
119
+ }
120
+ return [node];
121
+ };
122
+ const getNodesForSearchResultReplacement = (replacement, isBreaking = false) => {
77
123
  const keys = Object.keys(replacement);
78
- return keys
124
+ const replacementElements = keys
79
125
  .map((key) => replacement[key])
80
126
  .filter((node) => node != null);
127
+ // If the element is intended to replace a breaking element such
128
+ // as a `<div>` wrapper, a newline is required alongside the standard
129
+ // replacement elements.
130
+ if (isBreaking) {
131
+ return [createTextNode('\n'), ...replacementElements];
132
+ }
133
+ return replacementElements;
81
134
  };
82
135
  /**
83
136
  * We leverage a couple unique spaces to represent mentions, allowing for
@@ -112,13 +165,34 @@ const SearchBar = class {
112
165
  this.inputFocus = createEvent(this, "inputFocus", 7);
113
166
  this.inputBlur = createEvent(this, "inputBlur", 7);
114
167
  this.rawElements = [];
168
+ this.attemptReplaceElement = (child, other, replacement, isBreaking = false) => {
169
+ // In the case that the child we're evaluating has its own children
170
+ // (often a wrapper `<div>`), we want to evaluate whether any of its
171
+ // children is the target to replace.
172
+ if (nodeHasChildNodes(child) &&
173
+ Array.from(child.childNodes).some((c) => nodeHasChildNodes(c) || this.isIdenticalElement(c, other))) {
174
+ return Array.from(child.childNodes).reduce((res, c) => [
175
+ ...res,
176
+ ...this.attemptReplaceElement(c, other, replacement,
177
+ // If the element we're evaluating is a wrapper, we want to
178
+ // consider it a breaking element and add a newline to the
179
+ // replaced element only if the previous node is a `Text` node.
180
+ !isHtmlElement(child.previousSibling)),
181
+ ], []);
182
+ }
183
+ else {
184
+ return this.isIdenticalElement(child, other)
185
+ ? getNodesForSearchResultReplacement(replacement, isBreaking)
186
+ : [child];
187
+ }
188
+ };
115
189
  this.isIdenticalElement = (child, other) => {
116
190
  return (child === this.triggeredElement ||
117
191
  this.getTextContent(child) === this.getTextContent(other));
118
192
  };
119
193
  this.getTextContent = (node) => {
120
194
  var _a;
121
- if (node instanceof HTMLElement) {
195
+ if (isHtmlElement(node)) {
122
196
  return node.innerText;
123
197
  }
124
198
  return (_a = node.textContent) !== null && _a !== void 0 ? _a : '';
@@ -195,21 +269,54 @@ const SearchBar = class {
195
269
  selection.addRange(range);
196
270
  }
197
271
  };
198
- this.getContentAsString = () => {
199
- if (this.contentEl != null) {
200
- return trimNonstandardSpaces(Array.from(this.contentEl.childNodes).reduce((res, n) => {
272
+ this.getContentAsString = (element) => {
273
+ if (element != null) {
274
+ const res = trimNonstandardSpaces(Array.from(element.childNodes).reduce((res, n) => {
201
275
  var _a;
202
- if (n instanceof HTMLElement &&
203
- n.getAttribute('data-replaced') === 'true') {
276
+ const previousSiblingIsBlock = n.previousSibling == null || isHtmlElement(n.previousSibling);
277
+ if (isHtmlElement(n) && n.getAttribute('data-replaced') === 'true') {
278
+ /**
279
+ * If an element has been replaced visually, append the original
280
+ * value prior to being replaced.
281
+ */
204
282
  return `${res}${n.getAttribute('data-original')}`;
205
283
  }
206
- else if (n instanceof HTMLElement) {
207
- return `${res}${n.innerText}`;
284
+ else if (isHtmlElement(n) && n.childElementCount > 0) {
285
+ /**
286
+ * If an element is a wrapper, we want to treat it as a block element,
287
+ * ensuring newlines before and after the content.
288
+ * Additionally, we want to evaluate each of its children independently.
289
+ * Some browsers will conditionally wrap content in additional wrapper
290
+ * elements we need to unravel.
291
+ */
292
+ return `${res}${previousSiblingIsBlock ? '' : '\n'}${this.getContentAsString(n)}`;
293
+ }
294
+ else if (isBrElement(n)) {
295
+ /**
296
+ * If an element is a `<br>` element, we want to simply represent
297
+ * it as a newline in the returned string.
298
+ */
299
+ return `${res}\n`;
300
+ }
301
+ else if (isHtmlElement(n)) {
302
+ /**
303
+ * If an element is a wrapper, we want to treat it as a block element,
304
+ * ensuring newlines before and after the content.
305
+ * If the prior element is also to be treated as a block format, we
306
+ * will omit the newline before the content to avoid duplicating the
307
+ * behavior.
308
+ */
309
+ return `${res}${previousSiblingIsBlock ? '' : '\n'}${n.innerText}\n`;
208
310
  }
209
311
  else {
312
+ /**
313
+ * If a node is simply a `Text` node, we just want to append the text
314
+ * if defined.
315
+ */
210
316
  return `${res}${(_a = n.textContent) !== null && _a !== void 0 ? _a : ''}`;
211
317
  }
212
318
  }, ''));
319
+ return res;
213
320
  }
214
321
  return '';
215
322
  };
@@ -285,12 +392,13 @@ const SearchBar = class {
285
392
  replacement.before,
286
393
  replacement.beforeSpace,
287
394
  replacement.result,
395
+ replacement.afterSpace,
288
396
  ];
289
397
  }
290
398
  return res;
291
399
  }, [])
292
400
  : [];
293
- this.rawElements = [...parts, createTextNode(nextSubstr)];
401
+ this.rawElements = [...parts, createTextNode(nextSubstr)].reduce((res, p) => [...res, ...standardizeNewlinesAndSpaces(p)], []);
294
402
  this.updateContent(this.replacements);
295
403
  }
296
404
  }
@@ -298,7 +406,7 @@ const SearchBar = class {
298
406
  if (this.contentEl != null && !fastDeepEqual(newValue, oldValue)) {
299
407
  this.contentEl.innerHTML = '';
300
408
  this.displayedElements = this.rawElements.map((el) => {
301
- const raw = el instanceof HTMLElement ? el.innerText : el.textContent;
409
+ const raw = isHtmlElement(el) ? el.innerText : el.textContent;
302
410
  const replacement = this.replacements.find((r) => raw === null || raw === void 0 ? void 0 : raw.includes(createResultUri(r)));
303
411
  if (raw != null && replacement != null) {
304
412
  const replacementElement = this.createReplacedElement(raw, replacement);
@@ -313,7 +421,7 @@ const SearchBar = class {
313
421
  if (this.lastReplacedSpace != null) {
314
422
  this.moveCursorToNodeEnd(this.lastReplacedSpace);
315
423
  }
316
- this.inputChanged.emit(this.getContentAsString());
424
+ this.inputChanged.emit(this.getContentAsString(this.contentEl));
317
425
  }
318
426
  }
319
427
  render() {
@@ -325,7 +433,7 @@ const SearchBar = class {
325
433
  blank: this.variant === 'blank',
326
434
  disabled: this.disabled,
327
435
  });
328
- return (h(Host, null, h("div", { class: classes }, h("span", { class: "content-input", role: "textbox", contentEditable: "true", "aria-multiline": "true", "data-placeholder": this.placeholder, ref: (el) => (this.contentEl = el), onKeyDown: this.handleKeyDown, onKeyUp: this.handleCursorPositionUpdate, onClick: this.handleCursorPositionUpdate, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur })), h("vertex-result-list", { position: this.cursorPosition, placement: this.placement, open: this.hasTriggered &&
436
+ return (h(Host, null, h("div", { class: classes }, h("span", { class: "content-input", role: "textbox", contentEditable: "true", "aria-multiline": "true", "data-placeholder": this.placeholder, ref: (el) => (this.contentEl = el), onKeyDown: this.handleKeyDown, onKeyUp: this.handleKeyUp, onClick: this.handleCursorPositionUpdate, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur })), h("vertex-result-list", { position: this.cursorPosition, placement: this.placement, open: this.hasTriggered &&
329
437
  this.resultItems != null &&
330
438
  this.resultItems.length > 0, items: (_a = this.resultItems) !== null && _a !== void 0 ? _a : [], onEnterPressed: this.handleResultClick, onResultClick: this.handleResultClick }, h("slot", { name: "results" })), h("slot", { name: "replaced" })));
331
439
  }
@@ -341,13 +449,13 @@ const SearchBar = class {
341
449
  this.cursorPosition = this.getCursorPosition();
342
450
  }
343
451
  async handleInput() {
344
- this.inputChanged.emit(this.getContentAsString());
452
+ this.inputChanged.emit(this.getContentAsString(this.contentEl));
345
453
  }
346
454
  handleClick() {
347
455
  this.handleCursorPositionUpdate();
348
456
  }
349
457
  handleWindowClick(event) {
350
- if (event.target instanceof HTMLElement &&
458
+ if (isHtmlElement(event.target) &&
351
459
  event.target.getAttribute('data-replaced') === 'true' &&
352
460
  event.target.nextSibling != null) {
353
461
  this.moveCursorToNodeEnd(event.target.nextSibling, true);
@@ -364,7 +472,7 @@ const SearchBar = class {
364
472
  var _a;
365
473
  const triggeredRange = this.triggeredRange;
366
474
  const triggeredElement = this.triggeredElement;
367
- const value = triggeredElement instanceof HTMLElement
475
+ const value = isHtmlElement(triggeredElement)
368
476
  ? triggeredElement.innerText
369
477
  : triggeredElement === null || triggeredElement === void 0 ? void 0 : triggeredElement.textContent;
370
478
  if (this.contentEl != null &&
@@ -378,12 +486,10 @@ const SearchBar = class {
378
486
  const replacement = createSearchResultReplacement(event.detail, before, after);
379
487
  this.lastReplacedSpace = replacement.afterSpace;
380
488
  this.rawElements = Array.from(this.contentEl.childNodes).reduce((re, e) => {
381
- if (this.isIdenticalElement(e, triggeredElement)) {
382
- return [...re, ...getNodesForSearchResultReplacement(replacement)];
383
- }
384
- else {
385
- return [...re, e];
386
- }
489
+ return [
490
+ ...re,
491
+ ...this.attemptReplaceElement(e, triggeredElement, replacement),
492
+ ];
387
493
  }, []);
388
494
  this.hasTriggered = false;
389
495
  this.resultReplaced.emit(event.detail);
@@ -1,4 +1,4 @@
1
- export { S as vertex_search_bar } from './search-bar-f12a3599.js';
1
+ export { S as vertex_search_bar } from './search-bar-8d18626e.js';
2
2
  import './index-72f28b71.js';
3
3
  import './index-9c609209.js';
4
4
  import './templates-797420bf.js';
@@ -1,3 +1,8 @@
1
1
  export declare const getWindowSelection: () => Selection | undefined | null;
2
+ export declare const nodeHasChildNodes: (node: Node) => boolean;
2
3
  export declare const createDocumentRange: () => Range;
3
4
  export declare const createTextNode: (text: string) => Text;
5
+ export declare const createBreak: () => HTMLBRElement;
6
+ export declare const createWrappingDiv: (nodes: Node[]) => HTMLDivElement;
7
+ export declare const isHtmlElement: (node?: Node | EventTarget | null) => node is HTMLElement;
8
+ export declare const isBrElement: (node: Node) => node is HTMLBRElement;
@@ -3,12 +3,19 @@ export interface SearchResultReplacement {
3
3
  before: Text;
4
4
  beforeSpace: Text;
5
5
  result: Text;
6
- afterSpace?: Text;
6
+ afterSpace: Text;
7
7
  after?: Text;
8
8
  }
9
9
  export declare const createResultUri: (result: Result) => string;
10
10
  export declare const createSearchResultReplacement: (result: Result, before: string, after?: string) => SearchResultReplacement;
11
- export declare const getNodesForSearchResultReplacement: (replacement: SearchResultReplacement) => Text[];
11
+ /**
12
+ * Newline characters and spaces are represented slightly differently within a
13
+ * content editable element between browsers. This method standardizes the
14
+ * representation of those characters to avoid having to write branching logic
15
+ * to support each individual browser.
16
+ */
17
+ export declare const standardizeNewlinesAndSpaces: (node: ChildNode) => ChildNode[];
18
+ export declare const getNodesForSearchResultReplacement: (replacement: SearchResultReplacement, isBreaking?: boolean) => Text[];
12
19
  /**
13
20
  * We leverage a couple unique spaces to represent mentions, allowing for
14
21
  * correct cursor movement when using arrow keys. As these characters are
@@ -121,6 +121,7 @@ export declare class SearchBar {
121
121
  private handleFocus;
122
122
  private handleBlur;
123
123
  private handleResultClick;
124
+ private attemptReplaceElement;
124
125
  private isIdenticalElement;
125
126
  private getTextContent;
126
127
  private getCursorPosition;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertexvis/ui",
3
- "version": "0.1.0-canary.14",
3
+ "version": "0.1.0-canary.15",
4
4
  "description": "The Vertex UI component library.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -87,5 +87,5 @@
87
87
  "@vertexvis/utils": "^0.21.0",
88
88
  "fast-deep-equal": "^3.1.3"
89
89
  },
90
- "gitHead": "bf51941b29ff2f6ea794eef42fcdbcd867736e98"
90
+ "gitHead": "41506ac171f4e6645cc68412d714621a28c1bb29"
91
91
  }
@@ -1 +0,0 @@
1
- export{S as vertex_search_bar}from"./p-db34f10c.js";import"./p-6834631c.js";import"./p-fe062eb0.js";import"./p-1356f525.js";import"./p-59032668.js";
@@ -1 +0,0 @@
1
- import{r as e,e as t,h as r,H as i,g as s}from"./p-6834631c.js";import{c as a}from"./p-fe062eb0.js";import{g as n}from"./p-1356f525.js";var l=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var i,s,a;if(Array.isArray(t)){if((i=t.length)!=r.length)return!1;for(s=i;0!=s--;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((i=(a=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(s=i;0!=s--;)if(!Object.prototype.hasOwnProperty.call(r,a[s]))return!1;for(s=i;0!=s--;){var n=a[s];if(!e(t[n],r[n]))return!1}return!0}return t!=t&&r!=r};const o=()=>{if("undefined"!=typeof window)return window.getSelection()},h=e=>new Text(e),c=e=>`${e.type}:${e.id}`,d=(e,t,r)=>{const i=c(e);return{before:h(t),beforeSpace:h(v()),result:h(i),afterSpace:null!=r?h(b()):void 0,after:null!=r?h(r):void 0}},u=e=>Object.keys(e).map((t=>e[t])).filter((e=>null!=e)),v=()=>String.fromCharCode(8202),b=()=>String.fromCharCode(160),x=class{constructor(r){e(this,r),this.searchChanged=t(this,"searchChanged",7),this.inputChanged=t(this,"inputChanged",7),this.resultReplaced=t(this,"resultReplaced",7),this.inputFocus=t(this,"inputFocus",7),this.inputBlur=t(this,"inputBlur",7),this.rawElements=[],this.isIdenticalElement=(e,t)=>e===this.triggeredElement||this.getTextContent(e)===this.getTextContent(t),this.getTextContent=e=>{var t;return e instanceof HTMLElement?e.innerText:null!==(t=e.textContent)&&void 0!==t?t:""},this.handleCursorPositionUpdate=()=>{var e,t;const r=null===(e=o())||void 0===e?void 0:e.getRangeAt(0);if(null!=r){const e=this.readTriggerValue(null!==(t=r.commonAncestorContainer.textContent)&&void 0!==t?t:"",r.startOffset);this.hasTriggered||null==e?this.hasTriggered&&null!=e?(this.triggeredRange=r,this.triggeredElement=r.commonAncestorContainer,this.searchChanged.emit(e.replace(this.triggerCharacter,""))):(this.hasTriggered=!1,this.triggeredRange=void 0,this.triggeredElement=void 0):(this.hasTriggered=!0,this.triggeredRange=r,this.triggeredElement=r.commonAncestorContainer,this.searchChanged.emit(e.replace(this.triggerCharacter,"")))}this.cursorPosition=this.getCursorPosition()},this.readTriggerValue=(e,t)=>{const r=e.replace(String.fromCharCode(160)," "),i=r.substring(0,t),s=r.substring(t),a=`${i.includes(this.triggerCharacter)?i.substring(i.lastIndexOf(this.triggerCharacter)):""}${s.substring(0,this.firstIndexOfBreakCharacter(s))}`;return a.includes(this.triggerCharacter)&&!this.includesBreakCharacter(a)?a:void 0},this.includesBreakCharacter=e=>this.breakCharacters.some((t=>e.includes(t))),this.firstIndexOfBreakCharacter=e=>{const t=this.breakCharacters.map((t=>e.indexOf(t))).filter((e=>e>=0));return t.length>0?Math.min(...t):e.length},this.moveCursorToNodeEnd=(e,t=!1)=>{const r=o();if(null!=r){const i=document.createRange();i.selectNodeContents(e),i.collapse(t),r.removeAllRanges(),r.addRange(i)}},this.getContentAsString=()=>null!=this.contentEl?Array.from(this.contentEl.childNodes).reduce(((e,t)=>{var r;return t instanceof HTMLElement&&"true"===t.getAttribute("data-replaced")?`${e}${t.getAttribute("data-original")}`:t instanceof HTMLElement?`${e}${t.innerText}`:`${e}${null!==(r=t.textContent)&&void 0!==r?r:""}`}),"").replace(/[\u200A]/g,"").replace(/[\u00A0]/g," "):"",this.createReplacedElement=(e,t)=>{const r=this.hostEl.querySelector('template[slot="replaced"]');if(null!=r){const i=n(r);return i.bindings.bind(t),i.element.id=t.id,i.element.style.display="inline-block",i.element.contentEditable="false",i.element.tabIndex=-1,i.element.setAttribute("data-replaced","true"),i.element.setAttribute("data-original",e),i.element}throw new Error("Replaced template not defined.")},this.variant="standard",this.disabled=!1,this.triggerCharacter="@",this.breakCharacters=[" ","\n"],this.resultItems=void 0,this.placement="bottom-start",this.value=void 0,this.placeholder=void 0,this.replacements=[],this.replacementUriType="user",this.cursorPosition=void 0,this.displayedElements=[],this.hasTriggered=!1,this.handleKeyDown=this.handleKeyDown.bind(this),this.handleKeyUp=this.handleKeyUp.bind(this),this.handleResultClick=this.handleResultClick.bind(this),this.handleClick=this.handleClick.bind(this),this.handleWindowClick=this.handleWindowClick.bind(this),this.handleInput=this.handleInput.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleCursorPositionUpdate=this.handleCursorPositionUpdate.bind(this),this.updateContent=this.updateContent.bind(this),this.replaceContent=this.replaceContent.bind(this)}componentDidLoad(){this.replaceContent(this.value)}connectedCallback(){window.addEventListener("click",this.handleWindowClick)}disconnectedCallback(){window.removeEventListener("click",this.handleWindowClick)}replaceContent(e,t){if(null!=e&&e!==t){const t=e.match(new RegExp(`${this.replacementUriType}:[0-9a-z-]{36}`,"g")),r=this.replacements.reduce(((e,t)=>Object.assign(Object.assign({},e),{[c(t)]:t})),{});let i=e;const s=null!=t?null==t?void 0:t.reduce(((e,t)=>{if(null!=r[t]){const s=c(r[t]),a=i.indexOf(s),n=i.substring(0,a),l=i.substring(a+s.length),o=d(r[t],n);return i=l,[...e,o.before,o.beforeSpace,o.result]}return e}),[]):[];this.rawElements=[...s,h(i)],this.updateContent(this.replacements)}}updateContent(e,t){null==this.contentEl||l(e,t)||(this.contentEl.innerHTML="",this.displayedElements=this.rawElements.map((e=>{const t=e instanceof HTMLElement?e.innerText:e.textContent,r=this.replacements.find((e=>null==t?void 0:t.includes(c(e))));return null!=t&&null!=r?this.createReplacedElement(t,r):e})),this.displayedElements.forEach((e=>{var t;null===(t=this.contentEl)||void 0===t||t.appendChild("string"==typeof e?h(e):e)})),null!=this.lastReplacedSpace&&this.moveCursorToNodeEnd(this.lastReplacedSpace),this.inputChanged.emit(this.getContentAsString()))}render(){var e;const t=a("wrapper",{standard:"standard"===this.variant,filled:"filled"===this.variant,underlined:"underlined"===this.variant,blank:"blank"===this.variant,disabled:this.disabled});return r(i,null,r("div",{class:t},r("span",{class:"content-input",role:"textbox",contentEditable:"true","aria-multiline":"true","data-placeholder":this.placeholder,ref:e=>this.contentEl=e,onKeyDown:this.handleKeyDown,onKeyUp:this.handleCursorPositionUpdate,onClick:this.handleCursorPositionUpdate,onInput:this.handleInput,onFocus:this.handleFocus,onBlur:this.handleBlur})),r("vertex-result-list",{position:this.cursorPosition,placement:this.placement,open:this.hasTriggered&&null!=this.resultItems&&this.resultItems.length>0,items:null!==(e=this.resultItems)&&void 0!==e?e:[],onEnterPressed:this.handleResultClick,onResultClick:this.handleResultClick},r("slot",{name:"results"})),r("slot",{name:"replaced"}))}handleKeyDown(e){this.hasTriggered&&this.breakCharacters.includes(e.key)&&(this.hasTriggered=!1,this.triggeredRange=void 0,this.triggeredElement=void 0)}handleKeyUp(e){this.handleCursorPositionUpdate(),this.cursorPosition=this.getCursorPosition()}async handleInput(){this.inputChanged.emit(this.getContentAsString())}handleClick(){this.handleCursorPositionUpdate()}handleWindowClick(e){e.target instanceof HTMLElement&&"true"===e.target.getAttribute("data-replaced")&&null!=e.target.nextSibling&&this.moveCursorToNodeEnd(e.target.nextSibling,!0)}handleFocus(e){this.inputFocus.emit(e)}handleBlur(e){this.hasTriggered=!1,this.inputBlur.emit(e)}handleResultClick(e){var t;const r=this.triggeredRange,i=this.triggeredElement,s=i instanceof HTMLElement?i.innerText:null==i?void 0:i.textContent;if(null!=this.contentEl&&null!=r&&null!=i&&null!=s){const a=null!==(t=this.readTriggerValue(s,r.startOffset))&&void 0!==t?t:"",n=s.split(a),l=d(e.detail,n[0],n[1]);this.lastReplacedSpace=l.afterSpace,this.rawElements=Array.from(this.contentEl.childNodes).reduce(((e,t)=>this.isIdenticalElement(t,i)?[...e,...u(l)]:[...e,t]),[]),this.hasTriggered=!1,this.resultReplaced.emit(e.detail),this.replacements=[...this.replacements.filter((t=>t.id!==e.detail.id)),e.detail]}}getCursorPosition(){var e;const t=o();if(null!=t&&t.rangeCount>0){const r=t.getRangeAt(0).getBoundingClientRect(),i=null===(e=this.contentEl)||void 0===e?void 0:e.getBoundingClientRect(),s=r.bottom||(null==i?void 0:i.bottom)||0,a=r.top||(null==i?void 0:i.top)||0;return{x:r.left||(null==i?void 0:i.left)||0,y:this.placement.includes("top")?a:s}}throw new Error("Unable to retrieve window selection.")}get hostEl(){return s(this)}static get watchers(){return{value:["replaceContent"],replacements:["updateContent"]}}};x.style=".wrapper.sc-vertex-search-bar{display:flex;align-items:center;width:100%;box-sizing:border-box;background:none;border:1px solid transparent;border-radius:4px;font-family:var(--vertex-ui-font-family);font-size:0.875rem;line-height:1.4}.content-input.sc-vertex-search-bar{width:100%;box-sizing:border-box;padding:6px 0.5em 7px;border:1px solid transparent;background:none;font-family:var(--vertex-ui-font-family);font-weight:var(--vertex-ui-font-weight-base);font-size:0.875rem;line-height:1.4;white-space:pre-line}.content-input.sc-vertex-search-bar:focus{outline:none}.standard.sc-vertex-search-bar{border-color:var(--vertex-ui-neutral-400);color:var(--vertex-ui-neutral-800)}.standard.sc-vertex-search-bar .content-input.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-500)}.standard.sc-vertex-search-bar:hover:not(.disabled),.standard.sc-vertex-search-bar:focus{border-color:var(--vertex-ui-neutral-500)}.standard.disabled.sc-vertex-search-bar{border-color:var(--vertex-ui-neutral-200)}.standard.disabled.sc-vertex-search-bar,.standard.disabled.sc-vertex-search-bar .content-input.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-400)}.blank.sc-vertex-search-bar{color:var(--vertex-ui-neutral-800)}.blank.sc-vertex-search-bar:not(:hover) .content-input.sc-vertex-search-bar:focus{border-color:var(--vertex-ui-neutral-400);border-radius:4px}.blank.sc-vertex-search-bar .content-input.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-500)}.blank.sc-vertex-search-bar:hover:not(.disabled) .content-input.sc-vertex-search-bar{border-color:var(--vertex-ui-neutral-400);border-radius:4px}.blank.disabled.sc-vertex-search-bar{border-color:var(--vertex-ui-neutral-200)}.blank.disabled.sc-vertex-search-bar,.blank.disabled.sc-vertex-search-bar .content-input.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-400)}.filled.sc-vertex-search-bar{background-color:var(--vertex-ui-neutral-200);border-color:var(--vertex-ui-neutral-200);color:var(--vertex-ui-neutral-800)}.filled.disabled.sc-vertex-search-bar,.filled.disabled.sc-vertex-search-bar .content-input.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-400)}.filled.sc-vertex-search-bar .content-input.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-700)}.filled.sc-vertex-search-bar:hover:not(.disabled),.filled.sc-vertex-search-bar:focus{border-bottom-color:var(--vertex-ui-blue-600)}.filled.disabled.sc-vertex-search-bar{border-color:var(--vertex-ui-neutral-100)}.filled.disabled.sc-vertex-search-bar,.filled.disabled.sc-vertex-search-bar .content-input.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-400)}.underlined.sc-vertex-search-bar{background-color:var(--vertex-ui-white);border-color:var(--vertex-ui-white) var(--vertex-ui-white) var(--vertex-ui-neutral-400) var(--vertex-ui-white);color:var(--vertex-ui-neutral-800)}.underlined.disabled.sc-vertex-search-bar,.underlined.disabled.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-400)}.underlined.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-700)}.underlined.sc-vertex-search-bar:hover:not(.disabled),.underlined.sc-vertex-search-bar:focus{background-color:var(--vertex-ui-neutral-200);border-color:var(--vertex-ui-neutral-200);border-bottom-color:var(--vertex-ui-blue-600)}.underlined.disabled.sc-vertex-search-bar{border-bottom-color:var(--vertex-ui-neutral-200)}.underlined.disabled.sc-vertex-search-bar,.underlined.disabled.sc-vertex-search-bar .content-input.sc-vertex-search-bar:empty::before{content:attr(data-placeholder);color:var(--vertex-ui-neutral-400)}.underlined.has-error.sc-vertex-search-bar{border-bottom-color:var(--vertex-ui-red-600)}";export{x as S}