@genesislcap/foundation-ui 14.138.1 → 14.139.0
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/custom-elements.json +1417 -1
- package/dist/dts/base-components.d.ts +12 -0
- package/dist/dts/base-components.d.ts.map +1 -1
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/search-bar/index.d.ts +8 -0
- package/dist/dts/search-bar/index.d.ts.map +1 -0
- package/dist/dts/search-bar/search-bar-combobox.d.ts +27 -0
- package/dist/dts/search-bar/search-bar-combobox.d.ts.map +1 -0
- package/dist/dts/search-bar/search-bar-combobox.styles.d.ts +4 -0
- package/dist/dts/search-bar/search-bar-combobox.styles.d.ts.map +1 -0
- package/dist/dts/search-bar/search-bar-combobox.template.d.ts +6 -0
- package/dist/dts/search-bar/search-bar-combobox.template.d.ts.map +1 -0
- package/dist/dts/search-bar/search-bar.d.ts +52 -0
- package/dist/dts/search-bar/search-bar.d.ts.map +1 -0
- package/dist/dts/search-bar/search-bar.styles.d.ts +2 -0
- package/dist/dts/search-bar/search-bar.styles.d.ts.map +1 -0
- package/dist/dts/search-bar/search-bar.template.d.ts +6 -0
- package/dist/dts/search-bar/search-bar.template.d.ts.map +1 -0
- package/dist/dts/search-bar/search-bar.types.d.ts +19 -0
- package/dist/dts/search-bar/search-bar.types.d.ts.map +1 -0
- package/dist/esm/base-components.js +4 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/search-bar/index.js +7 -0
- package/dist/esm/search-bar/search-bar-combobox.js +140 -0
- package/dist/esm/search-bar/search-bar-combobox.styles.js +26 -0
- package/dist/esm/search-bar/search-bar-combobox.template.js +60 -0
- package/dist/esm/search-bar/search-bar.js +144 -0
- package/dist/esm/search-bar/search-bar.styles.js +96 -0
- package/dist/esm/search-bar/search-bar.template.js +100 -0
- package/dist/esm/search-bar/search-bar.types.js +13 -0
- package/package.json +10 -10
|
@@ -198,6 +198,18 @@ export declare const baseComponents: {
|
|
|
198
198
|
foundationProgressRing: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").ProgressRingOptions>) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").ProgressRingOptions, import("@microsoft/fast-element").Constructable<import("@microsoft/fast-foundation").FoundationElement>>;
|
|
199
199
|
foundationRadio: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").RadioOptions>) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").RadioOptions, import("@microsoft/fast-element").Constructable<import("@microsoft/fast-foundation").FoundationElement>>;
|
|
200
200
|
foundationRadioGroup: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").FoundationElementDefinition>) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").FoundationElementDefinition, typeof import("./radio-group").RadioGroup>;
|
|
201
|
+
foundationSearchBar: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<{
|
|
202
|
+
baseName: string;
|
|
203
|
+
template: import("@microsoft/fast-element").ViewTemplate<import("./search-bar").SearchBar, any>;
|
|
204
|
+
styles: import("@microsoft/fast-element").ElementStyles;
|
|
205
|
+
shadowOptions: ShadowRootInit;
|
|
206
|
+
}>) => import("@microsoft/fast-foundation").FoundationElementRegistry<{
|
|
207
|
+
baseName: string;
|
|
208
|
+
template: import("@microsoft/fast-element").ViewTemplate<import("./search-bar").SearchBar, any>;
|
|
209
|
+
styles: import("@microsoft/fast-element").ElementStyles;
|
|
210
|
+
shadowOptions: ShadowRootInit;
|
|
211
|
+
}, typeof import("./search-bar").SearchBar>;
|
|
212
|
+
foundationSearchBarCombobox: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").FoundationElementDefinition>) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").FoundationElementDefinition, typeof import("./search-bar").SearchBarCombobox>;
|
|
201
213
|
foundationSegmentedControl: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").FoundationElementDefinition>) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").FoundationElementDefinition, typeof import("./segmented-control").SegmentedControl>;
|
|
202
214
|
foundationSegmentedItem: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").RadioOptions>) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").RadioOptions, import("@microsoft/fast-element").Constructable<import("@microsoft/fast-foundation").FoundationElement>>;
|
|
203
215
|
foundationSelect: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").SelectOptions>) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").SelectOptions, import("@microsoft/fast-element").Constructable<import("@microsoft/fast-foundation").FoundationElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-components.d.ts","sourceRoot":"","sources":["../../src/base-components.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"base-components.d.ts","sourceRoot":"","sources":["../../src/base-components.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AA4E5D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA2EJ,SAAS,WAAW,GAAG,EAAE;CAe/C,CAAC"}
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export * from './progress-ring';
|
|
|
59
59
|
export * from './radio';
|
|
60
60
|
export * from './radio-group';
|
|
61
61
|
export * from './router';
|
|
62
|
+
export * from './search-bar';
|
|
62
63
|
export * from './segmented-control';
|
|
63
64
|
export * from './segmented-item';
|
|
64
65
|
export * from './select';
|
package/dist/dts/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEvF,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,CAAC;AAExE,eAAO,MAAM,8BAA8B,yDAAuD,CAAC;AAEnG,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CA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C5B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './search-bar';
|
|
2
|
+
export * from './search-bar.styles';
|
|
3
|
+
export * from './search-bar.template';
|
|
4
|
+
export * from './search-bar.types';
|
|
5
|
+
export * from './search-bar-combobox';
|
|
6
|
+
export * from './search-bar-combobox.styles';
|
|
7
|
+
export * from './search-bar-combobox.template';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/search-bar/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Combobox } from '@microsoft/fast-components';
|
|
2
|
+
/**
|
|
3
|
+
* @tagname %%prefix%%-search-bar-combobox
|
|
4
|
+
*/
|
|
5
|
+
export declare class SearchBarCombobox extends Combobox {
|
|
6
|
+
minlength: number;
|
|
7
|
+
private previousLength;
|
|
8
|
+
private changeListener;
|
|
9
|
+
connectedCallback(): void;
|
|
10
|
+
disconnectedCallback(): void;
|
|
11
|
+
clickHandler(e: any): boolean | void;
|
|
12
|
+
keyupHandler(e: KeyboardEvent): void;
|
|
13
|
+
keydownHandler(e: Event & KeyboardEvent): boolean | void;
|
|
14
|
+
inputHandler(e: InputEvent): boolean | void;
|
|
15
|
+
openChanged(): void;
|
|
16
|
+
}
|
|
17
|
+
export declare const foundationSearchBarComboboxShadowOptions: ShadowRootInit;
|
|
18
|
+
export declare const defaultSearchBarComboboxConfig: {};
|
|
19
|
+
/**
|
|
20
|
+
* The Foundation Search Bar Combobox
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
* @remarks
|
|
24
|
+
* HTML Element: \<foundation-search-bar-combobox\>
|
|
25
|
+
*/
|
|
26
|
+
export declare const foundationSearchBarCombobox: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").FoundationElementDefinition>) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").FoundationElementDefinition, typeof SearchBarCombobox>;
|
|
27
|
+
//# sourceMappingURL=search-bar-combobox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-bar-combobox.d.ts","sourceRoot":"","sources":["../../../src/search-bar/search-bar-combobox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAOtD;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IACvC,SAAS,EAAE,MAAM,CAA0B;IAEjD,OAAO,CAAC,cAAc,CAAc;IAEpC,OAAO,CAAC,cAAc,CAEpB;IAEF,iBAAiB;IAKjB,oBAAoB,IAAI,IAAI;IAK5B,YAAY,CAAC,CAAC,EAAE,GAAG,GAAG,OAAO,GAAG,IAAI;IAiB7B,YAAY,CAAC,CAAC,EAAE,aAAa;IA0B7B,cAAc,CAAC,CAAC,EAAE,KAAK,GAAG,aAAa,GAAG,OAAO,GAAG,IAAI;IAoC/D,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,IAAI;IAW3C,WAAW;CAWZ;AAED,eAAO,MAAM,wCAAwC,EAAE,cAGtD,CAAC;AAEF,eAAO,MAAM,8BAA8B,IAAK,CAAC;AAEjD;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,iUAMtC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ElementStyles } from '@microsoft/fast-element';
|
|
2
|
+
import type { ElementDefinitionContext, FoundationElementDefinition } from '@microsoft/fast-foundation';
|
|
3
|
+
export declare const foundationSearchBarComboboxStyles: (context: ElementDefinitionContext, definition: FoundationElementDefinition) => ElementStyles;
|
|
4
|
+
//# sourceMappingURL=search-bar-combobox.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-bar-combobox.styles.d.ts","sourceRoot":"","sources":["../../../src/search-bar/search-bar-combobox.styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EACV,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,4BAA4B,CAAC;AAGpC,eAAO,MAAM,iCAAiC,YACnC,wBAAwB,cACrB,2BAA2B,KACtC,aAsBF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ViewTemplate } from '@microsoft/fast-element';
|
|
2
|
+
import { ElementDefinitionContext } from '@microsoft/fast-foundation';
|
|
3
|
+
import type { ComboboxOptions } from '@microsoft/fast-foundation';
|
|
4
|
+
import type { SearchBarCombobox } from './search-bar-combobox';
|
|
5
|
+
export declare const foundationSearchBarComboboxTemplate: (context: ElementDefinitionContext, definition: ComboboxOptions) => ViewTemplate<SearchBarCombobox>;
|
|
6
|
+
//# sourceMappingURL=search-bar-combobox.template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-bar-combobox.template.d.ts","sourceRoot":"","sources":["../../../src/search-bar/search-bar-combobox.template.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAmB,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,eAAO,MAAM,mCAAmC,YACrC,wBAAwB,cACrB,eAAe,KAC1B,aAAa,iBAAiB,CAyDhC,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
2
|
+
import { SearchBarCombobox } from './search-bar-combobox';
|
|
3
|
+
import { AvailableOption, SelectedOption } from './search-bar.types';
|
|
4
|
+
/**
|
|
5
|
+
* @tagname %%prefix%%-search-bar
|
|
6
|
+
*/
|
|
7
|
+
export declare class SearchBar extends FoundationElement {
|
|
8
|
+
combobox: SearchBarCombobox;
|
|
9
|
+
defaultSlottedNodes: any;
|
|
10
|
+
options: AvailableOption[];
|
|
11
|
+
searchTerm: string;
|
|
12
|
+
appearance: string;
|
|
13
|
+
minlength: number;
|
|
14
|
+
placeholder: string;
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
loading: boolean;
|
|
17
|
+
selectedOptions: SelectedOption[];
|
|
18
|
+
filteredOptions: AvailableOption[];
|
|
19
|
+
selectedOptionsDiv: HTMLDivElement;
|
|
20
|
+
clear(): void;
|
|
21
|
+
clearSearch(): void;
|
|
22
|
+
inputdeleted(): void;
|
|
23
|
+
changeHandler(): void;
|
|
24
|
+
pasteHandler(event: ClipboardEvent): void;
|
|
25
|
+
hasSelectedOption(term: string, field: string): boolean;
|
|
26
|
+
unselectOption(option: any): void;
|
|
27
|
+
inputHandler(): Promise<void>;
|
|
28
|
+
private filterSelectedOptions;
|
|
29
|
+
private normalizeDelimiter;
|
|
30
|
+
private addOrReplaceSelectedText;
|
|
31
|
+
}
|
|
32
|
+
export declare const foundationSearchBarShadowOptions: ShadowRootInit;
|
|
33
|
+
export declare const defaultSearchBarConfig: {};
|
|
34
|
+
/**
|
|
35
|
+
* The Foundation Search Bar
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
* @remarks
|
|
39
|
+
* HTML Element: \<foundation-search-bar\>
|
|
40
|
+
*/
|
|
41
|
+
export declare const foundationSearchBar: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<{
|
|
42
|
+
baseName: string;
|
|
43
|
+
template: import("@microsoft/fast-element").ViewTemplate<SearchBar, any>;
|
|
44
|
+
styles: import("@microsoft/fast-element").ElementStyles;
|
|
45
|
+
shadowOptions: ShadowRootInit;
|
|
46
|
+
}>) => import("@microsoft/fast-foundation").FoundationElementRegistry<{
|
|
47
|
+
baseName: string;
|
|
48
|
+
template: import("@microsoft/fast-element").ViewTemplate<SearchBar, any>;
|
|
49
|
+
styles: import("@microsoft/fast-element").ElementStyles;
|
|
50
|
+
shadowOptions: ShadowRootInit;
|
|
51
|
+
}, typeof SearchBar>;
|
|
52
|
+
//# sourceMappingURL=search-bar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-bar.d.ts","sourceRoot":"","sources":["../../../src/search-bar/search-bar.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D,OAAO,EACL,eAAe,EACf,cAAc,EAGf,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,qBAAa,SAAU,SAAQ,iBAAiB;IACvC,QAAQ,EAAE,iBAAiB,CAAC;IACvB,mBAAmB,MAAC;IAEpB,OAAO,EAAE,eAAe,EAAE,CAAC;IAE3B,UAAU,EAAE,MAAM,CAAM;IAE9B,UAAU,EAAE,MAAM,CAAa;IAC/B,SAAS,EAAE,MAAM,CAAoB;IAErC,WAAW,EAAE,MAAM,CAA4B;IAC/C,QAAQ,EAAE,OAAO,CAAC;IAEZ,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,cAAc,EAAE,CAAM;IACvC,eAAe,EAAE,eAAe,EAAE,CAAC;IAExC,kBAAkB,EAAE,cAAc,CAAC;IAEnC,KAAK;IAML,WAAW,IAAI,IAAI;IAInB,YAAY;IAMZ,aAAa;IAuCb,YAAY,CAAC,KAAK,EAAE,cAAc;IAclC,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAM7C,cAAc,CAAC,MAAM,EAAE,GAAG;IAKpB,YAAY;IASzB,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,kBAAkB,CAExB;IAEF,OAAO,CAAC,wBAAwB,CAQ9B;CACH;AAGD,eAAO,MAAM,gCAAgC,EAAE,cAA0B,CAAC;AAE1E,eAAO,MAAM,sBAAsB,IAAK,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;oBAM9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-bar.styles.d.ts","sourceRoot":"","sources":["../../../src/search-bar/search-bar.styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,yBAAyB,iDA6FrC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SearchBar } from './search-bar';
|
|
2
|
+
export declare const crossIcon: (slot?: string) => string;
|
|
3
|
+
export declare const plusIcon: () => string;
|
|
4
|
+
export declare const getPrefixedSearchBar: (prefix: string) => import("@microsoft/fast-element").ViewTemplate<SearchBar, any>;
|
|
5
|
+
export declare const foundationSearchBarTemplate: import("@microsoft/fast-element").ViewTemplate<SearchBar, any>;
|
|
6
|
+
//# sourceMappingURL=search-bar.template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-bar.template.d.ts","sourceRoot":"","sources":["../../../src/search-bar/search-bar.template.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,eAAO,MAAM,SAAS,2BAMrB,CAAC;AAEF,eAAO,MAAM,QAAQ,cAGd,CAAC;AAER,eAAO,MAAM,oBAAoB,WAAY,MAAM,mEAyFlD,CAAC;AAEF,eAAO,MAAM,2BAA2B,gEAEvC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type CriteriaCreator = <T extends string = string>(type: T, term: string) => string;
|
|
2
|
+
export declare const SCROLL_TIMEOUT = 10;
|
|
3
|
+
export declare const INPUT_MIN_LENGTH = 3;
|
|
4
|
+
export declare const COMBO_INPUT_MIN_LENGTH = 1;
|
|
5
|
+
export type SelectedOption<T extends string = string> = {
|
|
6
|
+
field: T;
|
|
7
|
+
term: string;
|
|
8
|
+
label: string;
|
|
9
|
+
createCriteria: CriteriaCreator;
|
|
10
|
+
};
|
|
11
|
+
export type AvailableOption<T extends string = string> = {
|
|
12
|
+
field: T;
|
|
13
|
+
label: (searchTerm: string) => string;
|
|
14
|
+
createCriteria: CriteriaCreator;
|
|
15
|
+
isEnabled: (searchTerm: string, selectedOptions: SelectedOption[]) => boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare const getCriteriaBuilder: CriteriaCreator;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=search-bar.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-bar.types.d.ts","sourceRoot":"","sources":["../../../src/search-bar/search-bar.types.ts"],"names":[],"mappings":"AAEA,KAAK,eAAe,GAAG,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;AAEpF,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAClC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI;IACtD,KAAK,EAAE,CAAC,CAAC;IACT,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,eAAe,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI;IACvD,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;IACtC,cAAc,EAAE,eAAe,CAAC;IAChC,SAAS,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,KAAK,OAAO,CAAC;CAC/E,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,eAUhC,CAAC"}
|
|
@@ -49,6 +49,8 @@ import { foundationProgress } from './progress';
|
|
|
49
49
|
import { foundationProgressRing } from './progress-ring';
|
|
50
50
|
import { foundationRadio } from './radio';
|
|
51
51
|
import { foundationRadioGroup } from './radio-group';
|
|
52
|
+
import { foundationSearchBar } from './search-bar';
|
|
53
|
+
import { foundationSearchBarCombobox } from './search-bar';
|
|
52
54
|
import { foundationSegmentedControl } from './segmented-control';
|
|
53
55
|
import { foundationSegmentedItem } from './segmented-item';
|
|
54
56
|
import { foundationSelect } from './select/index';
|
|
@@ -122,6 +124,8 @@ export const baseComponents = {
|
|
|
122
124
|
foundationProgressRing,
|
|
123
125
|
foundationRadio,
|
|
124
126
|
foundationRadioGroup,
|
|
127
|
+
foundationSearchBar,
|
|
128
|
+
foundationSearchBarCombobox,
|
|
125
129
|
foundationSegmentedControl,
|
|
126
130
|
foundationSegmentedItem,
|
|
127
131
|
foundationSelect,
|
package/dist/esm/index.js
CHANGED
|
@@ -59,6 +59,7 @@ export * from './progress-ring';
|
|
|
59
59
|
export * from './radio';
|
|
60
60
|
export * from './radio-group';
|
|
61
61
|
export * from './router';
|
|
62
|
+
export * from './search-bar';
|
|
62
63
|
export * from './segmented-control';
|
|
63
64
|
export * from './segmented-item';
|
|
64
65
|
export * from './select';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './search-bar';
|
|
2
|
+
export * from './search-bar.styles';
|
|
3
|
+
export * from './search-bar.template';
|
|
4
|
+
export * from './search-bar.types';
|
|
5
|
+
export * from './search-bar-combobox';
|
|
6
|
+
export * from './search-bar-combobox.styles';
|
|
7
|
+
export * from './search-bar-combobox.template';
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { Combobox } from '@microsoft/fast-components';
|
|
3
|
+
import { attr } from '@microsoft/fast-element';
|
|
4
|
+
import { foundationSearchBarComboboxStyles } from './search-bar-combobox.styles';
|
|
5
|
+
import { foundationSearchBarComboboxTemplate } from './search-bar-combobox.template';
|
|
6
|
+
import { COMBO_INPUT_MIN_LENGTH } from './search-bar.types';
|
|
7
|
+
/**
|
|
8
|
+
* @tagname %%prefix%%-search-bar-combobox
|
|
9
|
+
*/
|
|
10
|
+
export class SearchBarCombobox extends Combobox {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.minlength = COMBO_INPUT_MIN_LENGTH;
|
|
14
|
+
this.previousLength = -1;
|
|
15
|
+
this.changeListener = (e) => {
|
|
16
|
+
this.previousLength = 0;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
connectedCallback() {
|
|
20
|
+
super.connectedCallback();
|
|
21
|
+
this.addEventListener('change', this.changeListener);
|
|
22
|
+
}
|
|
23
|
+
disconnectedCallback() {
|
|
24
|
+
super.disconnectedCallback();
|
|
25
|
+
this.removeEventListener('change', this.changeListener);
|
|
26
|
+
}
|
|
27
|
+
clickHandler(e) {
|
|
28
|
+
if (this.disabled) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (this.open) {
|
|
32
|
+
const captured = e.target.closest(`option,[role=option]`);
|
|
33
|
+
if (!captured || captured.disabled) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
this.selectedOptions = [captured];
|
|
37
|
+
this.control.value = captured.text;
|
|
38
|
+
this.value = this.control.value;
|
|
39
|
+
this.$emit('change');
|
|
40
|
+
}
|
|
41
|
+
this.control.focus();
|
|
42
|
+
}
|
|
43
|
+
keyupHandler(e) {
|
|
44
|
+
const key = e.key;
|
|
45
|
+
switch (key) {
|
|
46
|
+
case 'Backspace':
|
|
47
|
+
case 'Delete': {
|
|
48
|
+
if (this.previousLength < 0) {
|
|
49
|
+
this.$emit('inputdeleted');
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this.previousLength = this.previousLength - 1;
|
|
53
|
+
}
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
case 'Enter': {
|
|
57
|
+
if (this.open && this.selectedIndex !== -1) {
|
|
58
|
+
const firstOption = this.slottedOptions[0];
|
|
59
|
+
this.selectedOptions = [firstOption];
|
|
60
|
+
this.control.value = firstOption.text;
|
|
61
|
+
this.value = this.control.value;
|
|
62
|
+
this.$emit('change');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
super.keyupHandler(e);
|
|
67
|
+
}
|
|
68
|
+
keydownHandler(e) {
|
|
69
|
+
const key = e.key;
|
|
70
|
+
switch (key) {
|
|
71
|
+
case 'ArrowUp':
|
|
72
|
+
case 'ArrowDown': {
|
|
73
|
+
if (this.control.value.length < this.minlength) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
return super.keydownHandler(e);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
case 'Enter': {
|
|
81
|
+
if (this.selectedIndex === -1) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
return super.keydownHandler(e);
|
|
85
|
+
}
|
|
86
|
+
case 'Tab': {
|
|
87
|
+
if (!this.open) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
if (e.shiftKey) {
|
|
91
|
+
this.selectPreviousOption();
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
this.selectNextOption();
|
|
95
|
+
}
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
default:
|
|
99
|
+
return super.keydownHandler(e);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
inputHandler(e) {
|
|
103
|
+
if (this.control.value.length >= this.minlength) {
|
|
104
|
+
this.open = true;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
e.stopImmediatePropagation();
|
|
108
|
+
this.open = false;
|
|
109
|
+
}
|
|
110
|
+
this.value = this.control.value;
|
|
111
|
+
this.previousLength = this.control.value.length;
|
|
112
|
+
}
|
|
113
|
+
openChanged() {
|
|
114
|
+
if (this.open) {
|
|
115
|
+
this.ariaControls = this.listboxId;
|
|
116
|
+
this.ariaExpanded = 'true';
|
|
117
|
+
this.setPositioning();
|
|
118
|
+
this.focusAndScrollOptionIntoView();
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
this.ariaControls = '';
|
|
122
|
+
this.ariaExpanded = 'false';
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
__decorate([
|
|
126
|
+
attr
|
|
127
|
+
], SearchBarCombobox.prototype, "minlength", void 0);
|
|
128
|
+
export const foundationSearchBarComboboxShadowOptions = {
|
|
129
|
+
delegatesFocus: true,
|
|
130
|
+
mode: 'open',
|
|
131
|
+
};
|
|
132
|
+
export const defaultSearchBarComboboxConfig = {};
|
|
133
|
+
/**
|
|
134
|
+
* The Foundation Search Bar Combobox
|
|
135
|
+
*
|
|
136
|
+
* @public
|
|
137
|
+
* @remarks
|
|
138
|
+
* HTML Element: \<foundation-search-bar-combobox\>
|
|
139
|
+
*/
|
|
140
|
+
export const foundationSearchBarCombobox = SearchBarCombobox.compose(Object.assign({ baseName: 'search-bar-combobox', template: foundationSearchBarComboboxTemplate, styles: foundationSearchBarComboboxStyles, shadowOptions: foundationSearchBarComboboxShadowOptions }, defaultSearchBarComboboxConfig));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { designUnit } from '@microsoft/fast-components';
|
|
2
|
+
import { css } from '@microsoft/fast-element';
|
|
3
|
+
import { foundationComboboxStyles } from '../combobox';
|
|
4
|
+
export const foundationSearchBarComboboxStyles = (context, definition) => css `
|
|
5
|
+
${foundationComboboxStyles(context, definition)}
|
|
6
|
+
.control {
|
|
7
|
+
width: auto;
|
|
8
|
+
padding-left: calc(${designUnit} * 1px);
|
|
9
|
+
padding-right: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.end {
|
|
13
|
+
height: 100%;
|
|
14
|
+
min-width: 36px;
|
|
15
|
+
max-width: 36px;
|
|
16
|
+
padding-right: 2px;
|
|
17
|
+
display: flex;
|
|
18
|
+
justify-content: flex-end;
|
|
19
|
+
align-items: center;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.selected-value {
|
|
23
|
+
min-width: 150px;
|
|
24
|
+
max-width: 169px;
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { html, ref, slotted } from '@microsoft/fast-element';
|
|
2
|
+
import { endSlotTemplate } from '@microsoft/fast-foundation';
|
|
3
|
+
import { Listbox } from '@microsoft/fast-foundation';
|
|
4
|
+
export const foundationSearchBarComboboxTemplate = (context, definition) => html `
|
|
5
|
+
<template
|
|
6
|
+
aria-disabled="${(x) => x.ariaDisabled}"
|
|
7
|
+
autocomplete="${(x) => x.autocomplete}"
|
|
8
|
+
class="${(x) => (x.open ? 'open' : '')} ${(x) => (x.disabled ? 'disabled' : '')} ${(x) => x.position} body"
|
|
9
|
+
?open="${(x) => x.open}"
|
|
10
|
+
tabindex="${(x) => (!x.disabled ? '0' : null)}"
|
|
11
|
+
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
12
|
+
@focusout="${(x, c) => x.focusoutHandler(c.event)}"
|
|
13
|
+
@keydown="${(x, c) => x.keydownHandler(c.event)}"
|
|
14
|
+
data-test-id="combobox"
|
|
15
|
+
>
|
|
16
|
+
<slot name="selectedOptions" data-test-id="options"></slot>
|
|
17
|
+
<div class="control" part="control">
|
|
18
|
+
<slot name="control">
|
|
19
|
+
<input
|
|
20
|
+
aria-activedescendant="${(x) => (x.open ? x.ariaActiveDescendant : null)}"
|
|
21
|
+
aria-autocomplete="${(x) => x.ariaAutoComplete}"
|
|
22
|
+
aria-controls="${(x) => x.ariaControls}"
|
|
23
|
+
aria-disabled="${(x) => x.ariaDisabled}"
|
|
24
|
+
aria-expanded="${(x) => x.ariaExpanded}"
|
|
25
|
+
aria-haspopup="listbox"
|
|
26
|
+
class="selected-value"
|
|
27
|
+
part="selected-value"
|
|
28
|
+
placeholder="${(x) => x.placeholder}"
|
|
29
|
+
role="combobox"
|
|
30
|
+
type="text"
|
|
31
|
+
?disabled="${(x) => x.disabled}"
|
|
32
|
+
:value="${(x) => x.value}"
|
|
33
|
+
@input="${(x, c) => x.inputHandler(c.event)}"
|
|
34
|
+
@keyup="${(x, c) => x.keyupHandler(c.event)}"
|
|
35
|
+
${ref('control')}
|
|
36
|
+
data-test-id="selected-value"
|
|
37
|
+
/>
|
|
38
|
+
</slot>
|
|
39
|
+
</div>
|
|
40
|
+
${endSlotTemplate(context, definition)}
|
|
41
|
+
<div
|
|
42
|
+
class="listbox"
|
|
43
|
+
id="${(x) => x.listboxId}"
|
|
44
|
+
part="listbox"
|
|
45
|
+
role="listbox"
|
|
46
|
+
?disabled="${(x) => x.disabled}"
|
|
47
|
+
?hidden="${(x) => !x.open}"
|
|
48
|
+
${ref('listbox')}
|
|
49
|
+
data-test-id="listbox"
|
|
50
|
+
>
|
|
51
|
+
<slot
|
|
52
|
+
${slotted({
|
|
53
|
+
filter: Listbox.slottedOptionFilter,
|
|
54
|
+
flatten: true,
|
|
55
|
+
property: 'slottedOptions',
|
|
56
|
+
})}
|
|
57
|
+
></slot>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
`;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { __awaiter, __decorate } from "tslib";
|
|
2
|
+
import { attr, DOM, observable } from '@microsoft/fast-element';
|
|
3
|
+
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
4
|
+
import { foundationSearchBarStyles as styles } from './search-bar.styles';
|
|
5
|
+
import { foundationSearchBarTemplate as template } from './search-bar.template';
|
|
6
|
+
import { INPUT_MIN_LENGTH, SCROLL_TIMEOUT, } from './search-bar.types';
|
|
7
|
+
/**
|
|
8
|
+
* @tagname %%prefix%%-search-bar
|
|
9
|
+
*/
|
|
10
|
+
export class SearchBar extends FoundationElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.searchTerm = '';
|
|
14
|
+
this.appearance = 'neutral';
|
|
15
|
+
this.minlength = INPUT_MIN_LENGTH;
|
|
16
|
+
this.placeholder = 'Start typing to search';
|
|
17
|
+
this.selectedOptions = [];
|
|
18
|
+
this.normalizeDelimiter = (inputString) => {
|
|
19
|
+
return inputString.trim().replace(/\t|\r\n|\n|\r|,/g, ' ');
|
|
20
|
+
};
|
|
21
|
+
this.addOrReplaceSelectedText = (previousText, selectedText, newText) => {
|
|
22
|
+
return (selectedText === null || selectedText === void 0 ? void 0 : selectedText.length) > 0
|
|
23
|
+
? previousText.replace(selectedText, newText)
|
|
24
|
+
: previousText.concat(newText);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
clear() {
|
|
28
|
+
this.selectedOptions = [];
|
|
29
|
+
this.combobox.currentValue = '';
|
|
30
|
+
this.$emit('selectionChange', []);
|
|
31
|
+
}
|
|
32
|
+
clearSearch() {
|
|
33
|
+
this.clear();
|
|
34
|
+
}
|
|
35
|
+
inputdeleted() {
|
|
36
|
+
if (this.selectedOptions.length > 0) {
|
|
37
|
+
this.unselectOption(this.selectedOptions[this.selectedOptions.length - 1]);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
changeHandler() {
|
|
41
|
+
const newOptions = [];
|
|
42
|
+
this.combobox.selectedOptions.forEach((option) => {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
const field = option.value;
|
|
45
|
+
const trimSearchTerm = this.searchTerm.trim();
|
|
46
|
+
newOptions.push({
|
|
47
|
+
field,
|
|
48
|
+
term: trimSearchTerm,
|
|
49
|
+
label: ((_a = this.options
|
|
50
|
+
.find((availableOption) => availableOption.field === field)) === null || _a === void 0 ? void 0 : _a.label(trimSearchTerm)) || option.text,
|
|
51
|
+
createCriteria: (_b = this.options.find((availableOption) => availableOption.field === field)) === null || _b === void 0 ? void 0 : _b.createCriteria,
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
this.selectedOptions = [...this.selectedOptions, ...newOptions];
|
|
55
|
+
this.selectedOptions = this.selectedOptions.filter((option, index, self) => index ===
|
|
56
|
+
self.findIndex((compareOption) => option.field === compareOption.field && option.term === compareOption.term));
|
|
57
|
+
this.combobox.value = '';
|
|
58
|
+
this.combobox.open = false;
|
|
59
|
+
this.$emit('selectionChange', this.selectedOptions);
|
|
60
|
+
DOM.queueUpdate(() => {
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
this.selectedOptionsDiv.scrollTo(this.selectedOptionsDiv.scrollWidth, 0);
|
|
63
|
+
}, SCROLL_TIMEOUT);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
pasteHandler(event) {
|
|
67
|
+
var _a;
|
|
68
|
+
this.loading = true;
|
|
69
|
+
const pastedText = event.clipboardData.getData('text/plain');
|
|
70
|
+
const formattedText = this.normalizeDelimiter(pastedText);
|
|
71
|
+
const selectedText = (_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.toString();
|
|
72
|
+
const newText = this.addOrReplaceSelectedText(this.combobox.value, selectedText, formattedText);
|
|
73
|
+
if ((newText === null || newText === void 0 ? void 0 : newText.length) >= this.minlength) {
|
|
74
|
+
this.combobox.value = newText;
|
|
75
|
+
this.searchTerm = newText;
|
|
76
|
+
this.combobox.open = true;
|
|
77
|
+
}
|
|
78
|
+
this.loading = false;
|
|
79
|
+
}
|
|
80
|
+
hasSelectedOption(term, field) {
|
|
81
|
+
return this.selectedOptions.some((option) => {
|
|
82
|
+
return option.term === term && option.field === field;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
unselectOption(option) {
|
|
86
|
+
this.selectedOptions = this.selectedOptions.filter((x) => x !== option);
|
|
87
|
+
this.$emit('selectionChange', this.selectedOptions);
|
|
88
|
+
}
|
|
89
|
+
inputHandler() {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
this.loading = true;
|
|
92
|
+
this.searchTerm = this.combobox.value;
|
|
93
|
+
if (this.combobox.value.length >= this.minlength) {
|
|
94
|
+
this.filterSelectedOptions(this.combobox.value);
|
|
95
|
+
}
|
|
96
|
+
this.loading = false;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
filterSelectedOptions(term) {
|
|
100
|
+
this.filteredOptions = this.options.filter((option) => !this.selectedOptions.find((selectedOption) => selectedOption.field === option.field && selectedOption.term.trim() === term.trim()));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
__decorate([
|
|
104
|
+
observable
|
|
105
|
+
], SearchBar.prototype, "defaultSlottedNodes", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
observable
|
|
108
|
+
], SearchBar.prototype, "options", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
observable
|
|
111
|
+
], SearchBar.prototype, "searchTerm", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
attr
|
|
114
|
+
], SearchBar.prototype, "appearance", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
attr
|
|
117
|
+
], SearchBar.prototype, "minlength", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
attr
|
|
120
|
+
], SearchBar.prototype, "placeholder", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
attr
|
|
123
|
+
], SearchBar.prototype, "disabled", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
observable
|
|
126
|
+
], SearchBar.prototype, "loading", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
observable
|
|
129
|
+
], SearchBar.prototype, "selectedOptions", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
observable
|
|
132
|
+
], SearchBar.prototype, "filteredOptions", void 0);
|
|
133
|
+
// explicitly declaring for extensibility
|
|
134
|
+
export const foundationSearchBarShadowOptions = undefined;
|
|
135
|
+
export const defaultSearchBarConfig = {};
|
|
136
|
+
/**
|
|
137
|
+
* The Foundation Search Bar
|
|
138
|
+
*
|
|
139
|
+
* @public
|
|
140
|
+
* @remarks
|
|
141
|
+
* HTML Element: \<foundation-search-bar\>
|
|
142
|
+
*/
|
|
143
|
+
export const foundationSearchBar = SearchBar.compose(Object.assign({ baseName: 'search-bar', template,
|
|
144
|
+
styles, shadowOptions: foundationSearchBarShadowOptions }, defaultSearchBarConfig));
|