@genesislcap/foundation-ui 14.398.0 → 14.400.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 +1937 -766
- package/dist/dts/ai-criteria-search/ai-criteria-search.d.ts +41 -0
- package/dist/dts/ai-criteria-search/ai-criteria-search.d.ts.map +1 -0
- package/dist/dts/ai-criteria-search/ai-criteria-search.styles.d.ts +2 -0
- package/dist/dts/ai-criteria-search/ai-criteria-search.styles.d.ts.map +1 -0
- package/dist/dts/ai-criteria-search/ai-criteria-search.template.d.ts +4 -0
- package/dist/dts/ai-criteria-search/ai-criteria-search.template.d.ts.map +1 -0
- package/dist/dts/ai-criteria-search/index.d.ts +7 -0
- package/dist/dts/ai-criteria-search/index.d.ts.map +1 -0
- package/dist/dts/ai-criteria-search/validation/criteria-ir.d.ts +36 -0
- package/dist/dts/ai-criteria-search/validation/criteria-ir.d.ts.map +1 -0
- package/dist/dts/ai-criteria-search/validation/operator-map.d.ts +17 -0
- package/dist/dts/ai-criteria-search/validation/operator-map.d.ts.map +1 -0
- package/dist/dts/ai-criteria-search/validation/schema-validator.d.ts +15 -0
- package/dist/dts/ai-criteria-search/validation/schema-validator.d.ts.map +1 -0
- package/dist/dts/ai-criteria-search/validation-error-notification.d.ts +14 -0
- package/dist/dts/ai-criteria-search/validation-error-notification.d.ts.map +1 -0
- package/dist/dts/ai-indicator/ai-indicator.d.ts +31 -0
- package/dist/dts/ai-indicator/ai-indicator.d.ts.map +1 -0
- package/dist/dts/ai-indicator/ai-indicator.styles.d.ts +4 -0
- package/dist/dts/ai-indicator/ai-indicator.styles.d.ts.map +1 -0
- package/dist/dts/ai-indicator/ai-indicator.template.d.ts +4 -0
- package/dist/dts/ai-indicator/ai-indicator.template.d.ts.map +1 -0
- package/dist/dts/ai-indicator/index.d.ts +4 -0
- package/dist/dts/ai-indicator/index.d.ts.map +1 -0
- 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 +2 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/esm/ai-criteria-search/ai-criteria-search.js +172 -0
- package/dist/esm/ai-criteria-search/ai-criteria-search.styles.js +36 -0
- package/dist/esm/ai-criteria-search/ai-criteria-search.template.js +44 -0
- package/dist/esm/ai-criteria-search/index.js +6 -0
- package/dist/esm/ai-criteria-search/validation/criteria-ir.js +7 -0
- package/dist/esm/ai-criteria-search/validation/operator-map.js +97 -0
- package/dist/esm/ai-criteria-search/validation/schema-validator.js +150 -0
- package/dist/esm/ai-criteria-search/validation-error-notification.js +34 -0
- package/dist/esm/ai-indicator/ai-indicator.js +190 -0
- package/dist/esm/ai-indicator/ai-indicator.styles.js +132 -0
- package/dist/esm/ai-indicator/ai-indicator.template.js +72 -0
- package/dist/esm/ai-indicator/index.js +3 -0
- package/dist/esm/base-components.js +4 -0
- package/dist/esm/index.js +2 -0
- package/package.json +19 -18
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AIProvider } from '@genesislcap/foundation-ai';
|
|
2
|
+
import type { MetadataDetail } from '@genesislcap/foundation-comms';
|
|
3
|
+
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
4
|
+
/**
|
|
5
|
+
* @tagname %%prefix%%-ai-criteria-search
|
|
6
|
+
*/
|
|
7
|
+
export declare class AiCriteriaSearch extends FoundationElement {
|
|
8
|
+
aiProvider: AIProvider;
|
|
9
|
+
placeholder: string;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
mode: 'append' | 'replace';
|
|
12
|
+
inputValue: string;
|
|
13
|
+
isInterpreting: boolean;
|
|
14
|
+
lastValidCriteria: string | null;
|
|
15
|
+
fieldMetadata: MetadataDetail[] | string[];
|
|
16
|
+
isRecording: boolean;
|
|
17
|
+
textAreaRef: HTMLTextAreaElement;
|
|
18
|
+
private stopRecording;
|
|
19
|
+
private speechApplyDebounceTimer;
|
|
20
|
+
private baseInputForAppend;
|
|
21
|
+
get speechAvailable(): boolean;
|
|
22
|
+
handleSubmit(): Promise<void>;
|
|
23
|
+
handleBlur(): void;
|
|
24
|
+
clear(): void;
|
|
25
|
+
toggleSpeechInput(): void;
|
|
26
|
+
private clearSpeechApplyDebounce;
|
|
27
|
+
}
|
|
28
|
+
export declare const foundationAiCriteriaSearchShadowOptions: ShadowRootInit;
|
|
29
|
+
export declare const defaultAiCriteriaSearchConfig: {};
|
|
30
|
+
export declare const foundationAiCriteriaSearch: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<{
|
|
31
|
+
baseName: string;
|
|
32
|
+
template: import("@microsoft/fast-element").ViewTemplate<AiCriteriaSearch, any>;
|
|
33
|
+
styles: import("@microsoft/fast-element").ElementStyles;
|
|
34
|
+
shadowOptions: ShadowRootInit;
|
|
35
|
+
}>) => import("@microsoft/fast-foundation").FoundationElementRegistry<{
|
|
36
|
+
baseName: string;
|
|
37
|
+
template: import("@microsoft/fast-element").ViewTemplate<AiCriteriaSearch, any>;
|
|
38
|
+
styles: import("@microsoft/fast-element").ElementStyles;
|
|
39
|
+
shadowOptions: ShadowRootInit;
|
|
40
|
+
}, typeof AiCriteriaSearch>;
|
|
41
|
+
//# sourceMappingURL=ai-criteria-search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-criteria-search.d.ts","sourceRoot":"","sources":["../../../src/ai-criteria-search/ai-criteria-search.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAGX,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAW/D;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,iBAAiB;IACzC,UAAU,EAAE,UAAU,CAAC;IAE7B,WAAW,EAAE,MAAM,CAA0D;IACxD,QAAQ,EAAE,OAAO,CAAC;IACvC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAa;IAEjC,UAAU,EAAE,MAAM,CAAM;IACxB,cAAc,EAAE,OAAO,CAAS;IAChC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAQ;IAExC,aAAa,EAAE,cAAc,EAAE,GAAG,MAAM,EAAE,CAAM;IAChD,WAAW,EAAE,OAAO,CAAS;IAElC,WAAW,EAAE,mBAAmB,CAAC;IAExC,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,wBAAwB,CAA8C;IAC9E,OAAO,CAAC,kBAAkB,CAAc;IAExC,IACI,eAAe,IAAI,OAAO,CAE7B;IAEK,YAAY;IAsDlB,UAAU;IAUV,KAAK;IAML,iBAAiB;IA+CjB,OAAO,CAAC,wBAAwB;CAMjC;AAED,eAAO,MAAM,uCAAuC,EAAE,cAA0B,CAAC;AACjF,eAAO,MAAM,6BAA6B,IAAK,CAAC;AAEhD,eAAO,MAAM,0BAA0B;;;;;;;;;;2BAMrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-criteria-search.styles.d.ts","sourceRoot":"","sources":["../../../src/ai-criteria-search/ai-criteria-search.styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gCAAgC,iDAiC5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-criteria-search.template.d.ts","sourceRoot":"","sources":["../../../src/ai-criteria-search/ai-criteria-search.template.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAExE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AA8C7D,eAAO,MAAM,kCAAkC,EAAE,YAAY,CAAC,gBAAgB,CAE7E,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { AiCriteriaSearch, defaultAiCriteriaSearchConfig, foundationAiCriteriaSearch, foundationAiCriteriaSearchShadowOptions, } from './ai-criteria-search';
|
|
2
|
+
export { foundationAiCriteriaSearchStyles } from './ai-criteria-search.styles';
|
|
3
|
+
export { foundationAiCriteriaSearchTemplate } from './ai-criteria-search.template';
|
|
4
|
+
export * from './validation/criteria-ir';
|
|
5
|
+
export * from './validation/operator-map';
|
|
6
|
+
export * from './validation/schema-validator';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ai-criteria-search/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,6BAA6B,EAC7B,0BAA0B,EAC1B,uCAAuC,GACxC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,kCAAkC,EAAE,MAAM,+BAA+B,CAAC;AACnF,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intermediate representation for AI-generated criteria.
|
|
3
|
+
* AI produces this; validation checks against schema.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export type CriteriaOperator = 'contains' | 'equals' | 'startsWith' | 'endsWith' | 'greaterThan' | 'lessThan' | 'greaterThanOrEqual' | 'lessThanOrEqual' | 'notEqual' | 'dateIsToday' | 'dateIsAfter' | 'dateIsBefore' | 'dateIsEqual' | 'dateIsGreaterEqual' | 'dateIsLessEqual' | 'dateTimeIsAfter' | 'dateTimeIsBefore' | 'dateTimeIsGreaterEqual' | 'dateTimeIsLessEqual';
|
|
8
|
+
export type CriteriaClause = {
|
|
9
|
+
field: string;
|
|
10
|
+
operator: CriteriaOperator;
|
|
11
|
+
value: string | number | boolean | null;
|
|
12
|
+
};
|
|
13
|
+
export type CriteriaGroup = {
|
|
14
|
+
logic: 'and' | 'or';
|
|
15
|
+
negated?: boolean;
|
|
16
|
+
clauses: CriteriaClause[];
|
|
17
|
+
};
|
|
18
|
+
export type CriteriaIR = {
|
|
19
|
+
groups: CriteriaGroup[];
|
|
20
|
+
errors?: ValidationError[];
|
|
21
|
+
};
|
|
22
|
+
export type ValidationError = {
|
|
23
|
+
field: string;
|
|
24
|
+
operator?: string;
|
|
25
|
+
value?: unknown;
|
|
26
|
+
message: string;
|
|
27
|
+
};
|
|
28
|
+
export type ValidationResult = {
|
|
29
|
+
valid: CriteriaClause[];
|
|
30
|
+
invalid: ValidationError[];
|
|
31
|
+
};
|
|
32
|
+
export type GroupsValidationResult = {
|
|
33
|
+
valid: CriteriaGroup[];
|
|
34
|
+
invalid: ValidationError[];
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=criteria-ir.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"criteria-ir.d.ts","sourceRoot":"","sources":["../../../../src/ai-criteria-search/validation/criteria-ir.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,gBAAgB,GACxB,UAAU,GACV,QAAQ,GACR,YAAY,GACZ,UAAU,GACV,aAAa,GACb,UAAU,GACV,oBAAoB,GACpB,iBAAiB,GACjB,UAAU,GACV,aAAa,GACb,aAAa,GACb,cAAc,GACd,aAAa,GACb,oBAAoB,GACpB,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,wBAAwB,GACxB,qBAAqB,CAAC;AAE1B,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps IR operators to Groovy criteria using foundation-criteria.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
import type { CriteriaGroup, CriteriaOperator } from './criteria-ir';
|
|
7
|
+
/**
|
|
8
|
+
* Converts validated CriteriaGroup[] to a Groovy criteria string using CriteriaBuilder.
|
|
9
|
+
* Groups are AND-ed at top level. Within each group, clauses use group.logic (and/or).
|
|
10
|
+
* If group.negated is true, the group's combined expression is wrapped in NOT.
|
|
11
|
+
*/
|
|
12
|
+
export declare function groupsToCriteria(groups: CriteriaGroup[]): string;
|
|
13
|
+
export declare const STRING_OPERATORS: CriteriaOperator[];
|
|
14
|
+
export declare const NUMERIC_OPERATORS: CriteriaOperator[];
|
|
15
|
+
export declare const DATE_OPERATORS: CriteriaOperator[];
|
|
16
|
+
export declare const DATETIME_OPERATORS: CriteriaOperator[];
|
|
17
|
+
//# sourceMappingURL=operator-map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operator-map.d.ts","sourceRoot":"","sources":["../../../../src/ai-criteria-search/validation/operator-map.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EAAkB,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AA6CrF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAqBhE;AAED,eAAO,MAAM,gBAAgB,EAAE,gBAAgB,EAM9C,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,gBAAgB,EAO/C,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,gBAAgB,EAO5C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,gBAAgB,EAKhD,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema-first validation for AI-generated criteria clauses.
|
|
3
|
+
* Never auto-corrects; surfaces structured errors.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
import type { MetadataDetail } from '@genesislcap/foundation-comms';
|
|
8
|
+
import type { CriteriaClause, CriteriaGroup, GroupsValidationResult, ValidationResult } from './criteria-ir';
|
|
9
|
+
export declare function validateClauses(clauses: CriteriaClause[], fieldMetadata: MetadataDetail[] | string[]): ValidationResult;
|
|
10
|
+
/**
|
|
11
|
+
* Validates groups of criteria clauses. Each group's clauses are validated
|
|
12
|
+
* using the same per-clause logic as validateClauses.
|
|
13
|
+
*/
|
|
14
|
+
export declare function validateGroups(groups: CriteriaGroup[], fieldMetadata: MetadataDetail[] | string[]): GroupsValidationResult;
|
|
15
|
+
//# sourceMappingURL=schema-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-validator.d.ts","sourceRoot":"","sources":["../../../../src/ai-criteria-search/validation/schema-validator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EAEb,sBAAsB,EAEtB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AA8DvB,wBAAgB,eAAe,CAC7B,OAAO,EAAE,cAAc,EAAE,EACzB,aAAa,EAAE,cAAc,EAAE,GAAG,MAAM,EAAE,GACzC,gBAAgB,CA4ElB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,aAAa,EAAE,EACvB,aAAa,EAAE,cAAc,EAAE,GAAG,MAAM,EAAE,GACzC,sBAAsB,CA2BxB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ValidationError } from './validation/criteria-ir';
|
|
2
|
+
/**
|
|
3
|
+
* Formats validation errors into a user-friendly message.
|
|
4
|
+
*/
|
|
5
|
+
export declare function formatValidationErrors(errors: ValidationError[]): string;
|
|
6
|
+
/**
|
|
7
|
+
* Shows a criteria error as a toast notification.
|
|
8
|
+
*
|
|
9
|
+
* @param title - Notification title (e.g. "Criteria validation error")
|
|
10
|
+
* @param body - Error message to display
|
|
11
|
+
* @param tagName - Design system prefix (e.g. "rapid", "foundation")
|
|
12
|
+
*/
|
|
13
|
+
export declare function showCriteriaError(title: string, body: string, tagName: string): void;
|
|
14
|
+
//# sourceMappingURL=validation-error-notification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-error-notification.d.ts","sourceRoot":"","sources":["../../../src/ai-criteria-search/validation-error-notification.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAIhE;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,CAIxE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAiBpF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AIProvider, type AIStatus } from '@genesislcap/foundation-ai';
|
|
2
|
+
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
3
|
+
export type AIIndicatorState = 'available' | 'downloading' | 'downloadable' | 'unavailable' | 'server' | 'none';
|
|
4
|
+
/**
|
|
5
|
+
* @tagname %%prefix%%-ai-indicator
|
|
6
|
+
*/
|
|
7
|
+
export declare class AiIndicator extends FoundationElement {
|
|
8
|
+
aiProvider: AIProvider;
|
|
9
|
+
status: AIStatus | null;
|
|
10
|
+
open: boolean;
|
|
11
|
+
state: AIIndicatorState;
|
|
12
|
+
isInstalling: boolean;
|
|
13
|
+
private pollTimer;
|
|
14
|
+
private clickOutside;
|
|
15
|
+
get chromeStatusLabel(): string | null;
|
|
16
|
+
get canInstall(): boolean;
|
|
17
|
+
get isDownloading(): boolean;
|
|
18
|
+
connectedCallback(): Promise<void>;
|
|
19
|
+
disconnectedCallback(): void;
|
|
20
|
+
openChanged(): void;
|
|
21
|
+
private handleClickOutside;
|
|
22
|
+
toggleDropdown(): void;
|
|
23
|
+
refreshStatus(): Promise<void>;
|
|
24
|
+
private deriveState;
|
|
25
|
+
private maybeStartPolling;
|
|
26
|
+
private startPolling;
|
|
27
|
+
private stopPolling;
|
|
28
|
+
onInstall(): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
export declare const foundationAiIndicator: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").FoundationElementDefinition>) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").FoundationElementDefinition, typeof AiIndicator>;
|
|
31
|
+
//# sourceMappingURL=ai-indicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-indicator.d.ts","sourceRoot":"","sources":["../../../src/ai-indicator/ai-indicator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAO/D,MAAM,MAAM,gBAAgB,GACxB,WAAW,GACX,aAAa,GACb,cAAc,GACd,aAAa,GACb,QAAQ,GACR,MAAM,CAAC;AAEX;;GAEG;AACH,qBAAa,WAAY,SAAQ,iBAAiB;IACpC,UAAU,EAAE,UAAU,CAAC;IAEvB,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAQ;IAC/B,IAAI,EAAE,OAAO,CAAS;IACtB,KAAK,EAAE,gBAAgB,CAAU;IACjC,YAAY,EAAE,OAAO,CAAS;IAE1C,OAAO,CAAC,SAAS,CAA+C;IAChE,OAAO,CAAC,YAAY,CAAiD;IAErE,IACI,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAQrC;IAED,IACI,UAAU,IAAI,OAAO,CAOxB;IAED,IACI,aAAa,IAAI,OAAO,CAE3B;IAEK,iBAAiB;IAMvB,oBAAoB,IAAI,IAAI;IAK5B,WAAW,IAAI,IAAI;IASnB,OAAO,CAAC,kBAAkB;IAM1B,cAAc;IAIR,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAoBpC,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,WAAW;IAOb,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAYjC;AAED,eAAO,MAAM,qBAAqB,2TAIhC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ElementStyles } from '@microsoft/fast-element';
|
|
2
|
+
import type { ElementDefinitionContext, FoundationElementDefinition } from '@microsoft/fast-foundation';
|
|
3
|
+
export declare const foundationAiIndicatorStyles: (context: ElementDefinitionContext, definition: FoundationElementDefinition) => ElementStyles;
|
|
4
|
+
//# sourceMappingURL=ai-indicator.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-indicator.styles.d.ts","sourceRoot":"","sources":["../../../src/ai-indicator/ai-indicator.styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,KAAK,EACV,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,4BAA4B,CAAC;AAEpC,eAAO,MAAM,2BAA2B,GACtC,SAAS,wBAAwB,EACjC,YAAY,2BAA2B,KACtC,aAkIF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-indicator.template.d.ts","sourceRoot":"","sources":["../../../src/ai-indicator/ai-indicator.template.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAuFlD,eAAO,MAAM,6BAA6B,EAAE,YAAY,CAAC,WAAW,CAEnE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { AiIndicator, foundationAiIndicator, type AIIndicatorState } from './ai-indicator';
|
|
2
|
+
export { foundationAiIndicatorTemplate } from './ai-indicator.template';
|
|
3
|
+
export { foundationAiIndicatorStyles } from './ai-indicator.styles';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ai-indicator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import type { Container } from '@microsoft/fast-foundation';
|
|
2
2
|
export declare const baseComponents: {
|
|
3
3
|
foundationAccordion: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").FoundationElementDefinition>) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").FoundationElementDefinition, typeof import("./accordion").Accordion>;
|
|
4
|
+
foundationAiCriteriaSearch: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<{
|
|
5
|
+
baseName: string;
|
|
6
|
+
template: import("@microsoft/fast-element").ViewTemplate<import("./ai-criteria-search").AiCriteriaSearch, any>;
|
|
7
|
+
styles: import("@microsoft/fast-element").ElementStyles;
|
|
8
|
+
shadowOptions: ShadowRootInit;
|
|
9
|
+
}>) => import("@microsoft/fast-foundation").FoundationElementRegistry<{
|
|
10
|
+
baseName: string;
|
|
11
|
+
template: import("@microsoft/fast-element").ViewTemplate<import("./ai-criteria-search").AiCriteriaSearch, any>;
|
|
12
|
+
styles: import("@microsoft/fast-element").ElementStyles;
|
|
13
|
+
shadowOptions: ShadowRootInit;
|
|
14
|
+
}, typeof import("./ai-criteria-search").AiCriteriaSearch>;
|
|
15
|
+
foundationAiIndicator: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").FoundationElementDefinition>) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").FoundationElementDefinition, typeof import("./ai-indicator").AiIndicator>;
|
|
4
16
|
foundationAccordionItem: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").AccordionItemOptions>) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").AccordionItemOptions, import("@microsoft/fast-element").Constructable<import("@microsoft/fast-foundation").FoundationElement>>;
|
|
5
17
|
foundationActionsMenu: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").FoundationElementDefinition>) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").FoundationElementDefinition, typeof import("./actions-menu").ActionsMenu>;
|
|
6
18
|
foundationAnchor: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").FoundationElementDefinition>) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").FoundationElementDefinition, typeof import("./anchor").Anchor>;
|
|
@@ -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;AAuF5D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAuFJ,SAAS,WAAW,GAAG,EAAE;CAe/C,CAAC"}
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export declare const registerFoundationDesignSystem: () => import("@microsoft/fa
|
|
|
5
5
|
export * from './_common';
|
|
6
6
|
export * from './_config';
|
|
7
7
|
export * from './accordion';
|
|
8
|
+
export * from './ai-criteria-search';
|
|
9
|
+
export * from './ai-indicator';
|
|
8
10
|
export * from './accordion-item';
|
|
9
11
|
export * from './actions-menu';
|
|
10
12
|
export * from './anchor';
|
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,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC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AAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,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;AACxC,OAAO,EAAE,SAAS,IAAI,qBAAqB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { __awaiter, __decorate } from "tslib";
|
|
2
|
+
import { AIProvider, isSpeechRecognitionAvailable, startSpeechRecognition, } from '@genesislcap/foundation-ai';
|
|
3
|
+
import { attr, observable, volatile } from '@microsoft/fast-element';
|
|
4
|
+
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
5
|
+
import { getPrefix } from '../utils';
|
|
6
|
+
import { foundationAiCriteriaSearchStyles as styles } from './ai-criteria-search.styles';
|
|
7
|
+
import { foundationAiCriteriaSearchTemplate as template } from './ai-criteria-search.template';
|
|
8
|
+
import { groupsToCriteria } from './validation/operator-map';
|
|
9
|
+
import { validateGroups } from './validation/schema-validator';
|
|
10
|
+
import { showCriteriaError, formatValidationErrors } from './validation-error-notification';
|
|
11
|
+
const SPEECH_APPLY_DEBOUNCE_MS = 700;
|
|
12
|
+
/**
|
|
13
|
+
* @tagname %%prefix%%-ai-criteria-search
|
|
14
|
+
*/
|
|
15
|
+
export class AiCriteriaSearch extends FoundationElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.placeholder = 'Describe your search criteria in natural language...';
|
|
19
|
+
this.mode = 'replace';
|
|
20
|
+
this.inputValue = '';
|
|
21
|
+
this.isInterpreting = false;
|
|
22
|
+
this.lastValidCriteria = null;
|
|
23
|
+
this.fieldMetadata = [];
|
|
24
|
+
this.isRecording = false;
|
|
25
|
+
this.stopRecording = null;
|
|
26
|
+
this.speechApplyDebounceTimer = null;
|
|
27
|
+
this.baseInputForAppend = '';
|
|
28
|
+
}
|
|
29
|
+
get speechAvailable() {
|
|
30
|
+
return isSpeechRecognitionAvailable();
|
|
31
|
+
}
|
|
32
|
+
handleSubmit() {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
var _a, _b, _c;
|
|
35
|
+
const text = (_a = this.inputValue) === null || _a === void 0 ? void 0 : _a.trim();
|
|
36
|
+
if (!text || this.isInterpreting)
|
|
37
|
+
return;
|
|
38
|
+
if (!((_b = this.aiProvider) === null || _b === void 0 ? void 0 : _b.interpretCriteria)) {
|
|
39
|
+
showCriteriaError('AI criteria search', 'AI provider not configured', getPrefix(this));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
this.isInterpreting = true;
|
|
43
|
+
try {
|
|
44
|
+
const fields = Array.isArray(this.fieldMetadata) ? this.fieldMetadata : [];
|
|
45
|
+
const result = (yield this.aiProvider.interpretCriteria(text, {
|
|
46
|
+
fields,
|
|
47
|
+
}));
|
|
48
|
+
if (!((_c = result === null || result === void 0 ? void 0 : result.groups) === null || _c === void 0 ? void 0 : _c.some((g) => { var _a; return (_a = g.clauses) === null || _a === void 0 ? void 0 : _a.length; }))) {
|
|
49
|
+
showCriteriaError('AI criteria search', 'AI could not interpret the criteria', getPrefix(this));
|
|
50
|
+
this.isInterpreting = false;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const { valid, invalid } = validateGroups(result.groups, this.fieldMetadata);
|
|
54
|
+
if (invalid.length > 0) {
|
|
55
|
+
showCriteriaError('Criteria validation error', formatValidationErrors(invalid), getPrefix(this));
|
|
56
|
+
this.$emit('validation-errors', invalid);
|
|
57
|
+
}
|
|
58
|
+
if (valid.length > 0) {
|
|
59
|
+
const criteria = groupsToCriteria(valid);
|
|
60
|
+
this.lastValidCriteria = criteria;
|
|
61
|
+
this.$emit('criteria-changed', criteria);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
showCriteriaError('AI criteria search', e instanceof Error ? e.message : 'Interpretation failed', getPrefix(this));
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
this.isInterpreting = false;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
handleBlur() {
|
|
73
|
+
var _a;
|
|
74
|
+
if (this.isRecording)
|
|
75
|
+
return;
|
|
76
|
+
const text = (_a = this.inputValue) === null || _a === void 0 ? void 0 : _a.trim();
|
|
77
|
+
if (text) {
|
|
78
|
+
this.handleSubmit();
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this.clear();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
clear() {
|
|
85
|
+
this.inputValue = '';
|
|
86
|
+
this.lastValidCriteria = null;
|
|
87
|
+
this.$emit('criteria-changed', null);
|
|
88
|
+
}
|
|
89
|
+
toggleSpeechInput() {
|
|
90
|
+
var _a, _b;
|
|
91
|
+
if (this.isRecording && this.stopRecording) {
|
|
92
|
+
this.clearSpeechApplyDebounce();
|
|
93
|
+
this.stopRecording();
|
|
94
|
+
this.stopRecording = null;
|
|
95
|
+
this.isRecording = false;
|
|
96
|
+
this.baseInputForAppend = '';
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
this.baseInputForAppend = this.mode === 'append' ? ((_b = (_a = this.inputValue) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '') : '';
|
|
100
|
+
this.stopRecording = startSpeechRecognition((transcript, isFinal) => {
|
|
101
|
+
if (this.mode === 'append') {
|
|
102
|
+
this.inputValue = this.baseInputForAppend
|
|
103
|
+
? `${this.baseInputForAppend} ${transcript}`.trim()
|
|
104
|
+
: transcript;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
this.inputValue = transcript;
|
|
108
|
+
}
|
|
109
|
+
if (isFinal && (transcript === null || transcript === void 0 ? void 0 : transcript.trim())) {
|
|
110
|
+
this.clearSpeechApplyDebounce();
|
|
111
|
+
if (this.stopRecording) {
|
|
112
|
+
this.stopRecording();
|
|
113
|
+
this.stopRecording = null;
|
|
114
|
+
this.isRecording = false;
|
|
115
|
+
this.baseInputForAppend = '';
|
|
116
|
+
}
|
|
117
|
+
this.speechApplyDebounceTimer = setTimeout(() => {
|
|
118
|
+
this.speechApplyDebounceTimer = null;
|
|
119
|
+
this.handleSubmit();
|
|
120
|
+
}, SPEECH_APPLY_DEBOUNCE_MS);
|
|
121
|
+
}
|
|
122
|
+
}, () => {
|
|
123
|
+
this.clearSpeechApplyDebounce();
|
|
124
|
+
this.isRecording = false;
|
|
125
|
+
this.stopRecording = null;
|
|
126
|
+
this.baseInputForAppend = '';
|
|
127
|
+
});
|
|
128
|
+
if (this.stopRecording) {
|
|
129
|
+
this.isRecording = true;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
clearSpeechApplyDebounce() {
|
|
133
|
+
if (this.speechApplyDebounceTimer) {
|
|
134
|
+
clearTimeout(this.speechApplyDebounceTimer);
|
|
135
|
+
this.speechApplyDebounceTimer = null;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
__decorate([
|
|
140
|
+
AIProvider
|
|
141
|
+
], AiCriteriaSearch.prototype, "aiProvider", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
attr
|
|
144
|
+
], AiCriteriaSearch.prototype, "placeholder", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
attr({ mode: 'boolean' })
|
|
147
|
+
], AiCriteriaSearch.prototype, "disabled", void 0);
|
|
148
|
+
__decorate([
|
|
149
|
+
attr
|
|
150
|
+
], AiCriteriaSearch.prototype, "mode", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
observable
|
|
153
|
+
], AiCriteriaSearch.prototype, "inputValue", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
observable
|
|
156
|
+
], AiCriteriaSearch.prototype, "isInterpreting", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
observable
|
|
159
|
+
], AiCriteriaSearch.prototype, "lastValidCriteria", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
observable
|
|
162
|
+
], AiCriteriaSearch.prototype, "fieldMetadata", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
observable
|
|
165
|
+
], AiCriteriaSearch.prototype, "isRecording", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
volatile
|
|
168
|
+
], AiCriteriaSearch.prototype, "speechAvailable", null);
|
|
169
|
+
export const foundationAiCriteriaSearchShadowOptions = undefined;
|
|
170
|
+
export const defaultAiCriteriaSearchConfig = {};
|
|
171
|
+
export const foundationAiCriteriaSearch = AiCriteriaSearch.compose(Object.assign({ baseName: 'ai-criteria-search', template,
|
|
172
|
+
styles, shadowOptions: foundationAiCriteriaSearchShadowOptions }, defaultAiCriteriaSearchConfig));
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { designUnit } from '@microsoft/fast-components';
|
|
2
|
+
import { css } from '@microsoft/fast-element';
|
|
3
|
+
export const foundationAiCriteriaSearchStyles = css `
|
|
4
|
+
:host {
|
|
5
|
+
display: block;
|
|
6
|
+
width: 800px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.ai-criteria-search {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: calc(${designUnit} * 2px);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.ai-criteria-search-row {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
gap: calc(${designUnit} * 2px);
|
|
19
|
+
align-items: center;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.criteria-input {
|
|
23
|
+
height: calc(((var(--base-height-multiplier) + var(--density)) * var(--design-unit) - 4) * 1px);
|
|
24
|
+
flex: 1;
|
|
25
|
+
min-width: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.mic-icon {
|
|
29
|
+
color: var(--neutral-foreground-rest);
|
|
30
|
+
fill: currentColor;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.mode-control {
|
|
34
|
+
flex-shrink: 0;
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { isAIFeatureEnabled } from '@genesislcap/foundation-ai';
|
|
2
|
+
import { sync } from '@genesislcap/foundation-utils';
|
|
3
|
+
import { html, ref, when } from '@microsoft/fast-element';
|
|
4
|
+
import { getPrefix } from '../utils';
|
|
5
|
+
const aiCriteriaSearchTemplate = (prefix) => html `
|
|
6
|
+
${when(() => isAIFeatureEnabled(), html `
|
|
7
|
+
<div class="ai-criteria-search">
|
|
8
|
+
<div class="ai-criteria-search-row">
|
|
9
|
+
<${prefix}-text-area
|
|
10
|
+
${ref('textAreaRef')}
|
|
11
|
+
class="criteria-input"
|
|
12
|
+
placeholder="${(x) => x.placeholder}"
|
|
13
|
+
?disabled=${(x) => x.disabled || x.isInterpreting}
|
|
14
|
+
:value=${sync((x) => x.inputValue, 'string', 'input')}
|
|
15
|
+
@blur=${(x) => x.handleBlur()}
|
|
16
|
+
rows="1"
|
|
17
|
+
></${prefix}-text-area>
|
|
18
|
+
${when((x) => x.speechAvailable, html `
|
|
19
|
+
<${prefix}-button
|
|
20
|
+
class="mic-button"
|
|
21
|
+
appearance="${(x) => (x.isRecording ? 'accent' : 'outline')}"
|
|
22
|
+
?disabled=${(x) => x.disabled || x.isInterpreting}
|
|
23
|
+
@click=${(x) => x.toggleSpeechInput()}
|
|
24
|
+
title=${(x) => (x.isRecording ? 'Stop recording' : 'Start voice input')}
|
|
25
|
+
>
|
|
26
|
+
<${prefix}-icon
|
|
27
|
+
class="mic-icon"
|
|
28
|
+
name="microphone"
|
|
29
|
+
size="lg"
|
|
30
|
+
variant="solid"
|
|
31
|
+
></${prefix}-icon>
|
|
32
|
+
</${prefix}-button>
|
|
33
|
+
`)}
|
|
34
|
+
<${prefix}-segmented-control class="mode-control" :value=${sync((x) => x.mode)}>
|
|
35
|
+
<${prefix}-segmented-item value="append">Append</${prefix}-segmented-item>
|
|
36
|
+
<${prefix}-segmented-item value="replace">Replace</${prefix}-segmented-item>
|
|
37
|
+
</${prefix}-segmented-control>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
`)}
|
|
41
|
+
`;
|
|
42
|
+
export const foundationAiCriteriaSearchTemplate = html `
|
|
43
|
+
${(x) => aiCriteriaSearchTemplate(getPrefix(x))}
|
|
44
|
+
`;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { AiCriteriaSearch, defaultAiCriteriaSearchConfig, foundationAiCriteriaSearch, foundationAiCriteriaSearchShadowOptions, } from './ai-criteria-search';
|
|
2
|
+
export { foundationAiCriteriaSearchStyles } from './ai-criteria-search.styles';
|
|
3
|
+
export { foundationAiCriteriaSearchTemplate } from './ai-criteria-search.template';
|
|
4
|
+
export * from './validation/criteria-ir';
|
|
5
|
+
export * from './validation/operator-map';
|
|
6
|
+
export * from './validation/schema-validator';
|