@ongov/ontario-design-system-component-library 4.3.0 → 5.0.0-alpha.1
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/index-88d5cf20.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{ontario-accordion_43.cjs.entry.js → ontario-accordion_44.cjs.entry.js} +738 -296
- package/dist/cjs/ontario-accordion_44.cjs.entry.js.map +1 -0
- package/dist/cjs/ontario-design-system-components.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/ontario-card/ontario-card-types.js +29 -2
- package/dist/collection/components/ontario-card/ontario-card-types.js.map +1 -1
- package/dist/collection/components/ontario-card/ontario-card.css +257 -31
- package/dist/collection/components/ontario-card/ontario-card.js +104 -80
- package/dist/collection/components/ontario-card/ontario-card.js.map +1 -1
- package/dist/collection/components/ontario-card/test/ontario-cards.spec.js +23 -13
- package/dist/collection/components/ontario-card/test/ontario-cards.spec.js.map +1 -1
- package/dist/collection/components/ontario-header/ontario-header.js +17 -3
- package/dist/collection/components/ontario-header/ontario-header.js.map +1 -1
- package/dist/collection/components/ontario-header/service-ontario-header.css +0 -3
- package/dist/collection/components/ontario-header/test/ontario-header.spec.js +3 -3
- package/dist/collection/components/ontario-header/test/ontario-header.spec.js.map +1 -1
- package/dist/collection/components/ontario-language-toggle/ontario-language-toggle.js +193 -47
- package/dist/collection/components/ontario-language-toggle/ontario-language-toggle.js.map +1 -1
- package/dist/collection/components/ontario-language-toggle/test/ontario-language-toggle.spec.js +16 -3
- package/dist/collection/components/ontario-language-toggle/test/ontario-language-toggle.spec.js.map +1 -1
- package/dist/collection/components/ontario-search-box/assets/ontario-icon-close.svg +1 -0
- package/dist/collection/components/ontario-search-box/assets/ontario-logo--mobile.svg +6 -0
- package/dist/collection/components/ontario-search-box/ontario-search-box.css +823 -0
- package/dist/collection/components/ontario-search-box/ontario-search-box.js +584 -0
- package/dist/collection/components/ontario-search-box/ontario-search-box.js.map +1 -0
- package/dist/collection/components/ontario-search-box/test/ontario-search-box.e2e.js +20 -0
- package/dist/collection/components/ontario-search-box/test/ontario-search-box.e2e.js.map +1 -0
- package/dist/collection/components/ontario-search-box/test/ontario-search-box.spec.js +19 -0
- package/dist/collection/components/ontario-search-box/test/ontario-search-box.spec.js.map +1 -0
- package/dist/collection/components/ontario-step-indicator/ontario-step-indicator.js +5 -5
- package/dist/collection/components/ontario-table/ontario-table.js +5 -5
- package/dist/collection/components/ontario-textarea/ontario-textarea.js +3 -3
- package/dist/collection/i18n/global.i18n.json +172 -162
- package/dist/collection/utils/common/input/input.js +3 -0
- package/dist/collection/utils/common/input/input.js.map +1 -1
- package/dist/collection/utils/common/input-caption/input-caption.js +5 -3
- package/dist/collection/utils/common/input-caption/input-caption.js.map +1 -1
- package/dist/collection/utils/common/language-types.js +1 -1
- package/dist/collection/utils/common/language-types.js.map +1 -1
- package/dist/collection/utils/helper/utils-types.js +2 -0
- package/dist/collection/utils/helper/utils-types.js.map +1 -0
- package/dist/collection/utils/helper/utils.js +26 -0
- package/dist/collection/utils/helper/utils.js.map +1 -1
- package/dist/components/error-message.js +1 -324
- package/dist/components/error-message.js.map +1 -1
- package/dist/components/event-handler.js +330 -0
- package/dist/components/event-handler.js.map +1 -0
- package/dist/components/global.i18n.js +184 -173
- package/dist/components/global.i18n.js.map +1 -1
- package/dist/components/input.js +3 -0
- package/dist/components/input.js.map +1 -1
- package/dist/components/ontario-card.js +118 -66
- package/dist/components/ontario-card.js.map +1 -1
- package/dist/components/ontario-checkboxes.js +2 -1
- package/dist/components/ontario-checkboxes.js.map +1 -1
- package/dist/components/ontario-date-input.js +2 -1
- package/dist/components/ontario-date-input.js.map +1 -1
- package/dist/components/ontario-dropdown-list.js +2 -1
- package/dist/components/ontario-dropdown-list.js.map +1 -1
- package/dist/components/ontario-header.js +13 -7
- package/dist/components/ontario-header.js.map +1 -1
- package/dist/components/ontario-icon-search2.js +6 -0
- package/dist/components/ontario-icon-search2.js.map +1 -0
- package/dist/components/ontario-input.js +2 -1
- package/dist/components/ontario-input.js.map +1 -1
- package/dist/components/ontario-language-toggle2.js +180 -37
- package/dist/components/ontario-language-toggle2.js.map +1 -1
- package/dist/components/ontario-radio-buttons.js +2 -1
- package/dist/components/ontario-radio-buttons.js.map +1 -1
- package/dist/components/ontario-search-box.d.ts +11 -0
- package/dist/components/ontario-search-box.js +269 -0
- package/dist/components/ontario-search-box.js.map +1 -0
- package/dist/components/ontario-step-indicator.js +5 -5
- package/dist/components/ontario-table.js +5 -5
- package/dist/components/ontario-textarea.js +5 -4
- package/dist/components/ontario-textarea.js.map +1 -1
- package/dist/components/utils.js +28 -0
- package/dist/components/utils.js.map +1 -1
- package/dist/esm/index-603026f7.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{ontario-accordion_43.entry.js → ontario-accordion_44.entry.js} +738 -296
- package/dist/esm/ontario-accordion_44.entry.js.map +1 -0
- package/dist/esm/ontario-design-system-components.js +1 -1
- package/dist/ontario-design-system-components/i18n/global.i18n.json +172 -162
- package/dist/ontario-design-system-components/ontario-design-system-components.esm.js +1 -1
- package/dist/ontario-design-system-components/ontario-design-system-components.esm.js.map +1 -1
- package/dist/ontario-design-system-components/{p-cff41424.entry.js → p-9c3a1be9.entry.js} +2204 -1918
- package/dist/ontario-design-system-components/p-9c3a1be9.entry.js.map +1 -0
- package/dist/types/components/ontario-card/ontario-card-types.d.ts +4 -4
- package/dist/types/components/ontario-card/ontario-card.d.ts +40 -29
- package/dist/types/components/ontario-header/ontario-header.d.ts +13 -2
- package/dist/types/components/ontario-language-toggle/ontario-language-toggle.d.ts +75 -8
- package/dist/types/components/ontario-search-box/ontario-search-box.d.ts +180 -0
- package/dist/types/components.d.ts +211 -22
- package/dist/types/utils/common/input/input.d.ts +2 -1
- package/dist/types/utils/common/input-caption/input-caption.d.ts +7 -1
- package/dist/types/utils/common/language-types.d.ts +2 -1
- package/dist/types/utils/helper/utils-types.d.ts +2 -0
- package/dist/types/utils/helper/utils.d.ts +21 -0
- package/package.json +3 -3
- package/src/components/ontario-card/ontario-card-types.tsx +33 -4
- package/src/components/ontario-card/ontario-card.scss +59 -38
- package/src/components/ontario-card/ontario-card.tsx +98 -70
- package/src/components/ontario-card/readme.md +57 -27
- package/src/components/ontario-card/test/__snapshots__/ontario-cards.spec.tsx.snap +66 -0
- package/src/components/ontario-card/test/ontario-cards.spec.tsx +27 -13
- package/src/components/ontario-card-collection/readme.md +13 -13
- package/src/components/ontario-checkbox/ontario-checkboxes.scss +0 -1
- package/src/components/ontario-header/ontario-header.tsx +13 -4
- package/src/components/ontario-header/service-ontario-header.scss +0 -4
- package/src/components/ontario-header/test/ontario-header.spec.tsx +3 -3
- package/src/components/ontario-hint-text/readme.md +2 -0
- package/src/components/ontario-language-toggle/ontario-language-toggle.tsx +192 -45
- package/src/components/ontario-language-toggle/readme.md +10 -10
- package/src/components/ontario-language-toggle/test/__snapshots__/ontario-language-toggle.spec.tsx.snap +1 -1
- package/src/components/ontario-language-toggle/test/ontario-language-toggle.spec.tsx +17 -3
- package/src/components/ontario-radio-buttons/ontario-radio-buttons.scss +0 -1
- package/src/components/ontario-search-box/assets/ontario-icon-close.svg +1 -0
- package/src/components/ontario-search-box/assets/ontario-logo--mobile.svg +6 -0
- package/src/components/ontario-search-box/ontario-search-box.scss +141 -0
- package/src/components/ontario-search-box/ontario-search-box.tsx +341 -0
- package/src/components/ontario-search-box/readme.md +132 -0
- package/src/components/ontario-search-box/test/__snapshots__/ontario-search-box.spec.tsx.snap +35 -0
- package/src/components/ontario-search-box/test/ontario-search-box.e2e.ts +21 -0
- package/src/components/ontario-search-box/test/ontario-search-box.spec.tsx +22 -0
- package/src/components.d.ts +211 -22
- package/src/french.html +37 -0
- package/src/index.html +292 -38
- package/src/translations/global.i18n.json +172 -162
- package/src/utils/common/input/input.tsx +4 -1
- package/src/utils/common/input-caption/input-caption.tsx +9 -3
- package/src/utils/common/language-types.ts +2 -1
- package/src/utils/helper/utils-types.ts +2 -0
- package/src/utils/helper/utils.ts +30 -0
- package/www/build/ontario-design-system-components.esm.js +1 -1
- package/www/build/ontario-design-system-components.esm.js.map +1 -1
- package/www/build/{p-b61db0f6.js → p-84035ac3.js} +1 -1
- package/www/build/{p-cff41424.entry.js → p-9c3a1be9.entry.js} +2204 -1918
- package/www/build/p-9c3a1be9.entry.js.map +1 -0
- package/www/french.html +37 -0
- package/www/i18n/global.i18n.json +172 -162
- package/www/index.html +266 -38
- package/dist/cjs/ontario-accordion_43.cjs.entry.js.map +0 -1
- package/dist/esm/ontario-accordion_43.entry.js.map +0 -1
- package/dist/ontario-design-system-components/p-cff41424.entry.js.map +0 -1
- package/www/build/p-cff41424.entry.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const HeaderTypes: readonly ['default', 'light', 'dark'];
|
|
1
|
+
export declare const Layouts: readonly ['vertical', 'horizontal'];
|
|
3
2
|
export declare const HorizontalImagePositionTypes: readonly ['left', 'right'];
|
|
4
3
|
export declare const HorizontalImageSizeTypes: readonly ['one-fourth', 'one-third'];
|
|
5
|
-
export type
|
|
6
|
-
export type HeaderType = (typeof HeaderTypes)[number];
|
|
4
|
+
export type Layout = (typeof Layouts)[number];
|
|
7
5
|
export type HorizontalImagePositionType = (typeof HorizontalImagePositionTypes)[number];
|
|
8
6
|
export type HorizontalImageSizeType = (typeof HorizontalImageSizeTypes)[number];
|
|
7
|
+
export declare const HeaderColours: string[];
|
|
8
|
+
export type HeaderColour = (typeof HeaderColours)[number];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HeaderColour, HorizontalImagePositionType, HorizontalImageSizeType, Layout } from './ontario-card-types';
|
|
2
2
|
export declare class OntarioCard {
|
|
3
3
|
host: HTMLElement;
|
|
4
4
|
/**
|
|
@@ -32,18 +32,18 @@ export declare class OntarioCard {
|
|
|
32
32
|
*/
|
|
33
33
|
cardLink?: string;
|
|
34
34
|
/**
|
|
35
|
-
* The
|
|
35
|
+
* The layout oritnetation of the card.
|
|
36
36
|
*
|
|
37
|
-
* If no type is passed, it will default to '
|
|
37
|
+
* If no type is passed, it will default to 'vertical'.
|
|
38
38
|
*
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
layout?: Layout;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Set the card's header colour.
|
|
43
43
|
*
|
|
44
|
-
*
|
|
44
|
+
* This is optional.
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
headerColour?: HeaderColour;
|
|
47
47
|
/**
|
|
48
48
|
* The position of the image when the card-type is set to 'horizontal'.
|
|
49
49
|
*
|
|
@@ -87,43 +87,54 @@ export declare class OntarioCard {
|
|
|
87
87
|
ariaLabelText?: string;
|
|
88
88
|
/**
|
|
89
89
|
* Mutable variable, for internal use only.
|
|
90
|
-
* Set the card's
|
|
90
|
+
* Set the card's layout depending on validation result.
|
|
91
91
|
*/
|
|
92
|
-
private
|
|
92
|
+
private layoutState;
|
|
93
93
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
94
|
+
* Watch for changes to the `layout` property for validation purposes.
|
|
95
|
+
*
|
|
96
|
+
* If the user input doesn't match one of the array values then `layout` will be set to its default (`vertical`).
|
|
97
|
+
* If a match is found in one of the array values then `layoutState` will be set to the matching array key value.
|
|
96
98
|
*/
|
|
97
|
-
|
|
99
|
+
validateLayout(): void;
|
|
98
100
|
/**
|
|
99
|
-
* Watch for changes to the `
|
|
101
|
+
* Watch for changes to the `headerColour` property for validation purposes.
|
|
100
102
|
*
|
|
101
|
-
* If the user input doesn't match one of the array values then `
|
|
102
|
-
* If a match is found in one of the array values then `
|
|
103
|
+
* If the user input doesn't match one of the array values then `headerColour` will be kept empty ('').
|
|
104
|
+
* If a match is found in one of the array values then `headerColour` will be set to the matching array key value.
|
|
103
105
|
*/
|
|
104
|
-
|
|
106
|
+
validateHeaderColour(): void;
|
|
105
107
|
/**
|
|
106
|
-
*
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
* Print the invalid `layout` prop warning message.
|
|
109
|
+
*/
|
|
110
|
+
private warnDefaultLayout;
|
|
111
|
+
/**
|
|
112
|
+
* Print the invalid `headerColour` prop warning message.
|
|
110
113
|
*/
|
|
111
|
-
|
|
114
|
+
private warnDefaultHeaderColour;
|
|
112
115
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
116
|
+
* Returns the top level classes of the card.
|
|
117
|
+
*
|
|
118
|
+
* @returns {string}
|
|
115
119
|
*/
|
|
116
|
-
private
|
|
120
|
+
private getCardClasses;
|
|
117
121
|
/**
|
|
118
|
-
*
|
|
119
|
-
*
|
|
122
|
+
* Returns the heading classes of the card.
|
|
123
|
+
*
|
|
124
|
+
* @returns {string}
|
|
120
125
|
*/
|
|
121
|
-
private
|
|
126
|
+
private getCardHeadingClasses;
|
|
122
127
|
/**
|
|
123
|
-
*
|
|
128
|
+
* Returns the url that the card links to.
|
|
129
|
+
*
|
|
130
|
+
* @returns {string}
|
|
124
131
|
*/
|
|
125
|
-
private getClass;
|
|
126
132
|
private getHref;
|
|
133
|
+
/**
|
|
134
|
+
* Component life cycle hook.
|
|
135
|
+
*
|
|
136
|
+
* https://stenciljs.com/docs/component-lifecycle#connectedcallback
|
|
137
|
+
*/
|
|
127
138
|
componentWillLoad(): void;
|
|
128
139
|
render(): any;
|
|
129
140
|
}
|
|
@@ -153,9 +153,20 @@ export declare class OntarioHeader {
|
|
|
153
153
|
*/
|
|
154
154
|
handleClick(event: any): void;
|
|
155
155
|
/**
|
|
156
|
-
* This listens for the `setAppLanguage` event sent from the
|
|
156
|
+
* This listens for the `setAppLanguage` event sent from the language toggle when it is is connected to the DOM.
|
|
157
|
+
* It is used for the initial language when the input component loads.
|
|
157
158
|
*/
|
|
158
|
-
handleSetAppLanguage(event: CustomEvent<Language>): void;
|
|
159
|
+
handleSetAppLanguage(event: CustomEvent<Language> | Language): void;
|
|
160
|
+
/**
|
|
161
|
+
* This listens for the `headerLanguageToggled` event sent from the language toggle when it is is connected to the DOM.
|
|
162
|
+
* It is used for changing the component language after the language toggle has been activated.
|
|
163
|
+
*/
|
|
164
|
+
handleLanguageToggle(
|
|
165
|
+
event: CustomEvent<{
|
|
166
|
+
oldLanguage: Language;
|
|
167
|
+
newLanguage: Language;
|
|
168
|
+
}>,
|
|
169
|
+
): void;
|
|
159
170
|
/**
|
|
160
171
|
* Logic to handle the menu toggling
|
|
161
172
|
*/
|
|
@@ -2,7 +2,14 @@ import { EventEmitter } from '../../stencil-public-runtime';
|
|
|
2
2
|
import { Language } from '../../utils/common/language-types';
|
|
3
3
|
import { HeaderLanguageToggleEventDetails } from '../../utils/events/common-events.interface';
|
|
4
4
|
export declare class OntarioLanguageToggle {
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The language of the component.
|
|
7
|
+
*
|
|
8
|
+
* In most cases, the language toggle should be the source of truth for determining the site language.
|
|
9
|
+
*
|
|
10
|
+
* Only pass a language value here if necessary.
|
|
11
|
+
*/
|
|
12
|
+
language?: Language;
|
|
6
13
|
/**
|
|
7
14
|
* The size of the language toggle button.
|
|
8
15
|
*
|
|
@@ -23,17 +30,77 @@ export declare class OntarioLanguageToggle {
|
|
|
23
30
|
customLanguageToggle?: (event: globalThis.Event) => void;
|
|
24
31
|
translations: any;
|
|
25
32
|
/**
|
|
26
|
-
*
|
|
33
|
+
* Internal state used as the source of truth for component language.
|
|
27
34
|
*/
|
|
28
|
-
|
|
29
|
-
setAppLanguageHandler(): void;
|
|
35
|
+
private languageState;
|
|
30
36
|
/**
|
|
31
|
-
*
|
|
37
|
+
* Internal state used to render the text on the language toggle UI.
|
|
38
|
+
*/
|
|
39
|
+
private oppositeLanguageLabel;
|
|
40
|
+
/**
|
|
41
|
+
* Updates the language and languageState props when changes to the language prop are detected.
|
|
32
42
|
*/
|
|
33
|
-
headerLanguageToggled: EventEmitter<HeaderLanguageToggleEventDetails>;
|
|
34
|
-
handleHeaderLanguageToggled(language: string, event?: globalThis.Event): void;
|
|
35
43
|
updateLanguage(): void;
|
|
36
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Event that fires during the setAppLanguageHandler() method.
|
|
46
|
+
*
|
|
47
|
+
* The event contains the current language (after language logic has already occurred).
|
|
48
|
+
*/
|
|
49
|
+
setAppLanguage: EventEmitter<Language>;
|
|
50
|
+
/**
|
|
51
|
+
* Event that fires when the language toggle is pressed/clicked.
|
|
52
|
+
*
|
|
53
|
+
* The event contains the oldLanguage along with the newLanguage.
|
|
54
|
+
*/
|
|
55
|
+
headerLanguageToggled: EventEmitter<HeaderLanguageToggleEventDetails>;
|
|
56
|
+
/**
|
|
57
|
+
* This function sets the languageState (if not already set).
|
|
58
|
+
*
|
|
59
|
+
* It also emits the setAppLanguage() event, updates the component language label, and
|
|
60
|
+
* updates the <html> tag lang attribute with the languageState value.
|
|
61
|
+
*
|
|
62
|
+
* It gets called by the connectedCallback() component lifecycle hook, and by the
|
|
63
|
+
* updateLanguage() method, which is fired on the watch for the language prop.
|
|
64
|
+
*/
|
|
65
|
+
private setAppLanguageHandler;
|
|
66
|
+
/**
|
|
67
|
+
* An event that emits to other components that the language toggle button has been toggled.
|
|
68
|
+
*
|
|
69
|
+
* @param {Language} oldLanguage - The language prior to the language toggle being pressed.
|
|
70
|
+
* @param {globalThis.Event} event - event that triggered the function (e.g. onclick).
|
|
71
|
+
*/
|
|
72
|
+
private handleHeaderLanguageToggled;
|
|
73
|
+
/**
|
|
74
|
+
* Prints a warning message to the console about using an incorrect language for the component.
|
|
75
|
+
*
|
|
76
|
+
* @param {string} lang - The incorrect language that was received.
|
|
77
|
+
* @param {string} type - prop/document | Where the incorrect language is coming from.
|
|
78
|
+
*/
|
|
79
|
+
private showLanguageWarning;
|
|
80
|
+
/**
|
|
81
|
+
* Returns abbreviated text for the opposite language.
|
|
82
|
+
*
|
|
83
|
+
* @returns {Language}
|
|
84
|
+
*/
|
|
85
|
+
private getOppositeLanguageAbbrievation;
|
|
86
|
+
/**
|
|
87
|
+
* Returns full word text for the opposite language.
|
|
88
|
+
*
|
|
89
|
+
* @returns {string}
|
|
90
|
+
*/
|
|
91
|
+
private getOppositeLanguageFullWord;
|
|
92
|
+
private updateHTMLLang;
|
|
93
|
+
/**
|
|
94
|
+
* Component life cycle hook.
|
|
95
|
+
*
|
|
96
|
+
* https://stenciljs.com/docs/component-lifecycle#connectedcallback
|
|
97
|
+
*/
|
|
37
98
|
connectedCallback(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Component life cycle hook.
|
|
101
|
+
*
|
|
102
|
+
* https://stenciljs.com/docs/component-lifecycle#componentdidload
|
|
103
|
+
*/
|
|
104
|
+
componentDidLoad(): void;
|
|
38
105
|
render(): any;
|
|
39
106
|
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
import { Language } from '../../utils/common/language-types';
|
|
3
|
+
import { Hint } from '../../utils/common/common.interface';
|
|
4
|
+
import {
|
|
5
|
+
InputFocusBlurEvent,
|
|
6
|
+
InputInteractionEvent,
|
|
7
|
+
InputInputEvent,
|
|
8
|
+
} from '../../utils/events/event-handler.interface';
|
|
9
|
+
import { Caption } from '../../utils/common/input-caption/caption.interface';
|
|
10
|
+
export declare class OntarioSearchBox {
|
|
11
|
+
element: HTMLElement;
|
|
12
|
+
internals: ElementInternals;
|
|
13
|
+
/**
|
|
14
|
+
* This Ref is used get a direct reference to the hint text element
|
|
15
|
+
*/
|
|
16
|
+
private hintTextRef?;
|
|
17
|
+
/**
|
|
18
|
+
* This Ref is used get a direct reference to the search input element
|
|
19
|
+
*/
|
|
20
|
+
private inputFieldRef?;
|
|
21
|
+
/**
|
|
22
|
+
* The language of the component.
|
|
23
|
+
* This is used for translations. If none is passed, it will default to English.
|
|
24
|
+
*/
|
|
25
|
+
language?: Language;
|
|
26
|
+
/**
|
|
27
|
+
* The unique identifier of the search-box component. This is optional - if no ID is passed, one will be generated.
|
|
28
|
+
*/
|
|
29
|
+
elementId?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The value of the search term.
|
|
32
|
+
* This is optional.
|
|
33
|
+
*/
|
|
34
|
+
value?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The text to display as the input label
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* <ontario-search-box
|
|
40
|
+
* caption='{
|
|
41
|
+
"captionText": "Search directory",
|
|
42
|
+
"captionType": "default"
|
|
43
|
+
}'
|
|
44
|
+
required = "true"
|
|
45
|
+
>
|
|
46
|
+
</ontario-search-box>
|
|
47
|
+
*/
|
|
48
|
+
caption: Caption | string;
|
|
49
|
+
/**
|
|
50
|
+
* This is used to determine whether the dropdown list is required or not.
|
|
51
|
+
* This prop gets passed to the InputCaption utility to display either an optional or required flag in the label.
|
|
52
|
+
* If no prop is set, it will default to false (optional).
|
|
53
|
+
*/
|
|
54
|
+
required?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* This Function to perform a search operation.
|
|
57
|
+
* This function will be called when the search submit button is triggered.
|
|
58
|
+
* The value argument is used for as search term to use for the search operation. This parameter is optional.
|
|
59
|
+
* The performSearch prop can be set dynamically using JavaScript, allowing you to define custom search functionality when the search form is submitted.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* <ontario-search-box
|
|
63
|
+
* id="ontario-search-box"
|
|
64
|
+
* caption='Search directory'
|
|
65
|
+
* ></ontario-search-box>
|
|
66
|
+
*
|
|
67
|
+
* <script>
|
|
68
|
+
* window.addEventListener('load', () => {
|
|
69
|
+
* const searchBox = document.getElementById('ontario-search-box');
|
|
70
|
+
* searchBox.performSearch = async (value) => {
|
|
71
|
+
* console.log('Performing search with value:', value);
|
|
72
|
+
* };
|
|
73
|
+
* });
|
|
74
|
+
* </script>
|
|
75
|
+
*/
|
|
76
|
+
performSearch?: (value?: string) => Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Used to include the ontario-hint-text component for the search-box.
|
|
79
|
+
* This is optional.
|
|
80
|
+
*/
|
|
81
|
+
hintText?: string | Hint;
|
|
82
|
+
/**
|
|
83
|
+
* Used to add a custom function to the input onInput event.
|
|
84
|
+
*/
|
|
85
|
+
customOnInput?: (event: globalThis.Event) => void;
|
|
86
|
+
/**
|
|
87
|
+
* Used to add a custom function to the input onChange event.
|
|
88
|
+
*/
|
|
89
|
+
customOnChange?: (event: globalThis.Event) => void;
|
|
90
|
+
/**
|
|
91
|
+
* Used to add a custom function to the input onBlur event.
|
|
92
|
+
*/
|
|
93
|
+
customOnBlur?: (event: globalThis.Event) => void;
|
|
94
|
+
/**
|
|
95
|
+
* Used to add a custom function to the input onFocus event.
|
|
96
|
+
*/
|
|
97
|
+
customOnFocus?: (event: globalThis.Event) => void;
|
|
98
|
+
/**
|
|
99
|
+
* Emitted when the search is submitted.
|
|
100
|
+
* Below is an example on how to hook into the event to get the event details.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* <script>
|
|
104
|
+
* document.getElementById('ontario-search-box').addEventListener('searchOnSubmit', (event) => {
|
|
105
|
+
* const searchValue = event.detail;
|
|
106
|
+
* console.log('Search submitted with value:', searchValue);
|
|
107
|
+
* };
|
|
108
|
+
* </script>
|
|
109
|
+
*/
|
|
110
|
+
searchOnSubmit: EventEmitter<string>;
|
|
111
|
+
/**
|
|
112
|
+
* Emitted when a input occurs when an input has been changed.
|
|
113
|
+
*/
|
|
114
|
+
inputOnInput: EventEmitter<InputInputEvent>;
|
|
115
|
+
/**
|
|
116
|
+
* Emitted when a keyboard input or mouse event occurs when an input has been changed.
|
|
117
|
+
*/
|
|
118
|
+
inputOnChange: EventEmitter<InputInteractionEvent>;
|
|
119
|
+
/**
|
|
120
|
+
* Emitted when a keyboard input event occurs when an input has lost focus.
|
|
121
|
+
*/
|
|
122
|
+
inputOnBlur: EventEmitter<InputFocusBlurEvent>;
|
|
123
|
+
/**
|
|
124
|
+
* Emitted when a keyboard input event occurs when an input has gained focus.
|
|
125
|
+
*/
|
|
126
|
+
inputOnFocus: EventEmitter<InputFocusBlurEvent>;
|
|
127
|
+
/**
|
|
128
|
+
* The hint text options are re-assigned to the internalHintText array.
|
|
129
|
+
*/
|
|
130
|
+
private internalHintText;
|
|
131
|
+
/**
|
|
132
|
+
* Instantiate an InputCaption object for internal logic use
|
|
133
|
+
*/
|
|
134
|
+
private captionState;
|
|
135
|
+
/**
|
|
136
|
+
* Used for the `aria-describedby` value of the dropdown list. This will match with the id of the hint text.
|
|
137
|
+
*/
|
|
138
|
+
hintTextId: string | null | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* Watch for changes to the `hintText` prop.
|
|
141
|
+
*
|
|
142
|
+
* If a `hintText` prop is passed, the `constructHintTextObject` function will convert it to the correct format, and set the result to the `internalHintText` state.
|
|
143
|
+
*/
|
|
144
|
+
private parseHintText;
|
|
145
|
+
/**
|
|
146
|
+
* Watch for changes to the `caption` prop.
|
|
147
|
+
*
|
|
148
|
+
* The caption will be run through the InputCaption constructor to convert it to the correct format, and set the result to the `captionState` state.
|
|
149
|
+
* @param newValue: Caption | string
|
|
150
|
+
*/
|
|
151
|
+
private updateCaptionState;
|
|
152
|
+
/**
|
|
153
|
+
* Watch for changes to the `language` prop to render either the English or French translations
|
|
154
|
+
*/
|
|
155
|
+
updateLanguage(): void;
|
|
156
|
+
/**
|
|
157
|
+
* If a `hintText` prop is passed, the id generated from it will be set to the internal `hintTextId` state to match with the select `aria-describedBy` attribute.
|
|
158
|
+
*/
|
|
159
|
+
componentDidLoad(): Promise<void>;
|
|
160
|
+
componentWillLoad(): void;
|
|
161
|
+
/**
|
|
162
|
+
* Function to handle input events and the information pertaining to the input to emit.
|
|
163
|
+
*/
|
|
164
|
+
private handleEvent;
|
|
165
|
+
/**
|
|
166
|
+
* handleSearch function is called when the search submit button is clicked
|
|
167
|
+
*/
|
|
168
|
+
handleSearch(event: MouseEvent): Promise<void>;
|
|
169
|
+
getId(): string;
|
|
170
|
+
private getValue;
|
|
171
|
+
/**
|
|
172
|
+
*This function ensures that the focus returns to the search input field when the reset button is clicked.
|
|
173
|
+
*/
|
|
174
|
+
private setFocus;
|
|
175
|
+
/**
|
|
176
|
+
* when the reset button is clicked this function gets called
|
|
177
|
+
*/
|
|
178
|
+
handleFocus: () => void;
|
|
179
|
+
render(): any;
|
|
180
|
+
}
|