@vertexvis/ui 0.1.0-canary.0 → 0.1.0-canary.10
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.
- package/dist/cjs/badge-d39ac1fc.js +23 -0
- package/dist/cjs/components.cjs.js +1 -1
- package/dist/cjs/{icon-53d62a46.js → icon-2508f168.js} +1 -1
- package/dist/cjs/icon-button-72c19ebc.js +43 -0
- package/dist/cjs/{icon-helper-caf2699e.js → icon-helper-07d63296.js} +12 -0
- package/dist/cjs/index.cjs.js +11 -9
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{popover-d9ec8e10.js → popover-942209b8.js} +23 -1
- package/dist/cjs/{result-list-1e592c3c.js → result-list-241ffe8d.js} +46 -2
- package/dist/cjs/search-bar-91cbcd07.js +421 -0
- package/dist/cjs/{select-0eb7203f.js → select-5f8aecfe.js} +27 -4
- package/dist/cjs/{text-field-0397fb34.js → text-field-bccbde1f.js} +1 -0
- package/dist/cjs/{tooltip-31b596f5.js → tooltip-e9f63631.js} +58 -19
- package/dist/cjs/vertex-badge.cjs.entry.js +11 -0
- package/dist/cjs/vertex-icon-button.cjs.entry.js +2 -2
- package/dist/cjs/vertex-icon.cjs.entry.js +2 -2
- package/dist/cjs/vertex-popover.cjs.entry.js +1 -1
- package/dist/cjs/vertex-result-list.cjs.entry.js +1 -1
- package/dist/cjs/vertex-search-bar.cjs.entry.js +1 -1
- package/dist/cjs/vertex-select.cjs.entry.js +1 -1
- package/dist/cjs/vertex-textfield.cjs.entry.js +1 -1
- package/dist/cjs/vertex-tooltip.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/badge/badge.css +18 -0
- package/dist/collection/components/badge/badge.js +69 -0
- package/dist/collection/components/icon/icon-helper.js +6 -0
- package/dist/collection/components/icon/icon.js +1 -1
- package/dist/collection/components/icon/icons/comment-filled.js +2 -0
- package/dist/collection/components/icon/icons/compare.js +2 -0
- package/dist/collection/components/icon-button/icon-button.css +16 -1
- package/dist/collection/components/icon-button/icon-button.js +2 -2
- package/dist/collection/components/index.js +1 -0
- package/dist/collection/components/menu/menu.js +1 -1
- package/dist/collection/components/popover/popover.js +51 -0
- package/dist/collection/components/result-list/result-list.js +52 -5
- package/dist/collection/components/result-list/types.js +1 -0
- package/dist/collection/components/search-bar/dom.js +12 -0
- package/dist/collection/components/search-bar/lib.js +35 -15
- package/dist/collection/components/search-bar/search-bar.css +0 -16
- package/dist/collection/components/search-bar/search-bar.js +380 -324
- package/dist/collection/components/select/select.css +16 -0
- package/dist/collection/components/select/select.js +49 -2
- package/dist/collection/components/text-field/text-field.js +1 -0
- package/dist/collection/components/tooltip/tooltip.css +2 -0
- package/dist/collection/components/tooltip/tooltip.js +62 -18
- package/dist/collection/types/icon.js +2 -0
- package/dist/collection/util/templates/element-pool.js +19 -1
- package/dist/components/components.css +1 -1
- package/dist/components/components.esm.js +1 -1
- package/dist/components/index.esm.js +1 -1
- package/dist/components/p-09c16263.js +1 -0
- package/dist/components/p-0b1cdc8a.entry.js +1 -0
- package/dist/components/p-0b4406fa.entry.js +1 -0
- package/dist/components/{p-17b97932.js → p-265e2358.js} +1 -1
- package/dist/components/p-29d7697f.js +1 -0
- package/dist/components/p-2a6a8da4.entry.js +1 -0
- package/dist/components/p-406e73da.entry.js +1 -0
- package/dist/components/p-429cea3e.js +1 -0
- package/dist/components/p-43b1b3f9.js +1 -0
- package/dist/components/p-606596de.entry.js +1 -0
- package/dist/components/p-6b862967.js +1 -0
- package/dist/components/p-7cfb3736.entry.js +1 -0
- package/dist/components/p-912f6e24.js +1 -0
- package/dist/components/p-92930f2a.js +1 -0
- package/dist/components/p-c2706288.js +1 -0
- package/dist/components/p-c588db04.entry.js +1 -0
- package/dist/components/p-cfe369bf.entry.js +1 -0
- package/dist/components/p-db34f10c.js +1 -0
- package/dist/components/p-ee496965.entry.js +1 -0
- package/dist/esm/badge-6d27ca92.js +21 -0
- package/dist/esm/components.js +1 -1
- package/dist/esm/{icon-2630793d.js → icon-24b0a152.js} +1 -1
- package/dist/esm/icon-button-a7a40f3d.js +41 -0
- package/dist/esm/{icon-helper-10a99d95.js → icon-helper-3cc82749.js} +12 -0
- package/dist/esm/index.js +10 -9
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{popover-67c88e4b.js → popover-6e806354.js} +23 -1
- package/dist/esm/{result-list-36cfb08a.js → result-list-16c6afbd.js} +46 -2
- package/dist/esm/search-bar-f12a3599.js +419 -0
- package/dist/esm/{select-75ed5653.js → select-d4e135b7.js} +27 -4
- package/dist/esm/{text-field-e542da25.js → text-field-32ac877e.js} +1 -0
- package/dist/esm/{tooltip-14b65fb5.js → tooltip-933da261.js} +58 -19
- package/dist/esm/vertex-badge.entry.js +3 -0
- package/dist/esm/vertex-icon-button.entry.js +2 -2
- package/dist/esm/vertex-icon.entry.js +2 -2
- package/dist/esm/vertex-popover.entry.js +1 -1
- package/dist/esm/vertex-result-list.entry.js +1 -1
- package/dist/esm/vertex-search-bar.entry.js +1 -1
- package/dist/esm/vertex-select.entry.js +1 -1
- package/dist/esm/vertex-textfield.entry.js +1 -1
- package/dist/esm/vertex-tooltip.entry.js +1 -1
- package/dist/types/components/badge/badge.d.ts +14 -0
- package/dist/types/components/icon/icons/comment-filled.d.ts +3 -0
- package/dist/types/components/icon/icons/compare.d.ts +3 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/popover/popover.d.ts +7 -0
- package/dist/types/components/result-list/result-list.d.ts +6 -1
- package/dist/types/components/result-list/types.d.ts +4 -0
- package/dist/types/components/search-bar/dom.d.ts +3 -0
- package/dist/types/components/search-bar/lib.d.ts +24 -6
- package/dist/types/components/search-bar/search-bar.d.ts +124 -42
- package/dist/types/components/select/select.d.ts +8 -0
- package/dist/types/components/tooltip/tooltip.d.ts +7 -0
- package/dist/types/components.d.ts +122 -20
- package/dist/types/types/icon.d.ts +2 -0
- package/dist/types/util/templates/element-pool.d.ts +10 -1
- package/package.json +4 -3
- package/dist/cjs/icon-button-f868bf06.js +0 -43
- package/dist/cjs/search-bar-bb40cfa7.js +0 -290
- package/dist/components/p-19318fee.entry.js +0 -1
- package/dist/components/p-209db2ba.entry.js +0 -1
- package/dist/components/p-4224c2ad.js +0 -1
- package/dist/components/p-45cfd66e.entry.js +0 -1
- package/dist/components/p-52739247.js +0 -1
- package/dist/components/p-552c128f.js +0 -1
- package/dist/components/p-6505cdb3.js +0 -1
- package/dist/components/p-79fd6fb6.entry.js +0 -1
- package/dist/components/p-94168b92.js +0 -1
- package/dist/components/p-ae6a3c46.entry.js +0 -1
- package/dist/components/p-bd11e7d1.js +0 -1
- package/dist/components/p-da0a7b57.js +0 -1
- package/dist/components/p-e576818b.entry.js +0 -1
- package/dist/components/p-ebabee40.entry.js +0 -1
- package/dist/components/p-ee8b96b2.js +0 -1
- package/dist/components/p-f900d0f4.entry.js +0 -1
- package/dist/esm/icon-button-25edf617.js +0 -41
- package/dist/esm/search-bar-59cc151d.js +0 -288
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
8
|
import { AvatarVariant } from "./components/avatar/avatar";
|
|
9
|
+
import { BadgeIconColor } from "./components/badge/badge";
|
|
9
10
|
import { ButtonColor, ButtonExpand, ButtonSize, ButtonType, ButtonVariant } from "./components/button/button";
|
|
10
11
|
import { CardMode } from "./components/card/card";
|
|
11
12
|
import { ChipColor, ChipVariant } from "./components/chip/chip";
|
|
@@ -20,9 +21,8 @@ import { PopoverPlacement as PopoverPlacement1, PopoverResizeBehavior } from "./
|
|
|
20
21
|
import { DetectOverflowOptions, FlipOptions, OffsetOptions } from "@floating-ui/dom";
|
|
21
22
|
import { RadioChangeEventDetail } from "./components/radio/radio";
|
|
22
23
|
import { HorizontalDragDirection, ResizableBoundsUpdate, ResizeEventDetails, VerticalDragDirection } from "./components/resizable/resizable";
|
|
23
|
-
import { Result } from "./components/result-list/
|
|
24
|
+
import { Result } from "./components/result-list/types";
|
|
24
25
|
import { SearchBarVariant } from "./components/search-bar/search-bar";
|
|
25
|
-
import { Result as Result1 } from "./components/result-list/result-list";
|
|
26
26
|
import { LabelDisplay, SliderChangeEventDetails, SliderSize } from "./components/slider/slider";
|
|
27
27
|
import { SpinnerColor, SpinnerSize } from "./components/spinner/spinner";
|
|
28
28
|
import { InputChangeEventDetail as InputChangeEventDetail1, TextFieldAutocomplete, TextFieldType, TextFieldVariant, TextSize as TextSize1 } from "./components/text-field/text-field";
|
|
@@ -71,6 +71,16 @@ export namespace Components {
|
|
|
71
71
|
}
|
|
72
72
|
interface VertexAvatarGroup {
|
|
73
73
|
}
|
|
74
|
+
interface VertexBadge {
|
|
75
|
+
/**
|
|
76
|
+
* The color of the badge displayed in this <vertex-badge>. Can be "primary" or "secondary", and defaults to "primary."
|
|
77
|
+
*/
|
|
78
|
+
"badgeColor": BadgeIconColor;
|
|
79
|
+
/**
|
|
80
|
+
* The string to show in the badge.
|
|
81
|
+
*/
|
|
82
|
+
"badgeText"?: string;
|
|
83
|
+
}
|
|
74
84
|
interface VertexButton {
|
|
75
85
|
/**
|
|
76
86
|
* The color of this <vertex-button>. Can be "primary", "secondary", or "danger" and defaults to "secondary".
|
|
@@ -459,6 +469,9 @@ export namespace Components {
|
|
|
459
469
|
* The behavior that this popover will have when the window is resized. Can be either 'dynamic' or 'fixed', and defaults to 'dynamic'. 'dynamic' will cause a position-based popover to adjust its position relative to the window resize to keep it in the same relative position. 'fixed' will keep the popover in the same position even if that means it would disappear off-screen.
|
|
460
470
|
*/
|
|
461
471
|
"resizeBehavior": PopoverResizeBehavior;
|
|
472
|
+
"resizeObserverFactory": (
|
|
473
|
+
cb: (entries: ResizeObserverEntry[]) => void
|
|
474
|
+
) => ResizeObserver;
|
|
462
475
|
/**
|
|
463
476
|
* Indicates if the position of the popover should be updated when the popover's content size changes.
|
|
464
477
|
*/
|
|
@@ -558,18 +571,46 @@ export namespace Components {
|
|
|
558
571
|
"viewportStartIndex": number;
|
|
559
572
|
}
|
|
560
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
|
+
*/
|
|
561
577
|
"breakCharacters": string[];
|
|
562
|
-
"debounce": number;
|
|
563
|
-
"getEditableContent": () => Promise<NodeListOf<ChildNode> | undefined>;
|
|
564
578
|
/**
|
|
565
|
-
*
|
|
579
|
+
* Whether this search bar is disabled.
|
|
580
|
+
*/
|
|
581
|
+
"disabled": boolean;
|
|
582
|
+
/**
|
|
583
|
+
* A placeholder to display when no text has been entered.
|
|
566
584
|
*/
|
|
567
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
|
+
*/
|
|
568
590
|
"placement": PopoverPlacement;
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
"
|
|
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
|
+
*/
|
|
573
614
|
"variant": SearchBarVariant;
|
|
574
615
|
}
|
|
575
616
|
interface VertexSelect {
|
|
@@ -581,6 +622,10 @@ export namespace Components {
|
|
|
581
622
|
* Whether this select is disabled.
|
|
582
623
|
*/
|
|
583
624
|
"disabled": boolean;
|
|
625
|
+
/**
|
|
626
|
+
* Whether this select will omit the currently selected value in the dropdown list.
|
|
627
|
+
*/
|
|
628
|
+
"hideSelected": boolean;
|
|
584
629
|
/**
|
|
585
630
|
* A placeholder to use when no option has been selected. Defaults to "Select an option...".
|
|
586
631
|
*/
|
|
@@ -869,6 +914,12 @@ declare global {
|
|
|
869
914
|
prototype: HTMLVertexAvatarGroupElement;
|
|
870
915
|
new (): HTMLVertexAvatarGroupElement;
|
|
871
916
|
};
|
|
917
|
+
interface HTMLVertexBadgeElement extends Components.VertexBadge, HTMLStencilElement {
|
|
918
|
+
}
|
|
919
|
+
var HTMLVertexBadgeElement: {
|
|
920
|
+
prototype: HTMLVertexBadgeElement;
|
|
921
|
+
new (): HTMLVertexBadgeElement;
|
|
922
|
+
};
|
|
872
923
|
interface HTMLVertexButtonElement extends Components.VertexButton, HTMLStencilElement {
|
|
873
924
|
}
|
|
874
925
|
var HTMLVertexButtonElement: {
|
|
@@ -1077,6 +1128,7 @@ declare global {
|
|
|
1077
1128
|
"vertex-auto-resize-textarea": HTMLVertexAutoResizeTextareaElement;
|
|
1078
1129
|
"vertex-avatar": HTMLVertexAvatarElement;
|
|
1079
1130
|
"vertex-avatar-group": HTMLVertexAvatarGroupElement;
|
|
1131
|
+
"vertex-badge": HTMLVertexBadgeElement;
|
|
1080
1132
|
"vertex-button": HTMLVertexButtonElement;
|
|
1081
1133
|
"vertex-card": HTMLVertexCardElement;
|
|
1082
1134
|
"vertex-card-group": HTMLVertexCardGroupElement;
|
|
@@ -1156,6 +1208,16 @@ declare namespace LocalJSX {
|
|
|
1156
1208
|
}
|
|
1157
1209
|
interface VertexAvatarGroup {
|
|
1158
1210
|
}
|
|
1211
|
+
interface VertexBadge {
|
|
1212
|
+
/**
|
|
1213
|
+
* The color of the badge displayed in this <vertex-badge>. Can be "primary" or "secondary", and defaults to "primary."
|
|
1214
|
+
*/
|
|
1215
|
+
"badgeColor"?: BadgeIconColor;
|
|
1216
|
+
/**
|
|
1217
|
+
* The string to show in the badge.
|
|
1218
|
+
*/
|
|
1219
|
+
"badgeText"?: string;
|
|
1220
|
+
}
|
|
1159
1221
|
interface VertexButton {
|
|
1160
1222
|
/**
|
|
1161
1223
|
* The color of this <vertex-button>. Can be "primary", "secondary", or "danger" and defaults to "secondary".
|
|
@@ -1732,6 +1794,7 @@ declare namespace LocalJSX {
|
|
|
1732
1794
|
"items"?: Result[];
|
|
1733
1795
|
"itemsJson"?: string;
|
|
1734
1796
|
"onEnterPressed"?: (event: VertexResultListCustomEvent<Result>) => void;
|
|
1797
|
+
"onResultClick"?: (event: VertexResultListCustomEvent<Result>) => void;
|
|
1735
1798
|
"open"?: boolean;
|
|
1736
1799
|
"overScanCount"?: number;
|
|
1737
1800
|
"placement"?: PopoverPlacement;
|
|
@@ -1741,33 +1804,66 @@ declare namespace LocalJSX {
|
|
|
1741
1804
|
"viewportStartIndex"?: number;
|
|
1742
1805
|
}
|
|
1743
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
|
+
*/
|
|
1744
1810
|
"breakCharacters"?: string[];
|
|
1745
|
-
"debounce"?: number;
|
|
1746
1811
|
/**
|
|
1747
|
-
*
|
|
1812
|
+
* Whether this search bar is disabled.
|
|
1813
|
+
*/
|
|
1814
|
+
"disabled"?: boolean;
|
|
1815
|
+
/**
|
|
1816
|
+
* Emitted when the input is blurred.
|
|
1748
1817
|
*/
|
|
1749
1818
|
"onInputBlur"?: (event: VertexSearchBarCustomEvent<FocusEvent>) => void;
|
|
1750
1819
|
/**
|
|
1751
|
-
* Emitted when input
|
|
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.
|
|
1752
1825
|
*/
|
|
1753
1826
|
"onInputFocus"?: (event: VertexSearchBarCustomEvent<FocusEvent>) => void;
|
|
1754
1827
|
/**
|
|
1755
|
-
* Emitted when
|
|
1828
|
+
* Emitted when a result has been selected to replace the trigger text. Includes the ID of the `Result` selected.
|
|
1756
1829
|
*/
|
|
1757
|
-
"
|
|
1758
|
-
"onTriggerCharacterPressed"?: (event: VertexSearchBarCustomEvent<string>) => void;
|
|
1830
|
+
"onResultReplaced"?: (event: VertexSearchBarCustomEvent<Result>) => void;
|
|
1759
1831
|
/**
|
|
1760
|
-
* Emitted when the value has changed.
|
|
1832
|
+
* Emitted when the value of the current search triggered by the specified `triggerCharacter` has changed.
|
|
1761
1833
|
*/
|
|
1762
|
-
"
|
|
1834
|
+
"onSearchChanged"?: (event: VertexSearchBarCustomEvent<string>) => void;
|
|
1763
1835
|
/**
|
|
1764
|
-
*
|
|
1836
|
+
* A placeholder to display when no text has been entered.
|
|
1765
1837
|
*/
|
|
1766
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
|
+
*/
|
|
1767
1843
|
"placement"?: PopoverPlacement;
|
|
1768
|
-
|
|
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
|
+
*/
|
|
1769
1859
|
"triggerCharacter"?: string;
|
|
1770
|
-
|
|
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
|
+
*/
|
|
1771
1867
|
"variant"?: SearchBarVariant;
|
|
1772
1868
|
}
|
|
1773
1869
|
interface VertexSelect {
|
|
@@ -1779,6 +1875,10 @@ declare namespace LocalJSX {
|
|
|
1779
1875
|
* Whether this select is disabled.
|
|
1780
1876
|
*/
|
|
1781
1877
|
"disabled"?: boolean;
|
|
1878
|
+
/**
|
|
1879
|
+
* Whether this select will omit the currently selected value in the dropdown list.
|
|
1880
|
+
*/
|
|
1881
|
+
"hideSelected"?: boolean;
|
|
1782
1882
|
/**
|
|
1783
1883
|
* Emitted when the selected option of this element changes, and contains the value that it has been changed to.
|
|
1784
1884
|
*/
|
|
@@ -1987,6 +2087,7 @@ declare namespace LocalJSX {
|
|
|
1987
2087
|
"vertex-auto-resize-textarea": VertexAutoResizeTextarea;
|
|
1988
2088
|
"vertex-avatar": VertexAvatar;
|
|
1989
2089
|
"vertex-avatar-group": VertexAvatarGroup;
|
|
2090
|
+
"vertex-badge": VertexBadge;
|
|
1990
2091
|
"vertex-button": VertexButton;
|
|
1991
2092
|
"vertex-card": VertexCard;
|
|
1992
2093
|
"vertex-card-group": VertexCardGroup;
|
|
@@ -2030,6 +2131,7 @@ declare module "@stencil/core" {
|
|
|
2030
2131
|
"vertex-auto-resize-textarea": LocalJSX.VertexAutoResizeTextarea & JSXBase.HTMLAttributes<HTMLVertexAutoResizeTextareaElement>;
|
|
2031
2132
|
"vertex-avatar": LocalJSX.VertexAvatar & JSXBase.HTMLAttributes<HTMLVertexAvatarElement>;
|
|
2032
2133
|
"vertex-avatar-group": LocalJSX.VertexAvatarGroup & JSXBase.HTMLAttributes<HTMLVertexAvatarGroupElement>;
|
|
2134
|
+
"vertex-badge": LocalJSX.VertexBadge & JSXBase.HTMLAttributes<HTMLVertexBadgeElement>;
|
|
2033
2135
|
"vertex-button": LocalJSX.VertexButton & JSXBase.HTMLAttributes<HTMLVertexButtonElement>;
|
|
2034
2136
|
"vertex-card": LocalJSX.VertexCard & JSXBase.HTMLAttributes<HTMLVertexCardElement>;
|
|
2035
2137
|
"vertex-card-group": LocalJSX.VertexCardGroup & JSXBase.HTMLAttributes<HTMLVertexCardGroupElement>;
|
|
@@ -37,9 +37,11 @@ export declare enum IconNames {
|
|
|
37
37
|
'collapse-all' = "collapse-all",
|
|
38
38
|
'columns' = "columns",
|
|
39
39
|
'comment-add' = "comment-add",
|
|
40
|
+
'comment-filled' = "comment-filled",
|
|
40
41
|
'comment-reopen' = "comment-reopen",
|
|
41
42
|
'comment-resolve' = "comment-resolve",
|
|
42
43
|
'comment-show' = "comment-show",
|
|
44
|
+
'compare' = "compare",
|
|
43
45
|
'copy' = "copy",
|
|
44
46
|
'cross-section' = "cross-section",
|
|
45
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
|
-
|
|
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.
|
|
3
|
+
"version": "0.1.0-canary.10",
|
|
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": "
|
|
90
|
+
"gitHead": "425fd19e4df5cbda08164fc5028a5dbfd9f080cf"
|
|
90
91
|
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const index = require('./index-6a92256c.js');
|
|
4
|
-
const index$1 = require('./index-e1b40fa6.js');
|
|
5
|
-
const iconHelper = require('./icon-helper-caf2699e.js');
|
|
6
|
-
|
|
7
|
-
const iconButtonCss = "button{border:none;background-color:transparent;font-family:var(--vertex-ui-font-family);font-size:0.875rem;padding:0}:host{--enabled-cursor:pointer;--disabled-cursor:not-allowed;--hover-background-color:var(--vertex-ui-neutral-300);--active-background-color:var(--vertex-ui-neutral-400);--focus-background-color:var(--vertex-ui-neutral-400);--hover-box-shadow:0 2px 2px rgb(0 0 0 / 20%);--active-box-shadow:none;--focus-box-shadow:0 0 0 1px var(--vertex-ui-neutral-900)}.container{display:flex;justify-content:center;align-items:center;outline:none;fill:currentColor;color:currentColor;cursor:var(--enabled-cursor)}.container:not(.plain){border-radius:4px;padding:0.25rem}.icon-button{display:flex;justify-content:center;align-items:center;fill:currentColor;height:var(--icon-size, 1.5rem);width:var(--icon-size, 1.5rem)}.icon-button svg{width:100%;height:100%}.floating{background-color:var(--vertex-ui-neutral-100);box-shadow:var(--vertex-ui-overlay-shadow);color:var(--vertex-ui-neutral-700);fill:var(--vertex-ui-neutral-700);opacity:0.95}.floating.disabled{color:var(--vertex-ui-neutral-400);cursor:var(--disabled-cursor)}.container:not(.disabled):not(.plain):hover{background-color:var(--hover-background-color);box-shadow:var(--hover-box-shadow)}.container:not(.disabled):not(.plain):active{background-color:var(--active-background-color);box-shadow:var(--active-box-shadow)}.container:not(.disabled):not(.plain):focus-visible{background-color:var(--focus-background-color);box-shadow:var(--focus-box-shadow);color:var(--vertex-ui-neutral-900)}.container.disabled:not(.floating){cursor:var(--disabled-cursor);color:var(--vertex-ui-neutral-400)}.container.primary:not(.disabled){color:var(--vertex-ui-blue-700)}.container.secondary:not(.disabled){color:var(--vertex-ui-neutral-800)}.xs{height:var(--icon-size, 0.75rem);width:var(--icon-size, 0.75rem)}.sm{height:var(--icon-size, 1rem);width:var(--icon-size, 1rem)}.md{height:var(--icon-size, 1.5rem);width:var(--icon-size, 1.5rem)}.lg{height:var(--icon-size, 2rem);width:var(--icon-size, 2rem)}";
|
|
8
|
-
|
|
9
|
-
const IconButton = class {
|
|
10
|
-
constructor(hostRef) {
|
|
11
|
-
index.registerInstance(this, hostRef);
|
|
12
|
-
this.iconName = undefined;
|
|
13
|
-
this.disabled = undefined;
|
|
14
|
-
this.variant = 'default';
|
|
15
|
-
this.iconColor = 'default';
|
|
16
|
-
this.iconSize = 'md';
|
|
17
|
-
}
|
|
18
|
-
render() {
|
|
19
|
-
return (index.h(index.Host, { onClick: (e) => this.handleClick(e) }, index.h("button", { ref: (el) => (this.buttonEl = el), disabled: this.disabled, class: index$1.classnames('container', {
|
|
20
|
-
disabled: this.disabled,
|
|
21
|
-
floating: this.variant === 'floating',
|
|
22
|
-
plain: this.variant === 'plain',
|
|
23
|
-
primary: this.iconColor === 'primary',
|
|
24
|
-
secondary: this.iconColor === 'secondary',
|
|
25
|
-
}) }, index.h("slot", { name: "left" }), index.h("div", { class: index$1.classnames('icon-button', {
|
|
26
|
-
xs: this.iconSize === 'xs',
|
|
27
|
-
sm: this.iconSize === 'sm',
|
|
28
|
-
md: this.iconSize === 'md',
|
|
29
|
-
lg: this.iconSize === 'lg',
|
|
30
|
-
}) }, iconHelper.getSvg(this.iconName)), index.h("slot", null))));
|
|
31
|
-
}
|
|
32
|
-
handleClick(event) {
|
|
33
|
-
var _a;
|
|
34
|
-
if (this.disabled) {
|
|
35
|
-
event.preventDefault();
|
|
36
|
-
event.stopPropagation();
|
|
37
|
-
}
|
|
38
|
-
(_a = this.buttonEl) === null || _a === void 0 ? void 0 : _a.blur();
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
IconButton.style = iconButtonCss;
|
|
42
|
-
|
|
43
|
-
exports.IconButton = IconButton;
|
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const index = require('./index-6a92256c.js');
|
|
4
|
-
const index$1 = require('./index-e1b40fa6.js');
|
|
5
|
-
const templates = require('./templates-e7b3ffbb.js');
|
|
6
|
-
|
|
7
|
-
const getWindowSelection = () => {
|
|
8
|
-
if (typeof window !== 'undefined') {
|
|
9
|
-
return window.getSelection();
|
|
10
|
-
}
|
|
11
|
-
return undefined;
|
|
12
|
-
};
|
|
13
|
-
const createDocumentRange = () => {
|
|
14
|
-
return document.createRange();
|
|
15
|
-
};
|
|
16
|
-
const isTextNode = (node) => {
|
|
17
|
-
return node instanceof Text;
|
|
18
|
-
};
|
|
19
|
-
const isHtmlElement = (target) => {
|
|
20
|
-
return target instanceof HTMLElement;
|
|
21
|
-
};
|
|
22
|
-
const isReplacedElement = (el) => {
|
|
23
|
-
return (el === null || el === void 0 ? void 0 : el.getAttribute('data-replaced')) === 'true';
|
|
24
|
-
};
|
|
25
|
-
const createTextNode = (text) => {
|
|
26
|
-
return new Text(text != null && text !== '' ? text : ' ');
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const searchBarCss = ".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}.test-mention.sc-vertex-search-bar{display:inline-block;color:blue}.hidden.sc-vertex-search-bar{visibility:hidden}.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}.textarea.sc-vertex-search-bar{overflow:hidden;outline:none;box-shadow:none;resize:none}.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)}";
|
|
30
|
-
|
|
31
|
-
const SearchBar = class {
|
|
32
|
-
constructor(hostRef) {
|
|
33
|
-
index.registerInstance(this, hostRef);
|
|
34
|
-
this.triggerCharacterPressed = index.createEvent(this, "triggerCharacterPressed", 7);
|
|
35
|
-
this.valueChanged = index.createEvent(this, "valueChanged", 7);
|
|
36
|
-
this.inputFocus = index.createEvent(this, "inputFocus", 7);
|
|
37
|
-
this.inputBlur = index.createEvent(this, "inputBlur", 7);
|
|
38
|
-
this.resultsEnterPressed = index.createEvent(this, "resultsEnterPressed", 7);
|
|
39
|
-
this.handleKeyDown = (event) => {
|
|
40
|
-
if ((this.triggerCharacters.includes(event.key) ||
|
|
41
|
-
this.triggerCharacter === event.key) &&
|
|
42
|
-
this.triggerKey == null) {
|
|
43
|
-
this.triggerKey = event.key;
|
|
44
|
-
this.updateCursorPosition();
|
|
45
|
-
this.triggerCharacterPressed.emit('');
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
this.restartTriggerInput();
|
|
49
|
-
}
|
|
50
|
-
if (event.key === 'Backspace') {
|
|
51
|
-
const selection = getWindowSelection();
|
|
52
|
-
if (selection && (selection === null || selection === void 0 ? void 0 : selection.rangeCount) > 0) {
|
|
53
|
-
const range = selection.getRangeAt(0);
|
|
54
|
-
range.deleteContents();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
this.valueChanged.emit();
|
|
58
|
-
};
|
|
59
|
-
this.handleKeyUp = (event) => {
|
|
60
|
-
if (event.key === 'Backspace') {
|
|
61
|
-
this.updateTriggerState(this.getSelectionSubstring());
|
|
62
|
-
}
|
|
63
|
-
if (event.key === 'Enter') {
|
|
64
|
-
this.clearTriggerState();
|
|
65
|
-
}
|
|
66
|
-
this.valueChanged.emit();
|
|
67
|
-
};
|
|
68
|
-
this.updateTriggerValue = (data) => {
|
|
69
|
-
var _a, _b, _c, _d, _e;
|
|
70
|
-
if (this.triggerKey != null &&
|
|
71
|
-
this.triggerRange != null &&
|
|
72
|
-
this.triggerRange.startContainer === this.triggerRange.endContainer) {
|
|
73
|
-
const triggerRangeNode = this.triggerRange.startContainer;
|
|
74
|
-
if (isTextNode(triggerRangeNode)) {
|
|
75
|
-
const before = createTextNode((_a = triggerRangeNode.textContent) === null || _a === void 0 ? void 0 : _a.slice(0, this.triggerRange.startOffset - 1));
|
|
76
|
-
const after = createTextNode((_b = triggerRangeNode.textContent) === null || _b === void 0 ? void 0 : _b.slice(this.triggerRange.endOffset));
|
|
77
|
-
const replaced = this.createReplacedElement(data);
|
|
78
|
-
(_c = triggerRangeNode.parentElement) === null || _c === void 0 ? void 0 : _c.insertBefore(before, triggerRangeNode);
|
|
79
|
-
(_d = triggerRangeNode.parentElement) === null || _d === void 0 ? void 0 : _d.insertBefore(after, triggerRangeNode.nextSibling);
|
|
80
|
-
(_e = triggerRangeNode.parentElement) === null || _e === void 0 ? void 0 : _e.insertBefore(replaced, after);
|
|
81
|
-
triggerRangeNode.remove();
|
|
82
|
-
this.moveCursorToNodeEnd(after, true);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
this.triggerText = () => {
|
|
87
|
-
var _a, _b;
|
|
88
|
-
if (this.triggerKey != null &&
|
|
89
|
-
this.triggerRange != null &&
|
|
90
|
-
this.triggerRange.startContainer === this.triggerRange.endContainer) {
|
|
91
|
-
const triggerRangeNode = this.triggerRange.startContainer;
|
|
92
|
-
return ((_b = (_a = triggerRangeNode.textContent) === null || _a === void 0 ? void 0 : _a.slice(this.triggerRange.startOffset, this.triggerRange.endOffset)) !== null && _b !== void 0 ? _b : '');
|
|
93
|
-
}
|
|
94
|
-
return '';
|
|
95
|
-
};
|
|
96
|
-
this.restartTriggerInput = () => {
|
|
97
|
-
this.clearTriggerTimeout();
|
|
98
|
-
this.triggerTimeout = setTimeout(() => {
|
|
99
|
-
if (this.triggerRange != null && this.triggerKey != null) {
|
|
100
|
-
this.triggerCharacterPressed.emit(this.triggerText());
|
|
101
|
-
}
|
|
102
|
-
this.triggerTimeout = undefined;
|
|
103
|
-
}, this.debounce);
|
|
104
|
-
};
|
|
105
|
-
this.clearTriggerTimeout = () => {
|
|
106
|
-
if (this.triggerTimeout != null) {
|
|
107
|
-
clearTimeout(this.triggerTimeout);
|
|
108
|
-
this.triggerTimeout = undefined;
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
this.updateCursorPosition = () => {
|
|
112
|
-
var _a;
|
|
113
|
-
const selection = getWindowSelection();
|
|
114
|
-
if (selection != null && selection.rangeCount > 0) {
|
|
115
|
-
const cursorBounds = selection.getRangeAt(0).getBoundingClientRect();
|
|
116
|
-
const inputBounds = (_a = this.contentEl) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
117
|
-
const cursorBottom = cursorBounds.bottom || (inputBounds === null || inputBounds === void 0 ? void 0 : inputBounds.bottom) || 0;
|
|
118
|
-
const cursorTop = cursorBounds.top || (inputBounds === null || inputBounds === void 0 ? void 0 : inputBounds.top) || 0;
|
|
119
|
-
this.cursorPosition = {
|
|
120
|
-
x: cursorBounds.left || (inputBounds === null || inputBounds === void 0 ? void 0 : inputBounds.left) || 0,
|
|
121
|
-
y: this.placement.includes('top') ? cursorTop : cursorBottom,
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
this.moveCursorToNodeEnd = (node, collapseToStart = false) => {
|
|
126
|
-
const selection = getWindowSelection();
|
|
127
|
-
if (selection != null) {
|
|
128
|
-
const range = createDocumentRange();
|
|
129
|
-
range.selectNodeContents(node);
|
|
130
|
-
range.collapse(collapseToStart);
|
|
131
|
-
selection.removeAllRanges();
|
|
132
|
-
selection.addRange(range);
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
this.updateInputCursorPosition = (target) => {
|
|
136
|
-
if (isHtmlElement(target)) {
|
|
137
|
-
const targetElement = isReplacedElement(target.parentElement)
|
|
138
|
-
? target.parentElement
|
|
139
|
-
: target;
|
|
140
|
-
if (isReplacedElement(targetElement)) {
|
|
141
|
-
this.insertAdjacentTextNode(targetElement);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
this.createReplacedElement = (data) => {
|
|
146
|
-
const template = this.hostEl.querySelector('template[slot="replaced"]');
|
|
147
|
-
if (template != null) {
|
|
148
|
-
const instance = templates.generateInstanceFromTemplate(template);
|
|
149
|
-
instance.bindings.bind(data);
|
|
150
|
-
instance.element.style.display = 'inline-block';
|
|
151
|
-
instance.element.contentEditable = 'false';
|
|
152
|
-
instance.element.setAttribute('data-replaced', 'true');
|
|
153
|
-
return instance.element;
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
throw new Error('Replaced template not defined.');
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
this.handleSelectionChange = () => {
|
|
160
|
-
this.updateTriggerState(this.getSelectionSubstring());
|
|
161
|
-
};
|
|
162
|
-
this.getSelectionSubstring = () => {
|
|
163
|
-
var _a;
|
|
164
|
-
const selection = getWindowSelection();
|
|
165
|
-
if (selection != null && selection.rangeCount > 0) {
|
|
166
|
-
const range = selection.getRangeAt(0);
|
|
167
|
-
this.updateTriggerRange();
|
|
168
|
-
if (range != null &&
|
|
169
|
-
range.startOffset === range.endOffset &&
|
|
170
|
-
isTextNode(range.startContainer) &&
|
|
171
|
-
range.startContainer.textContent != null &&
|
|
172
|
-
!isReplacedElement(range.startContainer.parentElement) &&
|
|
173
|
-
((_a = this.contentEl) === null || _a === void 0 ? void 0 : _a.contains(range.startContainer))) {
|
|
174
|
-
return range.startContainer.textContent.slice(this.lastIndexOfBreakCharacter(range.startContainer.textContent.slice(0, range.startOffset)) + 1, range.startOffset);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return '';
|
|
178
|
-
};
|
|
179
|
-
this.insertAdjacentTextNode = (el) => {
|
|
180
|
-
el.insertAdjacentText('afterend', '');
|
|
181
|
-
if (el.nextSibling != null) {
|
|
182
|
-
this.moveCursorToNodeEnd(el.nextSibling);
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
this.updateTriggerState = (text) => {
|
|
186
|
-
const triggers = this.triggerCharacter != null
|
|
187
|
-
? [...this.triggerCharacters, this.triggerCharacter]
|
|
188
|
-
: this.triggerCharacters;
|
|
189
|
-
const trigger = triggers.find((tc) => text.includes(tc));
|
|
190
|
-
if (trigger != null) {
|
|
191
|
-
this.restartTriggerInput();
|
|
192
|
-
this.triggerKey = trigger;
|
|
193
|
-
this.updateTriggerRange();
|
|
194
|
-
if (this.cursorPosition == null) {
|
|
195
|
-
this.updateCursorPosition();
|
|
196
|
-
}
|
|
197
|
-
this.open = true;
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
this.clearTriggerState();
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
this.updateTriggerRange = () => {
|
|
204
|
-
var _a;
|
|
205
|
-
const selection = getWindowSelection();
|
|
206
|
-
if (selection != null && selection.rangeCount > 0) {
|
|
207
|
-
const range = selection.getRangeAt(0);
|
|
208
|
-
if (this.triggerKey != null) {
|
|
209
|
-
this.triggerRange = (_a = this.triggerRange) !== null && _a !== void 0 ? _a : range.cloneRange();
|
|
210
|
-
this.triggerRange.setEnd(range.endContainer, range.endOffset);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
this.clearTriggerState = () => {
|
|
215
|
-
this.triggerKey = undefined;
|
|
216
|
-
this.triggerRange = undefined;
|
|
217
|
-
this.cursorPosition = undefined;
|
|
218
|
-
this.open = false;
|
|
219
|
-
this.clearTriggerTimeout();
|
|
220
|
-
};
|
|
221
|
-
this.lastIndexOfBreakCharacter = (search) => {
|
|
222
|
-
const index = this.breakCharacters.reduce((index, bc) => {
|
|
223
|
-
const searchIndex = search
|
|
224
|
-
.replace(String.fromCharCode(160), ' ')
|
|
225
|
-
.lastIndexOf(bc);
|
|
226
|
-
return searchIndex > index ? searchIndex : index;
|
|
227
|
-
}, -1);
|
|
228
|
-
return index;
|
|
229
|
-
};
|
|
230
|
-
this.handleFocus = (ev) => {
|
|
231
|
-
this.inputFocus.emit(ev);
|
|
232
|
-
};
|
|
233
|
-
this.handleBlur = (ev) => {
|
|
234
|
-
this.open = false;
|
|
235
|
-
this.inputBlur.emit(ev);
|
|
236
|
-
};
|
|
237
|
-
this.handleInputPointerEvent = (ev) => {
|
|
238
|
-
if (ev.target != null) {
|
|
239
|
-
this.updateInputCursorPosition(ev.target);
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
this.handleResultPointerDown = (ev) => {
|
|
243
|
-
ev.preventDefault();
|
|
244
|
-
};
|
|
245
|
-
this.variant = 'standard';
|
|
246
|
-
this.resultItems = undefined;
|
|
247
|
-
this.triggerCharacters = [];
|
|
248
|
-
this.triggerCharacter = undefined;
|
|
249
|
-
this.breakCharacters = [' '];
|
|
250
|
-
this.debounce = 100;
|
|
251
|
-
this.placeholder = undefined;
|
|
252
|
-
this.placement = 'bottom-start';
|
|
253
|
-
this.cursorPosition = undefined;
|
|
254
|
-
this.open = false;
|
|
255
|
-
this.triggerKey = undefined;
|
|
256
|
-
this.triggerRange = undefined;
|
|
257
|
-
}
|
|
258
|
-
componentWillLoad() {
|
|
259
|
-
document.addEventListener('selectionchange', this.handleSelectionChange);
|
|
260
|
-
}
|
|
261
|
-
disconnectedCallback() {
|
|
262
|
-
document.removeEventListener('selectionchange', this.handleSelectionChange);
|
|
263
|
-
}
|
|
264
|
-
async replaceTriggeredValue(data) {
|
|
265
|
-
this.updateTriggerValue(data);
|
|
266
|
-
this.clearTriggerState();
|
|
267
|
-
this.valueChanged.emit();
|
|
268
|
-
}
|
|
269
|
-
async getEditableContent() {
|
|
270
|
-
var _a;
|
|
271
|
-
return (_a = this.contentEl) === null || _a === void 0 ? void 0 : _a.childNodes;
|
|
272
|
-
}
|
|
273
|
-
render() {
|
|
274
|
-
var _a;
|
|
275
|
-
const classes = index$1.classnames('wrapper', {
|
|
276
|
-
standard: this.variant === 'standard',
|
|
277
|
-
filled: this.variant === 'filled',
|
|
278
|
-
underlined: this.variant === 'underlined',
|
|
279
|
-
blank: this.variant === 'blank',
|
|
280
|
-
});
|
|
281
|
-
return (index.h(index.Host, null, index.h("div", { class: classes }, index.h("span", { class: "content-input", ref: (ref) => (this.contentEl = ref), role: "textbox", contenteditable: "true", "aria-multiline": "true", "data-placeholder": this.placeholder, onKeyDown: this.handleKeyDown, onKeyUp: this.handleKeyUp, onBlur: this.handleBlur, onFocus: this.handleFocus, onPointerDown: this.handleInputPointerEvent, onPointerUp: this.handleInputPointerEvent })), index.h("vertex-result-list", { position: this.cursorPosition, placement: this.placement, open: this.open &&
|
|
282
|
-
this.resultItems != null &&
|
|
283
|
-
this.resultItems.length > 0 &&
|
|
284
|
-
this.cursorPosition != null, items: (_a = this.resultItems) !== null && _a !== void 0 ? _a : [], onPointerDown: this.handleResultPointerDown, onEnterPressed: (event) => this.resultsEnterPressed.emit(event.detail) }, index.h("slot", { name: "results" })), index.h("slot", { name: "replaced" })));
|
|
285
|
-
}
|
|
286
|
-
get hostEl() { return index.getElement(this); }
|
|
287
|
-
};
|
|
288
|
-
SearchBar.style = searchBarCss;
|
|
289
|
-
|
|
290
|
-
exports.SearchBar = SearchBar;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{R as vertex_result_list}from"./p-52739247.js";import"./p-6834631c.js";import"./p-fe062eb0.js";import"./p-1356f525.js";import"./p-59032668.js";
|