@vertexvis/ui 0.1.0-canary.7 → 0.1.0-canary.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/cjs/components.cjs.js +1 -1
  2. package/dist/cjs/{icon-460fd0f5.js → icon-21deee4d.js} +1 -1
  3. package/dist/cjs/{icon-button-786427d6.js → icon-button-b7ed3b48.js} +1 -1
  4. package/dist/cjs/{icon-helper-ba408f49.js → icon-helper-31ee6ce0.js} +5 -0
  5. package/dist/cjs/index.cjs.js +5 -5
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/{result-list-1e592c3c.js → result-list-241ffe8d.js} +46 -2
  8. package/dist/cjs/search-bar-91cbcd07.js +421 -0
  9. package/dist/cjs/vertex-icon-button.cjs.entry.js +2 -2
  10. package/dist/cjs/vertex-icon.cjs.entry.js +2 -2
  11. package/dist/cjs/vertex-result-list.cjs.entry.js +1 -1
  12. package/dist/cjs/vertex-search-bar.cjs.entry.js +1 -1
  13. package/dist/collection/collection-manifest.json +1 -1
  14. package/dist/collection/components/icon/icon-helper.js +3 -0
  15. package/dist/collection/components/icon/icon.js +1 -1
  16. package/dist/collection/components/icon/icons/compare.js +2 -0
  17. package/dist/collection/components/icon-button/icon-button.js +1 -1
  18. package/dist/collection/components/result-list/result-list.js +52 -5
  19. package/dist/collection/components/result-list/types.js +1 -0
  20. package/dist/collection/components/search-bar/dom.js +12 -0
  21. package/dist/collection/components/search-bar/lib.js +35 -15
  22. package/dist/collection/components/search-bar/search-bar.css +0 -16
  23. package/dist/collection/components/search-bar/search-bar.js +380 -324
  24. package/dist/collection/types/icon.js +1 -0
  25. package/dist/collection/util/templates/element-pool.js +19 -1
  26. package/dist/components/components.esm.js +1 -1
  27. package/dist/components/index.esm.js +1 -1
  28. package/dist/components/p-1c7dc57e.js +1 -0
  29. package/dist/components/p-646ac7e7.entry.js +1 -0
  30. package/dist/components/p-6b862967.js +1 -0
  31. package/dist/components/p-cfe369bf.entry.js +1 -0
  32. package/dist/components/{p-103249b4.js → p-daabd39c.js} +1 -1
  33. package/dist/components/p-db34f10c.js +1 -0
  34. package/dist/components/p-ee496965.entry.js +1 -0
  35. package/dist/components/p-f03fe304.entry.js +1 -0
  36. package/dist/components/{p-ca52a423.js → p-fe0f0f64.js} +1 -1
  37. package/dist/esm/components.js +1 -1
  38. package/dist/esm/{icon-d37150b4.js → icon-8b8d7617.js} +1 -1
  39. package/dist/esm/{icon-button-aad3c0e7.js → icon-button-192f2555.js} +1 -1
  40. package/dist/esm/{icon-helper-83f10f73.js → icon-helper-a6be8de9.js} +5 -0
  41. package/dist/esm/index.js +5 -5
  42. package/dist/esm/loader.js +1 -1
  43. package/dist/esm/{result-list-36cfb08a.js → result-list-16c6afbd.js} +46 -2
  44. package/dist/esm/search-bar-f12a3599.js +419 -0
  45. package/dist/esm/vertex-icon-button.entry.js +2 -2
  46. package/dist/esm/vertex-icon.entry.js +2 -2
  47. package/dist/esm/vertex-result-list.entry.js +1 -1
  48. package/dist/esm/vertex-search-bar.entry.js +1 -1
  49. package/dist/types/components/icon/icons/compare.d.ts +3 -0
  50. package/dist/types/components/result-list/result-list.d.ts +6 -1
  51. package/dist/types/components/result-list/types.d.ts +4 -0
  52. package/dist/types/components/search-bar/dom.d.ts +3 -0
  53. package/dist/types/components/search-bar/lib.d.ts +24 -6
  54. package/dist/types/components/search-bar/search-bar.d.ts +124 -42
  55. package/dist/types/components.d.ts +81 -20
  56. package/dist/types/types/icon.d.ts +1 -0
  57. package/dist/types/util/templates/element-pool.d.ts +10 -1
  58. package/package.json +4 -3
  59. package/dist/cjs/search-bar-bb40cfa7.js +0 -290
  60. package/dist/components/p-03dbb28c.js +0 -1
  61. package/dist/components/p-19318fee.entry.js +0 -1
  62. package/dist/components/p-4224c2ad.js +0 -1
  63. package/dist/components/p-52739247.js +0 -1
  64. package/dist/components/p-7dba2574.entry.js +0 -1
  65. package/dist/components/p-ae6a3c46.entry.js +0 -1
  66. package/dist/components/p-f71fc166.entry.js +0 -1
  67. package/dist/esm/search-bar-59cc151d.js +0 -288
@@ -1,67 +1,149 @@
1
1
  import { EventEmitter, h } from '../../stencil-public-runtime';
2
2
  import { PopoverPlacement } from '../popover/popover';
3
- import { Result } from '../result-list/result-list';
3
+ import { Result } from '../result-list/types';
4
4
  export type SearchBarVariant = 'standard' | 'filled' | 'underlined' | 'blank';
5
5
  export declare class SearchBar {
6
+ /**
7
+ * The search bar variant to display.
8
+ *
9
+ * Possible options are:
10
+ * - 'standard' (default)
11
+ * - 'filled'
12
+ * - 'underlined'
13
+ * - 'blank
14
+ */
6
15
  variant: SearchBarVariant;
7
- resultItems?: Result[];
8
- triggerCharacters: string[];
9
- triggerCharacter?: string;
16
+ /**
17
+ * Whether this search bar is disabled.
18
+ */
19
+ disabled: boolean;
20
+ /**
21
+ * The character indicating that we should trigger a search.
22
+ *
23
+ * When this character is encountered, the text following it
24
+ * (omitting `breakCharacters`) will be emitted as a `searchChanged`
25
+ * event.
26
+ */
27
+ triggerCharacter: string;
28
+ /**
29
+ * Characters that should trigger a "break" of the search. If
30
+ * a value in this list is encountered when trying to parse back
31
+ * to the `triggerCharacter`, this will hide the result list.
32
+ */
10
33
  breakCharacters: string[];
11
- debounce: number;
12
34
  /**
13
- * Placeholder for text input.
35
+ * The items to display in this search bar's `<vertex-result-list>`.
36
+ *
37
+ * This can be used alongside the `searchChanged` event to query for
38
+ * results to display.
39
+ */
40
+ resultItems?: Result[];
41
+ /**
42
+ * The placement of the result list for this search bar.
43
+ *
44
+ * Corresponds to the value for the underlying <vertex-popover>
45
+ * placement value.
46
+ * @see(PopoverPlacement)
14
47
  */
15
- placeholder?: string;
16
48
  placement: PopoverPlacement;
17
- triggerCharacterPressed: EventEmitter<string>;
18
- private cursorPosition?;
19
- private open;
20
- private triggerKey?;
21
- private triggerRange?;
22
- private hostEl;
23
49
  /**
24
- * Emitted when the value has changed.
50
+ * The initial value of this search bar. This will be used in
51
+ * combination with the value of `replacements` to display existing
52
+ * replaced values.
25
53
  */
26
- valueChanged: EventEmitter<void>;
54
+ value?: string;
27
55
  /**
28
- * Emitted when input focused
56
+ * A placeholder to display when no text has been entered.
29
57
  */
30
- inputFocus: EventEmitter<FocusEvent>;
58
+ placeholder?: string;
31
59
  /**
32
- * Emitted when input blurred
60
+ * Replaced result values. This will be used in combination with the
61
+ * value of `value` to display existing replaced values.
62
+ *
63
+ * This value will be automatically updated as `Result`s are clicked
64
+ * within this search bar's `<vertex-result-list>`.
33
65
  */
34
- inputBlur: EventEmitter<FocusEvent>;
66
+ replacements: Result[];
67
+ /**
68
+ * The URI type of the values to replace. When `replacements` are
69
+ * evaluated, this value will be used as the scheme portion of the
70
+ * URI to detect matches.
71
+ *
72
+ * Defaults to `user`, and will match URIs composed with the `user`
73
+ * scheme and a UUID. E.g.
74
+ * `user:00000000-0000-0000-0000-000000000000`
75
+ */
76
+ replacementUriType: string;
77
+ /**
78
+ * Emitted when the value of the current search triggered by
79
+ * the specified `triggerCharacter` has changed.
80
+ */
81
+ searchChanged: EventEmitter<string>;
82
+ /**
83
+ * Emitted when the value of the input has changed.
84
+ */
85
+ inputChanged: EventEmitter<string>;
86
+ /**
87
+ * Emitted when a result has been selected to replace the trigger text.
88
+ *
89
+ * Includes the ID of the `Result` selected.
90
+ */
91
+ resultReplaced: EventEmitter<Result>;
92
+ /**
93
+ * Emitted when the input is focused.
94
+ */
95
+ inputFocus: EventEmitter<FocusEvent>;
35
96
  /**
36
- * Emitted when enter is pressed an a result is highlighted.
97
+ * Emitted when the input is blurred.
37
98
  */
38
- resultsEnterPressed: EventEmitter<Result>;
99
+ inputBlur: EventEmitter<FocusEvent>;
100
+ private hostEl;
101
+ private cursorPosition?;
102
+ private displayedElements;
103
+ private hasTriggered;
39
104
  private contentEl?;
40
- private triggerTimeout?;
41
- protected componentWillLoad(): void;
105
+ private triggeredElement?;
106
+ private triggeredRange?;
107
+ private rawElements;
108
+ private lastReplacedSpace?;
109
+ constructor();
110
+ protected componentDidLoad(): void;
111
+ protected connectedCallback(): void;
42
112
  protected disconnectedCallback(): void;
43
- replaceTriggeredValue(data: Record<string, unknown>): Promise<void>;
44
- getEditableContent(): Promise<NodeListOf<ChildNode> | undefined>;
113
+ protected replaceContent(newValue?: string, oldValue?: string): void;
114
+ protected updateContent(newValue?: Result[], oldValue?: Result[]): void;
45
115
  render(): h.JSX.IntrinsicElements;
46
116
  private handleKeyDown;
47
117
  private handleKeyUp;
48
- private updateTriggerValue;
49
- private triggerText;
50
- private restartTriggerInput;
51
- private clearTriggerTimeout;
52
- private updateCursorPosition;
53
- private moveCursorToNodeEnd;
54
- private updateInputCursorPosition;
55
- private createReplacedElement;
56
- private handleSelectionChange;
57
- private getSelectionSubstring;
58
- private insertAdjacentTextNode;
59
- private updateTriggerState;
60
- private updateTriggerRange;
61
- private clearTriggerState;
62
- private lastIndexOfBreakCharacter;
118
+ private handleInput;
119
+ private handleClick;
120
+ private handleWindowClick;
63
121
  private handleFocus;
64
122
  private handleBlur;
65
- private handleInputPointerEvent;
66
- private handleResultPointerDown;
123
+ private handleResultClick;
124
+ private isIdenticalElement;
125
+ private getTextContent;
126
+ private getCursorPosition;
127
+ /**
128
+ * Inspects the cursor position for the following conditions:
129
+ *
130
+ * 1. The cursor has moved to text that contains a valid string
131
+ * and trigger character, indicating we need to dispatch a
132
+ * `searchChanged` event and display the results.
133
+ *
134
+ * 2. The cursor has moved within text that contains a valid string
135
+ * and trigger character, indicating we need to dispatch a
136
+ * `searchChanged` event to update the currently displayed results.
137
+ *
138
+ * 3. The cursor has moved to text that does not contain a valid
139
+ * string and trigger character, indicating we need to hide any
140
+ * displayed search results.
141
+ */
142
+ private handleCursorPositionUpdate;
143
+ private readTriggerValue;
144
+ private includesBreakCharacter;
145
+ private firstIndexOfBreakCharacter;
146
+ private moveCursorToNodeEnd;
147
+ private getContentAsString;
148
+ private createReplacedElement;
67
149
  }
@@ -21,9 +21,8 @@ import { PopoverPlacement as PopoverPlacement1, PopoverResizeBehavior } from "./
21
21
  import { DetectOverflowOptions, FlipOptions, OffsetOptions } from "@floating-ui/dom";
22
22
  import { RadioChangeEventDetail } from "./components/radio/radio";
23
23
  import { HorizontalDragDirection, ResizableBoundsUpdate, ResizeEventDetails, VerticalDragDirection } from "./components/resizable/resizable";
24
- import { Result } from "./components/result-list/result-list";
24
+ import { Result } from "./components/result-list/types";
25
25
  import { SearchBarVariant } from "./components/search-bar/search-bar";
26
- import { Result as Result1 } from "./components/result-list/result-list";
27
26
  import { LabelDisplay, SliderChangeEventDetails, SliderSize } from "./components/slider/slider";
28
27
  import { SpinnerColor, SpinnerSize } from "./components/spinner/spinner";
29
28
  import { InputChangeEventDetail as InputChangeEventDetail1, TextFieldAutocomplete, TextFieldType, TextFieldVariant, TextSize as TextSize1 } from "./components/text-field/text-field";
@@ -572,18 +571,46 @@ export namespace Components {
572
571
  "viewportStartIndex": number;
573
572
  }
574
573
  interface VertexSearchBar {
574
+ /**
575
+ * Characters that should trigger a "break" of the search. If a value in this list is encountered when trying to parse back to the `triggerCharacter`, this will hide the result list.
576
+ */
575
577
  "breakCharacters": string[];
576
- "debounce": number;
577
- "getEditableContent": () => Promise<NodeListOf<ChildNode> | undefined>;
578
578
  /**
579
- * Placeholder for text input.
579
+ * Whether this search bar is disabled.
580
+ */
581
+ "disabled": boolean;
582
+ /**
583
+ * A placeholder to display when no text has been entered.
580
584
  */
581
585
  "placeholder"?: string;
586
+ /**
587
+ * The placement of the result list for this search bar. Corresponds to the value for the underlying <vertex-popover> placement value.
588
+ * @see (PopoverPlacement)
589
+ */
582
590
  "placement": PopoverPlacement;
583
- "replaceTriggeredValue": (data: Record<string, unknown>) => Promise<void>;
584
- "resultItems"?: Result1[];
585
- "triggerCharacter"?: string;
586
- "triggerCharacters": string[];
591
+ /**
592
+ * The URI type of the values to replace. When `replacements` are evaluated, this value will be used as the scheme portion of the URI to detect matches. Defaults to `user`, and will match URIs composed with the `user` scheme and a UUID. E.g. `user:00000000-0000-0000-0000-000000000000`
593
+ */
594
+ "replacementUriType": string;
595
+ /**
596
+ * Replaced result values. This will be used in combination with the value of `value` to display existing replaced values. This value will be automatically updated as `Result`s are clicked within this search bar's `<vertex-result-list>`.
597
+ */
598
+ "replacements": Result[];
599
+ /**
600
+ * The items to display in this search bar's `<vertex-result-list>`. This can be used alongside the `searchChanged` event to query for results to display.
601
+ */
602
+ "resultItems"?: Result[];
603
+ /**
604
+ * The character indicating that we should trigger a search. When this character is encountered, the text following it (omitting `breakCharacters`) will be emitted as a `searchChanged` event.
605
+ */
606
+ "triggerCharacter": string;
607
+ /**
608
+ * The initial value of this search bar. This will be used in combination with the value of `replacements` to display existing replaced values.
609
+ */
610
+ "value"?: string;
611
+ /**
612
+ * The search bar variant to display. Possible options are: - 'standard' (default) - 'filled' - 'underlined' - 'blank
613
+ */
587
614
  "variant": SearchBarVariant;
588
615
  }
589
616
  interface VertexSelect {
@@ -1767,6 +1794,7 @@ declare namespace LocalJSX {
1767
1794
  "items"?: Result[];
1768
1795
  "itemsJson"?: string;
1769
1796
  "onEnterPressed"?: (event: VertexResultListCustomEvent<Result>) => void;
1797
+ "onResultClick"?: (event: VertexResultListCustomEvent<Result>) => void;
1770
1798
  "open"?: boolean;
1771
1799
  "overScanCount"?: number;
1772
1800
  "placement"?: PopoverPlacement;
@@ -1776,33 +1804,66 @@ declare namespace LocalJSX {
1776
1804
  "viewportStartIndex"?: number;
1777
1805
  }
1778
1806
  interface VertexSearchBar {
1807
+ /**
1808
+ * Characters that should trigger a "break" of the search. If a value in this list is encountered when trying to parse back to the `triggerCharacter`, this will hide the result list.
1809
+ */
1779
1810
  "breakCharacters"?: string[];
1780
- "debounce"?: number;
1781
1811
  /**
1782
- * Emitted when input blurred
1812
+ * Whether this search bar is disabled.
1813
+ */
1814
+ "disabled"?: boolean;
1815
+ /**
1816
+ * Emitted when the input is blurred.
1783
1817
  */
1784
1818
  "onInputBlur"?: (event: VertexSearchBarCustomEvent<FocusEvent>) => void;
1785
1819
  /**
1786
- * Emitted when input focused
1820
+ * Emitted when the value of the input has changed.
1821
+ */
1822
+ "onInputChanged"?: (event: VertexSearchBarCustomEvent<string>) => void;
1823
+ /**
1824
+ * Emitted when the input is focused.
1787
1825
  */
1788
1826
  "onInputFocus"?: (event: VertexSearchBarCustomEvent<FocusEvent>) => void;
1789
1827
  /**
1790
- * Emitted when enter is pressed an a result is highlighted.
1828
+ * Emitted when a result has been selected to replace the trigger text. Includes the ID of the `Result` selected.
1791
1829
  */
1792
- "onResultsEnterPressed"?: (event: VertexSearchBarCustomEvent<Result1>) => void;
1793
- "onTriggerCharacterPressed"?: (event: VertexSearchBarCustomEvent<string>) => void;
1830
+ "onResultReplaced"?: (event: VertexSearchBarCustomEvent<Result>) => void;
1794
1831
  /**
1795
- * Emitted when the value has changed.
1832
+ * Emitted when the value of the current search triggered by the specified `triggerCharacter` has changed.
1796
1833
  */
1797
- "onValueChanged"?: (event: VertexSearchBarCustomEvent<void>) => void;
1834
+ "onSearchChanged"?: (event: VertexSearchBarCustomEvent<string>) => void;
1798
1835
  /**
1799
- * Placeholder for text input.
1836
+ * A placeholder to display when no text has been entered.
1800
1837
  */
1801
1838
  "placeholder"?: string;
1839
+ /**
1840
+ * The placement of the result list for this search bar. Corresponds to the value for the underlying <vertex-popover> placement value.
1841
+ * @see (PopoverPlacement)
1842
+ */
1802
1843
  "placement"?: PopoverPlacement;
1803
- "resultItems"?: Result1[];
1844
+ /**
1845
+ * The URI type of the values to replace. When `replacements` are evaluated, this value will be used as the scheme portion of the URI to detect matches. Defaults to `user`, and will match URIs composed with the `user` scheme and a UUID. E.g. `user:00000000-0000-0000-0000-000000000000`
1846
+ */
1847
+ "replacementUriType"?: string;
1848
+ /**
1849
+ * Replaced result values. This will be used in combination with the value of `value` to display existing replaced values. This value will be automatically updated as `Result`s are clicked within this search bar's `<vertex-result-list>`.
1850
+ */
1851
+ "replacements"?: Result[];
1852
+ /**
1853
+ * The items to display in this search bar's `<vertex-result-list>`. This can be used alongside the `searchChanged` event to query for results to display.
1854
+ */
1855
+ "resultItems"?: Result[];
1856
+ /**
1857
+ * The character indicating that we should trigger a search. When this character is encountered, the text following it (omitting `breakCharacters`) will be emitted as a `searchChanged` event.
1858
+ */
1804
1859
  "triggerCharacter"?: string;
1805
- "triggerCharacters"?: string[];
1860
+ /**
1861
+ * The initial value of this search bar. This will be used in combination with the value of `replacements` to display existing replaced values.
1862
+ */
1863
+ "value"?: string;
1864
+ /**
1865
+ * The search bar variant to display. Possible options are: - 'standard' (default) - 'filled' - 'underlined' - 'blank
1866
+ */
1806
1867
  "variant"?: SearchBarVariant;
1807
1868
  }
1808
1869
  interface VertexSelect {
@@ -41,6 +41,7 @@ export declare enum IconNames {
41
41
  'comment-reopen' = "comment-reopen",
42
42
  'comment-resolve' = "comment-resolve",
43
43
  'comment-show' = "comment-show",
44
+ 'compare' = "compare",
44
45
  'copy' = "copy",
45
46
  'cross-section' = "cross-section",
46
47
  'cube-orthographic' = "cube-orthographic",
@@ -1,12 +1,19 @@
1
1
  import { Binding } from './binding';
2
2
  import { InstancedTemplate } from './templates';
3
3
  export type ElementFactory = () => InstancedTemplate<HTMLElement>;
4
+ export interface EventHandlerDescriptor {
5
+ type: string;
6
+ handler: (event: any) => void;
7
+ }
8
+ export type EventHandlerFactory = (element: HTMLElement) => EventHandlerDescriptor[];
4
9
  export declare class ElementPool {
5
10
  private container;
6
11
  private elementFactory;
12
+ private eventHandlerFactory?;
7
13
  private readonly elements;
8
14
  private instanceMap;
9
- constructor(container: Element, elementFactory: ElementFactory);
15
+ private handlerMap;
16
+ constructor(container: Element, elementFactory: ElementFactory, eventHandlerFactory?: EventHandlerFactory | undefined);
10
17
  swapHeadToTail(count: number): HTMLElement[];
11
18
  swapTailToHead(count: number): HTMLElement[];
12
19
  updateElements(count: number): HTMLElement[];
@@ -14,5 +21,7 @@ export declare class ElementPool {
14
21
  updateElementFactory(elementFactory: ElementFactory): void;
15
22
  iterateElements(f: (element: HTMLElement, binding: Binding, index: number) => void): void;
16
23
  private createElement;
24
+ private addEventListeners;
17
25
  private deleteElement;
26
+ private removeEventListeners;
18
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertexvis/ui",
3
- "version": "0.1.0-canary.7",
3
+ "version": "0.1.0-canary.9",
4
4
  "description": "The Vertex UI component library.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -84,7 +84,8 @@
84
84
  },
85
85
  "dependencies": {
86
86
  "@floating-ui/dom": "^1.6.5",
87
- "@vertexvis/utils": "^0.21.0"
87
+ "@vertexvis/utils": "^0.21.0",
88
+ "fast-deep-equal": "^3.1.3"
88
89
  },
89
- "gitHead": "db5773075aa75fd34101ce8012e9277912ef95ce"
90
+ "gitHead": "1bc7a1e9527e77b38bd2400d4bbe0266ec358f9d"
90
91
  }