@vertexvis/ui 0.1.0-testing.3 → 0.1.0-testing.5
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-460fd0f5.js} +1 -1
- package/dist/cjs/icon-button-786427d6.js +43 -0
- package/dist/cjs/{icon-helper-caf2699e.js → icon-helper-ba408f49.js} +7 -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-a321b3e1.js +353 -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 +1 -0
- 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 +3 -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-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 +47 -3
- package/dist/collection/components/search-bar/dom.js +12 -0
- package/dist/collection/components/search-bar/lib.js +23 -15
- package/dist/collection/components/search-bar/search-bar.css +2 -29
- package/dist/collection/components/search-bar/search-bar.js +352 -326
- 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 +1 -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-03dbb28c.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-103249b4.js +1 -0
- package/dist/components/p-29d7697f.js +1 -0
- package/dist/components/p-406e73da.entry.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-7dba2574.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-c4518377.entry.js +1 -0
- package/dist/components/{p-17b97932.js → p-ca52a423.js} +1 -1
- package/dist/components/p-ee496965.entry.js +1 -0
- package/dist/components/p-f064f911.js +1 -0
- package/dist/components/p-f71fc166.entry.js +1 -0
- package/dist/esm/badge-6d27ca92.js +21 -0
- package/dist/esm/components.js +1 -1
- package/dist/esm/icon-button-aad3c0e7.js +41 -0
- package/dist/esm/{icon-2630793d.js → icon-d37150b4.js} +1 -1
- package/dist/esm/{icon-helper-10a99d95.js → icon-helper-83f10f73.js} +7 -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-6fad2f2e.js +351 -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/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 +9 -1
- package/dist/types/components/search-bar/dom.d.ts +3 -0
- package/dist/types/components/search-bar/lib.d.ts +12 -6
- package/dist/types/components/search-bar/search-bar.d.ts +98 -41
- 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 +111 -16
- package/dist/types/types/icon.d.ts +1 -0
- package/dist/types/util/templates/element-pool.d.ts +10 -1
- package/package.json +2 -2
- 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";
|
|
@@ -71,6 +72,16 @@ export namespace Components {
|
|
|
71
72
|
}
|
|
72
73
|
interface VertexAvatarGroup {
|
|
73
74
|
}
|
|
75
|
+
interface VertexBadge {
|
|
76
|
+
/**
|
|
77
|
+
* The color of the badge displayed in this <vertex-badge>. Can be "primary" or "secondary", and defaults to "primary."
|
|
78
|
+
*/
|
|
79
|
+
"badgeColor": BadgeIconColor;
|
|
80
|
+
/**
|
|
81
|
+
* The string to show in the badge.
|
|
82
|
+
*/
|
|
83
|
+
"badgeText"?: string;
|
|
84
|
+
}
|
|
74
85
|
interface VertexButton {
|
|
75
86
|
/**
|
|
76
87
|
* The color of this <vertex-button>. Can be "primary", "secondary", or "danger" and defaults to "secondary".
|
|
@@ -459,6 +470,9 @@ export namespace Components {
|
|
|
459
470
|
* 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
471
|
*/
|
|
461
472
|
"resizeBehavior": PopoverResizeBehavior;
|
|
473
|
+
"resizeObserverFactory": (
|
|
474
|
+
cb: (entries: ResizeObserverEntry[]) => void
|
|
475
|
+
) => ResizeObserver;
|
|
462
476
|
/**
|
|
463
477
|
* Indicates if the position of the popover should be updated when the popover's content size changes.
|
|
464
478
|
*/
|
|
@@ -558,18 +572,42 @@ export namespace Components {
|
|
|
558
572
|
"viewportStartIndex": number;
|
|
559
573
|
}
|
|
560
574
|
interface VertexSearchBar {
|
|
575
|
+
/**
|
|
576
|
+
* 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.
|
|
577
|
+
*/
|
|
561
578
|
"breakCharacters": string[];
|
|
562
|
-
"debounce": number;
|
|
563
|
-
"getEditableContent": () => Promise<NodeListOf<ChildNode> | undefined>;
|
|
564
579
|
/**
|
|
565
|
-
*
|
|
580
|
+
* Whether this search bar is disabled.
|
|
581
|
+
*/
|
|
582
|
+
"disabled": boolean;
|
|
583
|
+
/**
|
|
584
|
+
* A placeholder to display when no text has been entered.
|
|
566
585
|
*/
|
|
567
586
|
"placeholder"?: string;
|
|
587
|
+
/**
|
|
588
|
+
* The placement of the result list for this search bar. Corresponds to the value for the underlying <vertex-popover> placement value.
|
|
589
|
+
* @see (PopoverPlacement)
|
|
590
|
+
*/
|
|
568
591
|
"placement": PopoverPlacement;
|
|
569
|
-
|
|
592
|
+
/**
|
|
593
|
+
* 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>`.
|
|
594
|
+
*/
|
|
595
|
+
"replacements": Result1[];
|
|
596
|
+
/**
|
|
597
|
+
* 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.
|
|
598
|
+
*/
|
|
570
599
|
"resultItems"?: Result1[];
|
|
571
|
-
|
|
572
|
-
|
|
600
|
+
/**
|
|
601
|
+
* 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.
|
|
602
|
+
*/
|
|
603
|
+
"triggerCharacter": string;
|
|
604
|
+
/**
|
|
605
|
+
* The initial value of this search bar. This will be used in combination with the value of `replacements` to display existing replaced values.
|
|
606
|
+
*/
|
|
607
|
+
"value"?: string;
|
|
608
|
+
/**
|
|
609
|
+
* The search bar variant to display. Possible options are: - 'standard' (default) - 'filled' - 'underlined' - 'blank
|
|
610
|
+
*/
|
|
573
611
|
"variant": SearchBarVariant;
|
|
574
612
|
}
|
|
575
613
|
interface VertexSelect {
|
|
@@ -581,6 +619,10 @@ export namespace Components {
|
|
|
581
619
|
* Whether this select is disabled.
|
|
582
620
|
*/
|
|
583
621
|
"disabled": boolean;
|
|
622
|
+
/**
|
|
623
|
+
* Whether this select will omit the currently selected value in the dropdown list.
|
|
624
|
+
*/
|
|
625
|
+
"hideSelected": boolean;
|
|
584
626
|
/**
|
|
585
627
|
* A placeholder to use when no option has been selected. Defaults to "Select an option...".
|
|
586
628
|
*/
|
|
@@ -869,6 +911,12 @@ declare global {
|
|
|
869
911
|
prototype: HTMLVertexAvatarGroupElement;
|
|
870
912
|
new (): HTMLVertexAvatarGroupElement;
|
|
871
913
|
};
|
|
914
|
+
interface HTMLVertexBadgeElement extends Components.VertexBadge, HTMLStencilElement {
|
|
915
|
+
}
|
|
916
|
+
var HTMLVertexBadgeElement: {
|
|
917
|
+
prototype: HTMLVertexBadgeElement;
|
|
918
|
+
new (): HTMLVertexBadgeElement;
|
|
919
|
+
};
|
|
872
920
|
interface HTMLVertexButtonElement extends Components.VertexButton, HTMLStencilElement {
|
|
873
921
|
}
|
|
874
922
|
var HTMLVertexButtonElement: {
|
|
@@ -1077,6 +1125,7 @@ declare global {
|
|
|
1077
1125
|
"vertex-auto-resize-textarea": HTMLVertexAutoResizeTextareaElement;
|
|
1078
1126
|
"vertex-avatar": HTMLVertexAvatarElement;
|
|
1079
1127
|
"vertex-avatar-group": HTMLVertexAvatarGroupElement;
|
|
1128
|
+
"vertex-badge": HTMLVertexBadgeElement;
|
|
1080
1129
|
"vertex-button": HTMLVertexButtonElement;
|
|
1081
1130
|
"vertex-card": HTMLVertexCardElement;
|
|
1082
1131
|
"vertex-card-group": HTMLVertexCardGroupElement;
|
|
@@ -1156,6 +1205,16 @@ declare namespace LocalJSX {
|
|
|
1156
1205
|
}
|
|
1157
1206
|
interface VertexAvatarGroup {
|
|
1158
1207
|
}
|
|
1208
|
+
interface VertexBadge {
|
|
1209
|
+
/**
|
|
1210
|
+
* The color of the badge displayed in this <vertex-badge>. Can be "primary" or "secondary", and defaults to "primary."
|
|
1211
|
+
*/
|
|
1212
|
+
"badgeColor"?: BadgeIconColor;
|
|
1213
|
+
/**
|
|
1214
|
+
* The string to show in the badge.
|
|
1215
|
+
*/
|
|
1216
|
+
"badgeText"?: string;
|
|
1217
|
+
}
|
|
1159
1218
|
interface VertexButton {
|
|
1160
1219
|
/**
|
|
1161
1220
|
* The color of this <vertex-button>. Can be "primary", "secondary", or "danger" and defaults to "secondary".
|
|
@@ -1732,6 +1791,7 @@ declare namespace LocalJSX {
|
|
|
1732
1791
|
"items"?: Result[];
|
|
1733
1792
|
"itemsJson"?: string;
|
|
1734
1793
|
"onEnterPressed"?: (event: VertexResultListCustomEvent<Result>) => void;
|
|
1794
|
+
"onResultClick"?: (event: VertexResultListCustomEvent<Result>) => void;
|
|
1735
1795
|
"open"?: boolean;
|
|
1736
1796
|
"overScanCount"?: number;
|
|
1737
1797
|
"placement"?: PopoverPlacement;
|
|
@@ -1741,33 +1801,62 @@ declare namespace LocalJSX {
|
|
|
1741
1801
|
"viewportStartIndex"?: number;
|
|
1742
1802
|
}
|
|
1743
1803
|
interface VertexSearchBar {
|
|
1804
|
+
/**
|
|
1805
|
+
* 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.
|
|
1806
|
+
*/
|
|
1744
1807
|
"breakCharacters"?: string[];
|
|
1745
|
-
"debounce"?: number;
|
|
1746
1808
|
/**
|
|
1747
|
-
*
|
|
1809
|
+
* Whether this search bar is disabled.
|
|
1810
|
+
*/
|
|
1811
|
+
"disabled"?: boolean;
|
|
1812
|
+
/**
|
|
1813
|
+
* Emitted when the input is blurred.
|
|
1748
1814
|
*/
|
|
1749
1815
|
"onInputBlur"?: (event: VertexSearchBarCustomEvent<FocusEvent>) => void;
|
|
1750
1816
|
/**
|
|
1751
|
-
* Emitted when input
|
|
1817
|
+
* Emitted when the value of the input has changed.
|
|
1818
|
+
*/
|
|
1819
|
+
"onInputChanged"?: (event: VertexSearchBarCustomEvent<string>) => void;
|
|
1820
|
+
/**
|
|
1821
|
+
* Emitted when the input is focused.
|
|
1752
1822
|
*/
|
|
1753
1823
|
"onInputFocus"?: (event: VertexSearchBarCustomEvent<FocusEvent>) => void;
|
|
1754
1824
|
/**
|
|
1755
|
-
* Emitted when
|
|
1825
|
+
* Emitted when a result has been selected to replace the trigger text. Includes the ID of the `Result` selected.
|
|
1756
1826
|
*/
|
|
1757
|
-
"
|
|
1758
|
-
"onTriggerCharacterPressed"?: (event: VertexSearchBarCustomEvent<string>) => void;
|
|
1827
|
+
"onResultReplaced"?: (event: VertexSearchBarCustomEvent<Result1>) => void;
|
|
1759
1828
|
/**
|
|
1760
|
-
* Emitted when the value has changed.
|
|
1829
|
+
* Emitted when the value of the current search triggered by the specified `triggerCharacter` has changed.
|
|
1761
1830
|
*/
|
|
1762
|
-
"
|
|
1831
|
+
"onSearchChanged"?: (event: VertexSearchBarCustomEvent<string>) => void;
|
|
1763
1832
|
/**
|
|
1764
|
-
*
|
|
1833
|
+
* A placeholder to display when no text has been entered.
|
|
1765
1834
|
*/
|
|
1766
1835
|
"placeholder"?: string;
|
|
1836
|
+
/**
|
|
1837
|
+
* The placement of the result list for this search bar. Corresponds to the value for the underlying <vertex-popover> placement value.
|
|
1838
|
+
* @see (PopoverPlacement)
|
|
1839
|
+
*/
|
|
1767
1840
|
"placement"?: PopoverPlacement;
|
|
1841
|
+
/**
|
|
1842
|
+
* 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>`.
|
|
1843
|
+
*/
|
|
1844
|
+
"replacements"?: Result1[];
|
|
1845
|
+
/**
|
|
1846
|
+
* 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.
|
|
1847
|
+
*/
|
|
1768
1848
|
"resultItems"?: Result1[];
|
|
1849
|
+
/**
|
|
1850
|
+
* 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.
|
|
1851
|
+
*/
|
|
1769
1852
|
"triggerCharacter"?: string;
|
|
1770
|
-
|
|
1853
|
+
/**
|
|
1854
|
+
* The initial value of this search bar. This will be used in combination with the value of `replacements` to display existing replaced values.
|
|
1855
|
+
*/
|
|
1856
|
+
"value"?: string;
|
|
1857
|
+
/**
|
|
1858
|
+
* The search bar variant to display. Possible options are: - 'standard' (default) - 'filled' - 'underlined' - 'blank
|
|
1859
|
+
*/
|
|
1771
1860
|
"variant"?: SearchBarVariant;
|
|
1772
1861
|
}
|
|
1773
1862
|
interface VertexSelect {
|
|
@@ -1779,6 +1868,10 @@ declare namespace LocalJSX {
|
|
|
1779
1868
|
* Whether this select is disabled.
|
|
1780
1869
|
*/
|
|
1781
1870
|
"disabled"?: boolean;
|
|
1871
|
+
/**
|
|
1872
|
+
* Whether this select will omit the currently selected value in the dropdown list.
|
|
1873
|
+
*/
|
|
1874
|
+
"hideSelected"?: boolean;
|
|
1782
1875
|
/**
|
|
1783
1876
|
* Emitted when the selected option of this element changes, and contains the value that it has been changed to.
|
|
1784
1877
|
*/
|
|
@@ -1987,6 +2080,7 @@ declare namespace LocalJSX {
|
|
|
1987
2080
|
"vertex-auto-resize-textarea": VertexAutoResizeTextarea;
|
|
1988
2081
|
"vertex-avatar": VertexAvatar;
|
|
1989
2082
|
"vertex-avatar-group": VertexAvatarGroup;
|
|
2083
|
+
"vertex-badge": VertexBadge;
|
|
1990
2084
|
"vertex-button": VertexButton;
|
|
1991
2085
|
"vertex-card": VertexCard;
|
|
1992
2086
|
"vertex-card-group": VertexCardGroup;
|
|
@@ -2030,6 +2124,7 @@ declare module "@stencil/core" {
|
|
|
2030
2124
|
"vertex-auto-resize-textarea": LocalJSX.VertexAutoResizeTextarea & JSXBase.HTMLAttributes<HTMLVertexAutoResizeTextareaElement>;
|
|
2031
2125
|
"vertex-avatar": LocalJSX.VertexAvatar & JSXBase.HTMLAttributes<HTMLVertexAvatarElement>;
|
|
2032
2126
|
"vertex-avatar-group": LocalJSX.VertexAvatarGroup & JSXBase.HTMLAttributes<HTMLVertexAvatarGroupElement>;
|
|
2127
|
+
"vertex-badge": LocalJSX.VertexBadge & JSXBase.HTMLAttributes<HTMLVertexBadgeElement>;
|
|
2033
2128
|
"vertex-button": LocalJSX.VertexButton & JSXBase.HTMLAttributes<HTMLVertexButtonElement>;
|
|
2034
2129
|
"vertex-card": LocalJSX.VertexCard & JSXBase.HTMLAttributes<HTMLVertexCardElement>;
|
|
2035
2130
|
"vertex-card-group": LocalJSX.VertexCardGroup & JSXBase.HTMLAttributes<HTMLVertexCardGroupElement>;
|
|
@@ -37,6 +37,7 @@ 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",
|
|
@@ -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-testing.
|
|
3
|
+
"version": "0.1.0-testing.5",
|
|
4
4
|
"description": "The Vertex UI component library.",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"@floating-ui/dom": "^1.6.5",
|
|
87
87
|
"@vertexvis/utils": "^0.21.0"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "8013122df0b6a3d4a6def2e30f5084b12e520ea7"
|
|
90
90
|
}
|
|
@@ -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";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{T as vertex_textfield}from"./p-bd11e7d1.js";import"./p-6834631c.js";import"./p-fe062eb0.js";
|