@ni/ok-components 1.0.1 → 1.1.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/all-components-bundle.js +621 -369
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +215 -9
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/custom-elements.json +144 -31
- package/dist/custom-elements.md +43 -8
- package/dist/esm/fv/all-fv.d.ts +1 -0
- package/dist/esm/fv/all-fv.js +1 -0
- package/dist/esm/fv/all-fv.js.map +1 -1
- package/dist/esm/fv/search-input/index.d.ts +23 -0
- package/dist/esm/fv/search-input/index.js +50 -0
- package/dist/esm/fv/search-input/index.js.map +1 -0
- package/dist/esm/fv/search-input/styles.d.ts +1 -0
- package/dist/esm/fv/search-input/styles.js +178 -0
- package/dist/esm/fv/search-input/styles.js.map +1 -0
- package/dist/esm/fv/search-input/template.d.ts +2 -0
- package/dist/esm/fv/search-input/template.js +34 -0
- package/dist/esm/fv/search-input/template.js.map +1 -0
- package/dist/esm/fv/search-input/testing/fv-search-input.pageobject.d.ts +22 -0
- package/dist/esm/fv/search-input/testing/fv-search-input.pageobject.js +65 -0
- package/dist/esm/fv/search-input/testing/fv-search-input.pageobject.js.map +1 -0
- package/dist/esm/fv/search-input/types.d.ts +7 -0
- package/dist/esm/fv/search-input/types.js +7 -0
- package/dist/esm/fv/search-input/types.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FvSearchInput } from '..';
|
|
2
|
+
/**
|
|
3
|
+
* Page object for the `ok-fv-search-input` component to provide consistent
|
|
4
|
+
* ways of querying and interacting with the component during tests.
|
|
5
|
+
*/
|
|
6
|
+
export declare class FvSearchInputPageObject {
|
|
7
|
+
protected readonly searchInputElement: FvSearchInput;
|
|
8
|
+
constructor(searchInputElement: FvSearchInput);
|
|
9
|
+
getInputValue(): string;
|
|
10
|
+
getPlaceholder(): string;
|
|
11
|
+
getInputAriaLabel(): string | null;
|
|
12
|
+
getInputAriaLabelledby(): string | null;
|
|
13
|
+
typeText(text: string): Promise<void>;
|
|
14
|
+
commitText(text: string): Promise<void>;
|
|
15
|
+
clickClearButton(): Promise<void>;
|
|
16
|
+
isClearButtonVisible(): boolean;
|
|
17
|
+
isInputDisabled(): boolean;
|
|
18
|
+
isInputReadOnly(): boolean;
|
|
19
|
+
isInputAutofocus(): boolean;
|
|
20
|
+
private getInput;
|
|
21
|
+
private getClearButton;
|
|
22
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { waitForUpdatesAsync } from '@ni/nimble-components/dist/esm/testing/async-helpers';
|
|
2
|
+
/**
|
|
3
|
+
* Page object for the `ok-fv-search-input` component to provide consistent
|
|
4
|
+
* ways of querying and interacting with the component during tests.
|
|
5
|
+
*/
|
|
6
|
+
export class FvSearchInputPageObject {
|
|
7
|
+
constructor(searchInputElement) {
|
|
8
|
+
this.searchInputElement = searchInputElement;
|
|
9
|
+
}
|
|
10
|
+
getInputValue() {
|
|
11
|
+
return this.getInput().value;
|
|
12
|
+
}
|
|
13
|
+
getPlaceholder() {
|
|
14
|
+
return this.getInput().placeholder;
|
|
15
|
+
}
|
|
16
|
+
getInputAriaLabel() {
|
|
17
|
+
return this.getInput().getAttribute('aria-label');
|
|
18
|
+
}
|
|
19
|
+
getInputAriaLabelledby() {
|
|
20
|
+
return this.getInput().getAttribute('aria-labelledby');
|
|
21
|
+
}
|
|
22
|
+
async typeText(text) {
|
|
23
|
+
const input = this.getInput();
|
|
24
|
+
input.value = text;
|
|
25
|
+
input.dispatchEvent(new Event('input', { bubbles: true, composed: true }));
|
|
26
|
+
await waitForUpdatesAsync();
|
|
27
|
+
}
|
|
28
|
+
async commitText(text) {
|
|
29
|
+
const input = this.getInput();
|
|
30
|
+
input.value = text;
|
|
31
|
+
input.dispatchEvent(new Event('change', { bubbles: true }));
|
|
32
|
+
await waitForUpdatesAsync();
|
|
33
|
+
}
|
|
34
|
+
async clickClearButton() {
|
|
35
|
+
const button = this.getClearButton();
|
|
36
|
+
if (!button) {
|
|
37
|
+
throw new Error('Clear button not found — is the search input value non-empty?');
|
|
38
|
+
}
|
|
39
|
+
button.click();
|
|
40
|
+
await waitForUpdatesAsync();
|
|
41
|
+
}
|
|
42
|
+
isClearButtonVisible() {
|
|
43
|
+
return !!this.searchInputElement.shadowRoot?.querySelector('.search-input-clear');
|
|
44
|
+
}
|
|
45
|
+
isInputDisabled() {
|
|
46
|
+
return this.getInput().disabled;
|
|
47
|
+
}
|
|
48
|
+
isInputReadOnly() {
|
|
49
|
+
return this.getInput().readOnly;
|
|
50
|
+
}
|
|
51
|
+
isInputAutofocus() {
|
|
52
|
+
return this.getInput().autofocus;
|
|
53
|
+
}
|
|
54
|
+
getInput() {
|
|
55
|
+
const input = this.searchInputElement.shadowRoot?.querySelector('.search-input');
|
|
56
|
+
if (!input) {
|
|
57
|
+
throw new Error('Search input element not found');
|
|
58
|
+
}
|
|
59
|
+
return input;
|
|
60
|
+
}
|
|
61
|
+
getClearButton() {
|
|
62
|
+
return this.searchInputElement.shadowRoot?.querySelector('.search-input-clear') ?? null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=fv-search-input.pageobject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fv-search-input.pageobject.js","sourceRoot":"","sources":["../../../../../src/fv/search-input/testing/fv-search-input.pageobject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAG3F;;;GAGG;AACH,MAAM,OAAO,uBAAuB;IAChC,YACuB,kBAAiC;QAAjC,uBAAkB,GAAlB,kBAAkB,CAAe;IACrD,CAAC;IAEG,aAAa;QAChB,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC;IACjC,CAAC;IAEM,cAAc;QACjB,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,WAAW,CA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Q,EAAE,CAAC,QAAQ,CAAC;IACpC,CAAC;IAEM,eAAe;QAClB,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;IACpC,CAAC;IAEM,gBAAgB;QACnB,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC;IACrC,CAAC;IAEO,QAAQ;QACZ,MAAM,KAAK,GAAG,IAAI,CAAC,kBAAkB,CAAC,UAAU,EAAE,aAAa,CAC3D,eAAe,CAClB,CAAC;QACF,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAEO,cAAc;QAClB,OAAO,IAAI,CAAC,kBAAkB,CAAC,UAAU,EAAE,aAAa,CACpD,qBAAqB,CACxB,IAAI,IAAI,CAAC;IACd,CAAC;CACJ","sourcesContent":["import { waitForUpdatesAsync } from '@ni/nimble-components/dist/esm/testing/async-helpers';\nimport type { FvSearchInput } from '..';\n\n/**\n * Page object for the `ok-fv-search-input` component to provide consistent\n * ways of querying and interacting with the component during tests.\n */\nexport class FvSearchInputPageObject {\n public constructor(\n protected readonly searchInputElement: FvSearchInput\n ) {}\n\n public getInputValue(): string {\n return this.getInput().value;\n }\n\n public getPlaceholder(): string {\n return this.getInput().placeholder;\n }\n\n public getInputAriaLabel(): string | null {\n return this.getInput().getAttribute('aria-label');\n }\n\n public getInputAriaLabelledby(): string | null {\n return this.getInput().getAttribute('aria-labelledby');\n }\n\n public async typeText(text: string): Promise<void> {\n const input = this.getInput();\n input.value = text;\n input.dispatchEvent(\n new Event('input', { bubbles: true, composed: true })\n );\n await waitForUpdatesAsync();\n }\n\n public async commitText(text: string): Promise<void> {\n const input = this.getInput();\n input.value = text;\n input.dispatchEvent(\n new Event('change', { bubbles: true })\n );\n await waitForUpdatesAsync();\n }\n\n public async clickClearButton(): Promise<void> {\n const button = this.getClearButton();\n if (!button) {\n throw new Error(\n 'Clear button not found — is the search input value non-empty?'\n );\n }\n button.click();\n await waitForUpdatesAsync();\n }\n\n public isClearButtonVisible(): boolean {\n return !!this.searchInputElement.shadowRoot?.querySelector(\n '.search-input-clear'\n );\n }\n\n public isInputDisabled(): boolean {\n return this.getInput().disabled;\n }\n\n public isInputReadOnly(): boolean {\n return this.getInput().readOnly;\n }\n\n public isInputAutofocus(): boolean {\n return this.getInput().autofocus;\n }\n\n private getInput(): HTMLInputElement {\n const input = this.searchInputElement.shadowRoot?.querySelector<HTMLInputElement>(\n '.search-input'\n );\n if (!input) {\n throw new Error('Search input element not found');\n }\n return input;\n }\n\n private getClearButton(): HTMLButtonElement | null {\n return this.searchInputElement.shadowRoot?.querySelector<HTMLButtonElement>(\n '.search-input-clear'\n ) ?? null;\n }\n}"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const FvSearchInputAppearance: {
|
|
2
|
+
readonly block: "block";
|
|
3
|
+
readonly outline: "outline";
|
|
4
|
+
readonly underline: "underline";
|
|
5
|
+
readonly frameless: "frameless";
|
|
6
|
+
};
|
|
7
|
+
export type FvSearchInputAppearance = (typeof FvSearchInputAppearance)[keyof typeof FvSearchInputAppearance];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/fv/search-input/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACnC,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;CAChB,CAAC","sourcesContent":["export const FvSearchInputAppearance = {\n block: 'block',\n outline: 'outline',\n underline: 'underline',\n frameless: 'frameless'\n} as const;\n\nexport type FvSearchInputAppearance = (typeof FvSearchInputAppearance)[keyof typeof FvSearchInputAppearance];"]}
|