@ongov/ontario-design-system-component-library 4.3.1-alpha.1 → 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.
Files changed (108) hide show
  1. package/dist/cjs/index-88d5cf20.js +2 -2
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/{ontario-accordion_43.cjs.entry.js → ontario-accordion_44.cjs.entry.js} +339 -78
  4. package/dist/cjs/ontario-accordion_44.cjs.entry.js.map +1 -0
  5. package/dist/cjs/ontario-design-system-components.cjs.js +1 -1
  6. package/dist/collection/collection-manifest.json +1 -0
  7. package/dist/collection/components/ontario-card/ontario-card-types.js +29 -2
  8. package/dist/collection/components/ontario-card/ontario-card-types.js.map +1 -1
  9. package/dist/collection/components/ontario-card/ontario-card.css +252 -34
  10. package/dist/collection/components/ontario-card/ontario-card.js +102 -78
  11. package/dist/collection/components/ontario-card/ontario-card.js.map +1 -1
  12. package/dist/collection/components/ontario-card/test/ontario-cards.spec.js +23 -13
  13. package/dist/collection/components/ontario-card/test/ontario-cards.spec.js.map +1 -1
  14. package/dist/collection/components/ontario-header/service-ontario-header.css +0 -3
  15. package/dist/collection/components/ontario-search-box/assets/ontario-icon-close.svg +1 -0
  16. package/dist/collection/components/ontario-search-box/assets/ontario-logo--mobile.svg +6 -0
  17. package/dist/collection/components/ontario-search-box/ontario-search-box.css +823 -0
  18. package/dist/collection/components/ontario-search-box/ontario-search-box.js +584 -0
  19. package/dist/collection/components/ontario-search-box/ontario-search-box.js.map +1 -0
  20. package/dist/collection/components/ontario-search-box/test/ontario-search-box.e2e.js +20 -0
  21. package/dist/collection/components/ontario-search-box/test/ontario-search-box.e2e.js.map +1 -0
  22. package/dist/collection/components/ontario-search-box/test/ontario-search-box.spec.js +19 -0
  23. package/dist/collection/components/ontario-search-box/test/ontario-search-box.spec.js.map +1 -0
  24. package/dist/collection/components/ontario-step-indicator/ontario-step-indicator.js +5 -5
  25. package/dist/collection/components/ontario-table/ontario-table.js +5 -5
  26. package/dist/collection/components/ontario-textarea/ontario-textarea.js +3 -3
  27. package/dist/collection/utils/common/input/input.js +3 -0
  28. package/dist/collection/utils/common/input/input.js.map +1 -1
  29. package/dist/collection/utils/common/input-caption/input-caption.js +5 -3
  30. package/dist/collection/utils/common/input-caption/input-caption.js.map +1 -1
  31. package/dist/components/error-message.js +1 -324
  32. package/dist/components/error-message.js.map +1 -1
  33. package/dist/components/event-handler.js +330 -0
  34. package/dist/components/event-handler.js.map +1 -0
  35. package/dist/components/input.js +3 -0
  36. package/dist/components/input.js.map +1 -1
  37. package/dist/components/ontario-card.js +116 -64
  38. package/dist/components/ontario-card.js.map +1 -1
  39. package/dist/components/ontario-checkboxes.js +2 -1
  40. package/dist/components/ontario-checkboxes.js.map +1 -1
  41. package/dist/components/ontario-date-input.js +2 -1
  42. package/dist/components/ontario-date-input.js.map +1 -1
  43. package/dist/components/ontario-dropdown-list.js +2 -1
  44. package/dist/components/ontario-dropdown-list.js.map +1 -1
  45. package/dist/components/ontario-header.js +2 -4
  46. package/dist/components/ontario-header.js.map +1 -1
  47. package/dist/components/ontario-icon-search2.js +6 -0
  48. package/dist/components/ontario-icon-search2.js.map +1 -0
  49. package/dist/components/ontario-input.js +2 -1
  50. package/dist/components/ontario-input.js.map +1 -1
  51. package/dist/components/ontario-radio-buttons.js +2 -1
  52. package/dist/components/ontario-radio-buttons.js.map +1 -1
  53. package/dist/components/ontario-search-box.d.ts +11 -0
  54. package/dist/components/ontario-search-box.js +269 -0
  55. package/dist/components/ontario-search-box.js.map +1 -0
  56. package/dist/components/ontario-step-indicator.js +5 -5
  57. package/dist/components/ontario-table.js +5 -5
  58. package/dist/components/ontario-textarea.js +5 -4
  59. package/dist/components/ontario-textarea.js.map +1 -1
  60. package/dist/esm/index-603026f7.js +2 -2
  61. package/dist/esm/loader.js +1 -1
  62. package/dist/esm/{ontario-accordion_43.entry.js → ontario-accordion_44.entry.js} +339 -78
  63. package/dist/esm/ontario-accordion_44.entry.js.map +1 -0
  64. package/dist/esm/ontario-design-system-components.js +1 -1
  65. package/dist/ontario-design-system-components/ontario-design-system-components.esm.js +1 -1
  66. package/dist/ontario-design-system-components/ontario-design-system-components.esm.js.map +1 -1
  67. package/dist/ontario-design-system-components/{p-abe58ec9.entry.js → p-9c3a1be9.entry.js} +1925 -1728
  68. package/dist/ontario-design-system-components/p-9c3a1be9.entry.js.map +1 -0
  69. package/dist/types/components/ontario-card/ontario-card-types.d.ts +4 -4
  70. package/dist/types/components/ontario-card/ontario-card.d.ts +40 -29
  71. package/dist/types/components/ontario-search-box/ontario-search-box.d.ts +180 -0
  72. package/dist/types/components.d.ts +199 -16
  73. package/dist/types/utils/common/input/input.d.ts +2 -1
  74. package/dist/types/utils/common/input-caption/input-caption.d.ts +7 -1
  75. package/package.json +2 -2
  76. package/src/components/ontario-card/ontario-card-types.tsx +33 -4
  77. package/src/components/ontario-card/ontario-card.scss +54 -40
  78. package/src/components/ontario-card/ontario-card.tsx +94 -68
  79. package/src/components/ontario-card/readme.md +57 -27
  80. package/src/components/ontario-card/test/__snapshots__/ontario-cards.spec.tsx.snap +66 -0
  81. package/src/components/ontario-card/test/ontario-cards.spec.tsx +27 -13
  82. package/src/components/ontario-card-collection/readme.md +13 -13
  83. package/src/components/ontario-checkbox/ontario-checkboxes.scss +0 -1
  84. package/src/components/ontario-header/service-ontario-header.scss +0 -4
  85. package/src/components/ontario-hint-text/readme.md +2 -0
  86. package/src/components/ontario-radio-buttons/ontario-radio-buttons.scss +0 -1
  87. package/src/components/ontario-search-box/assets/ontario-icon-close.svg +1 -0
  88. package/src/components/ontario-search-box/assets/ontario-logo--mobile.svg +6 -0
  89. package/src/components/ontario-search-box/ontario-search-box.scss +141 -0
  90. package/src/components/ontario-search-box/ontario-search-box.tsx +341 -0
  91. package/src/components/ontario-search-box/readme.md +132 -0
  92. package/src/components/ontario-search-box/test/__snapshots__/ontario-search-box.spec.tsx.snap +35 -0
  93. package/src/components/ontario-search-box/test/ontario-search-box.e2e.ts +21 -0
  94. package/src/components/ontario-search-box/test/ontario-search-box.spec.tsx +22 -0
  95. package/src/components.d.ts +199 -16
  96. package/src/index.html +287 -52
  97. package/src/utils/common/input/input.tsx +4 -1
  98. package/src/utils/common/input-caption/input-caption.tsx +9 -3
  99. package/www/build/ontario-design-system-components.esm.js +1 -1
  100. package/www/build/ontario-design-system-components.esm.js.map +1 -1
  101. package/www/build/{p-fdc9ab6d.js → p-84035ac3.js} +1 -1
  102. package/www/build/{p-abe58ec9.entry.js → p-9c3a1be9.entry.js} +1925 -1728
  103. package/www/build/p-9c3a1be9.entry.js.map +1 -0
  104. package/www/index.html +261 -52
  105. package/dist/cjs/ontario-accordion_43.cjs.entry.js.map +0 -1
  106. package/dist/esm/ontario-accordion_43.entry.js.map +0 -1
  107. package/dist/ontario-design-system-components/p-abe58ec9.entry.js.map +0 -1
  108. package/www/build/p-abe58ec9.entry.js.map +0 -1
@@ -1,8 +1,8 @@
1
- export declare const CardTypes: readonly ['basic', 'image', 'title', 'horizontal'];
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 CardType = (typeof CardTypes)[number];
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 { CardType, HeaderType, HorizontalImagePositionType, HorizontalImageSizeType } from './ontario-card-types';
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 type of card to render.
35
+ * The layout oritnetation of the card.
36
36
  *
37
- * If no type is passed, it will default to 'basic'.
37
+ * If no type is passed, it will default to 'vertical'.
38
38
  *
39
39
  */
40
- cardType: CardType;
40
+ layout?: Layout;
41
41
  /**
42
- * The type of header to render.
42
+ * Set the card's header colour.
43
43
  *
44
- * If no type is passed, it will default to 'default'.
44
+ * This is optional.
45
45
  */
46
- headerType: HeaderType;
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 type depending on validation result.
90
+ * Set the card's layout depending on validation result.
91
91
  */
92
- private cardTypeState;
92
+ private layoutState;
93
93
  /**
94
- * Mutable variable, for internal use only.
95
- * Set the card's header type depending on validation result.
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
- private headerTypeState;
99
+ validateLayout(): void;
98
100
  /**
99
- * Watch for changes to the `cardType` property for validation purposes.
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 `cardType` will be set to its default (`basic`).
102
- * If a match is found in one of the array values then `cardType` will be set to the matching array key value.
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
- validateCardType(): void;
106
+ validateHeaderColour(): void;
105
107
  /**
106
- * Watch for changes to the `headerType` property for validation purposes.
107
- *
108
- * If the user input doesn't match one of the array values then `headerType` will be set to its default (`default`).
109
- * If a match is found in one of the array values then `headerType` will be set to the matching array key value.
108
+ * Print the invalid `layout` prop warning message.
109
+ */
110
+ private warnDefaultLayout;
111
+ /**
112
+ * Print the invalid `headerColour` prop warning message.
110
113
  */
111
- validateHeaderType(): void;
114
+ private warnDefaultHeaderColour;
112
115
  /**
113
- * Print the invalid `cardType` prop warning message.
114
- * @returns default type (basic).
116
+ * Returns the top level classes of the card.
117
+ *
118
+ * @returns {string}
115
119
  */
116
- private warnDefaultCardType;
120
+ private getCardClasses;
117
121
  /**
118
- * Print the invalid `headerType` prop warning message.
119
- * @returns default type (default).
122
+ * Returns the heading classes of the card.
123
+ *
124
+ * @returns {string}
120
125
  */
121
- private warnDefaultHeaderType;
126
+ private getCardHeadingClasses;
122
127
  /**
123
- * @returns the classes of the ontario cards based off the `cardType` and `headerType`.
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
  }
@@ -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
+ }
@@ -16,10 +16,10 @@ import {
16
16
  import { BadgeColour } from './components/ontario-badge/ontario-badge.types';
17
17
  import { ButtonType, HtmlType } from './components/ontario-button/ontario-button.types';
18
18
  import {
19
- CardType,
20
- HeaderType,
19
+ HeaderColour,
21
20
  HorizontalImagePositionType,
22
21
  HorizontalImageSizeType,
22
+ Layout,
23
23
  } from './components/ontario-card/ontario-card-types';
24
24
  import { CardsPerRow } from './components/ontario-card-collection/ontario-collection-card-types';
25
25
  import { Caption } from './utils/common/input-caption/caption.interface';
@@ -68,10 +68,10 @@ export {
68
68
  export { BadgeColour } from './components/ontario-badge/ontario-badge.types';
69
69
  export { ButtonType, HtmlType } from './components/ontario-button/ontario-button.types';
70
70
  export {
71
- CardType,
72
- HeaderType,
71
+ HeaderColour,
73
72
  HorizontalImagePositionType,
74
73
  HorizontalImageSizeType,
74
+ Layout,
75
75
  } from './components/ontario-card/ontario-card-types';
76
76
  export { CardsPerRow } from './components/ontario-card-collection/ontario-collection-card-types';
77
77
  export { Caption } from './utils/common/input-caption/caption.interface';
@@ -248,18 +248,14 @@ export namespace Components {
248
248
  * Action link for when the card is clicked. This is optional.
249
249
  */
250
250
  cardLink?: string;
251
- /**
252
- * The type of card to render. If no type is passed, it will default to 'basic'.
253
- */
254
- cardType: CardType;
255
251
  /**
256
252
  * Text to be displayed within the card description container. This is optional.
257
253
  */
258
254
  description?: string;
259
255
  /**
260
- * The type of header to render. If no type is passed, it will default to 'default'.
256
+ * Set the card's header colour. This is optional.
261
257
  */
262
- headerType: HeaderType;
258
+ headerColour?: HeaderColour;
263
259
  /**
264
260
  * The position of the image when the card-type is set to 'horizontal'. This prop is only necessry when the card-type is set to 'horizontal'.
265
261
  * @example <ontario-card card-type="horizontal" label="Card Title 1" image="https://picsum.photos/200/300" horizontal-image-position-type="left" horizontal-image-size-type="one-fourth" description="Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum" > </ontario-card>
@@ -279,6 +275,10 @@ export namespace Components {
279
275
  * @example <ontario-card header-type="dark" card-type="horizontal" label="Card Title 1" description="Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum" >
280
276
  */
281
277
  label: string;
278
+ /**
279
+ * The layout oritnetation of the card. If no type is passed, it will default to 'vertical'.
280
+ */
281
+ layout?: Layout;
282
282
  }
283
283
  interface OntarioCardCollection {
284
284
  /**
@@ -1826,6 +1826,54 @@ export namespace Components {
1826
1826
  */
1827
1827
  required?: boolean;
1828
1828
  }
1829
+ interface OntarioSearchBox {
1830
+ /**
1831
+ * The text to display as the input label
1832
+ * @example <ontario-search-box      caption='{ "captionText": "Search directory", "captionType": "default" }' required = "true" > </ontario-search-box>
1833
+ */
1834
+ caption: Caption | string;
1835
+ /**
1836
+ * Used to add a custom function to the input onBlur event.
1837
+ */
1838
+ customOnBlur?: (event: globalThis.Event) => void;
1839
+ /**
1840
+ * Used to add a custom function to the input onChange event.
1841
+ */
1842
+ customOnChange?: (event: globalThis.Event) => void;
1843
+ /**
1844
+ * Used to add a custom function to the input onFocus event.
1845
+ */
1846
+ customOnFocus?: (event: globalThis.Event) => void;
1847
+ /**
1848
+ * Used to add a custom function to the input onInput event.
1849
+ */
1850
+ customOnInput?: (event: globalThis.Event) => void;
1851
+ /**
1852
+ * The unique identifier of the search-box component. This is optional - if no ID is passed, one will be generated.
1853
+ */
1854
+ elementId?: string;
1855
+ /**
1856
+ * Used to include the ontario-hint-text component for the search-box. This is optional.
1857
+ */
1858
+ hintText?: string | Hint;
1859
+ /**
1860
+ * The language of the component. This is used for translations. If none is passed, it will default to English.
1861
+ */
1862
+ language?: Language;
1863
+ /**
1864
+ * This Function to perform a search operation. This function will be called when the search submit button is triggered. The value argument is used for as search term to use for the search operation. This parameter is optional. The performSearch prop can be set dynamically using JavaScript, allowing you to define custom search functionality when the search form is submitted.
1865
+ * @example <ontario-search-box id="ontario-search-box" caption='Search directory' ></ontario-search-box> <script> window.addEventListener('load', () => { const searchBox = document.getElementById('ontario-search-box'); searchBox.performSearch = async (value) => { console.log('Performing search with value:', value); }; }); </script>
1866
+ */
1867
+ performSearch?: (value?: string) => Promise<void>;
1868
+ /**
1869
+ * This is used to determine whether the dropdown list is required or not. This prop gets passed to the InputCaption utility to display either an optional or required flag in the label. If no prop is set, it will default to false (optional).
1870
+ */
1871
+ required?: boolean;
1872
+ /**
1873
+ * The value of the search term. This is optional.
1874
+ */
1875
+ value?: string;
1876
+ }
1829
1877
  interface OntarioStepIndicator {
1830
1878
  /**
1831
1879
  * URL for the back element to set a path for where the link will lead. If a URL is passed in, the back element will display as an anchor tag. The back element will require either the backButtonURL prop or the customOnClick prop to be passed in order for the back element to display.
@@ -1969,6 +2017,10 @@ export interface OntarioRadioButtonsCustomEvent<T> extends CustomEvent<T> {
1969
2017
  detail: T;
1970
2018
  target: HTMLOntarioRadioButtonsElement;
1971
2019
  }
2020
+ export interface OntarioSearchBoxCustomEvent<T> extends CustomEvent<T> {
2021
+ detail: T;
2022
+ target: HTMLOntarioSearchBoxElement;
2023
+ }
1972
2024
  export interface OntarioTextareaCustomEvent<T> extends CustomEvent<T> {
1973
2025
  detail: T;
1974
2026
  target: HTMLOntarioTextareaElement;
@@ -3019,6 +3071,65 @@ declare global {
3019
3071
  prototype: HTMLOntarioRadioButtonsElement;
3020
3072
  new (): HTMLOntarioRadioButtonsElement;
3021
3073
  };
3074
+ interface HTMLOntarioSearchBoxElementEventMap {
3075
+ searchOnSubmit: string;
3076
+ inputOnInput: InputInputEvent;
3077
+ inputOnChange: InputInteractionEvent;
3078
+ inputOnBlur: InputFocusBlurEvent;
3079
+ inputOnFocus: InputFocusBlurEvent;
3080
+ }
3081
+ interface HTMLOntarioSearchBoxElement extends Components.OntarioSearchBox, HTMLStencilElement {
3082
+ addEventListener<K extends keyof HTMLOntarioSearchBoxElementEventMap>(
3083
+ type: K,
3084
+ listener: (
3085
+ this: HTMLOntarioSearchBoxElement,
3086
+ ev: OntarioSearchBoxCustomEvent<HTMLOntarioSearchBoxElementEventMap[K]>,
3087
+ ) => any,
3088
+ options?: boolean | AddEventListenerOptions,
3089
+ ): void;
3090
+ addEventListener<K extends keyof DocumentEventMap>(
3091
+ type: K,
3092
+ listener: (this: Document, ev: DocumentEventMap[K]) => any,
3093
+ options?: boolean | AddEventListenerOptions,
3094
+ ): void;
3095
+ addEventListener<K extends keyof HTMLElementEventMap>(
3096
+ type: K,
3097
+ listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any,
3098
+ options?: boolean | AddEventListenerOptions,
3099
+ ): void;
3100
+ addEventListener(
3101
+ type: string,
3102
+ listener: EventListenerOrEventListenerObject,
3103
+ options?: boolean | AddEventListenerOptions,
3104
+ ): void;
3105
+ removeEventListener<K extends keyof HTMLOntarioSearchBoxElementEventMap>(
3106
+ type: K,
3107
+ listener: (
3108
+ this: HTMLOntarioSearchBoxElement,
3109
+ ev: OntarioSearchBoxCustomEvent<HTMLOntarioSearchBoxElementEventMap[K]>,
3110
+ ) => any,
3111
+ options?: boolean | EventListenerOptions,
3112
+ ): void;
3113
+ removeEventListener<K extends keyof DocumentEventMap>(
3114
+ type: K,
3115
+ listener: (this: Document, ev: DocumentEventMap[K]) => any,
3116
+ options?: boolean | EventListenerOptions,
3117
+ ): void;
3118
+ removeEventListener<K extends keyof HTMLElementEventMap>(
3119
+ type: K,
3120
+ listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any,
3121
+ options?: boolean | EventListenerOptions,
3122
+ ): void;
3123
+ removeEventListener(
3124
+ type: string,
3125
+ listener: EventListenerOrEventListenerObject,
3126
+ options?: boolean | EventListenerOptions,
3127
+ ): void;
3128
+ }
3129
+ var HTMLOntarioSearchBoxElement: {
3130
+ prototype: HTMLOntarioSearchBoxElement;
3131
+ new (): HTMLOntarioSearchBoxElement;
3132
+ };
3022
3133
  interface HTMLOntarioStepIndicatorElement extends Components.OntarioStepIndicator, HTMLStencilElement {}
3023
3134
  var HTMLOntarioStepIndicatorElement: {
3024
3135
  prototype: HTMLOntarioStepIndicatorElement;
@@ -3224,6 +3335,7 @@ declare global {
3224
3335
  'ontario-loading-indicator': HTMLOntarioLoadingIndicatorElement;
3225
3336
  'ontario-page-alert': HTMLOntarioPageAlertElement;
3226
3337
  'ontario-radio-buttons': HTMLOntarioRadioButtonsElement;
3338
+ 'ontario-search-box': HTMLOntarioSearchBoxElement;
3227
3339
  'ontario-step-indicator': HTMLOntarioStepIndicatorElement;
3228
3340
  'ontario-table': HTMLOntarioTableElement;
3229
3341
  'ontario-textarea': HTMLOntarioTextareaElement;
@@ -3368,18 +3480,14 @@ declare namespace LocalJSX {
3368
3480
  * Action link for when the card is clicked. This is optional.
3369
3481
  */
3370
3482
  cardLink?: string;
3371
- /**
3372
- * The type of card to render. If no type is passed, it will default to 'basic'.
3373
- */
3374
- cardType?: CardType;
3375
3483
  /**
3376
3484
  * Text to be displayed within the card description container. This is optional.
3377
3485
  */
3378
3486
  description?: string;
3379
3487
  /**
3380
- * The type of header to render. If no type is passed, it will default to 'default'.
3488
+ * Set the card's header colour. This is optional.
3381
3489
  */
3382
- headerType?: HeaderType;
3490
+ headerColour?: HeaderColour;
3383
3491
  /**
3384
3492
  * The position of the image when the card-type is set to 'horizontal'. This prop is only necessry when the card-type is set to 'horizontal'.
3385
3493
  * @example <ontario-card card-type="horizontal" label="Card Title 1" image="https://picsum.photos/200/300" horizontal-image-position-type="left" horizontal-image-size-type="one-fourth" description="Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum" > </ontario-card>
@@ -3399,6 +3507,10 @@ declare namespace LocalJSX {
3399
3507
  * @example <ontario-card header-type="dark" card-type="horizontal" label="Card Title 1" description="Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum" >
3400
3508
  */
3401
3509
  label?: string;
3510
+ /**
3511
+ * The layout oritnetation of the card. If no type is passed, it will default to 'vertical'.
3512
+ */
3513
+ layout?: Layout;
3402
3514
  }
3403
3515
  interface OntarioCardCollection {
3404
3516
  /**
@@ -5051,6 +5163,75 @@ declare namespace LocalJSX {
5051
5163
  */
5052
5164
  required?: boolean;
5053
5165
  }
5166
+ interface OntarioSearchBox {
5167
+ /**
5168
+ * The text to display as the input label
5169
+ * @example <ontario-search-box      caption='{ "captionText": "Search directory", "captionType": "default" }' required = "true" > </ontario-search-box>
5170
+ */
5171
+ caption?: Caption | string;
5172
+ /**
5173
+ * Used to add a custom function to the input onBlur event.
5174
+ */
5175
+ customOnBlur?: (event: globalThis.Event) => void;
5176
+ /**
5177
+ * Used to add a custom function to the input onChange event.
5178
+ */
5179
+ customOnChange?: (event: globalThis.Event) => void;
5180
+ /**
5181
+ * Used to add a custom function to the input onFocus event.
5182
+ */
5183
+ customOnFocus?: (event: globalThis.Event) => void;
5184
+ /**
5185
+ * Used to add a custom function to the input onInput event.
5186
+ */
5187
+ customOnInput?: (event: globalThis.Event) => void;
5188
+ /**
5189
+ * The unique identifier of the search-box component. This is optional - if no ID is passed, one will be generated.
5190
+ */
5191
+ elementId?: string;
5192
+ /**
5193
+ * Used to include the ontario-hint-text component for the search-box. This is optional.
5194
+ */
5195
+ hintText?: string | Hint;
5196
+ /**
5197
+ * The language of the component. This is used for translations. If none is passed, it will default to English.
5198
+ */
5199
+ language?: Language;
5200
+ /**
5201
+ * Emitted when a keyboard input event occurs when an input has lost focus.
5202
+ */
5203
+ onInputOnBlur?: (event: OntarioSearchBoxCustomEvent<InputFocusBlurEvent>) => void;
5204
+ /**
5205
+ * Emitted when a keyboard input or mouse event occurs when an input has been changed.
5206
+ */
5207
+ onInputOnChange?: (event: OntarioSearchBoxCustomEvent<InputInteractionEvent>) => void;
5208
+ /**
5209
+ * Emitted when a keyboard input event occurs when an input has gained focus.
5210
+ */
5211
+ onInputOnFocus?: (event: OntarioSearchBoxCustomEvent<InputFocusBlurEvent>) => void;
5212
+ /**
5213
+ * Emitted when a input  occurs when an input has been changed.
5214
+ */
5215
+ onInputOnInput?: (event: OntarioSearchBoxCustomEvent<InputInputEvent>) => void;
5216
+ /**
5217
+ * Emitted when the search is submitted. Below is an example on how to hook into the event to get the event details.
5218
+ * @example <script> document.getElementById('ontario-search-box').addEventListener('searchOnSubmit', (event) => { const searchValue = event.detail; console.log('Search submitted with value:', searchValue); }; </script>
5219
+ */
5220
+ onSearchOnSubmit?: (event: OntarioSearchBoxCustomEvent<string>) => void;
5221
+ /**
5222
+ * This Function to perform a search operation. This function will be called when the search submit button is triggered. The value argument is used for as search term to use for the search operation. This parameter is optional. The performSearch prop can be set dynamically using JavaScript, allowing you to define custom search functionality when the search form is submitted.
5223
+ * @example <ontario-search-box id="ontario-search-box" caption='Search directory' ></ontario-search-box> <script> window.addEventListener('load', () => { const searchBox = document.getElementById('ontario-search-box'); searchBox.performSearch = async (value) => { console.log('Performing search with value:', value); }; }); </script>
5224
+ */
5225
+ performSearch?: (value?: string) => Promise<void>;
5226
+ /**
5227
+ * This is used to determine whether the dropdown list is required or not. This prop gets passed to the InputCaption utility to display either an optional or required flag in the label. If no prop is set, it will default to false (optional).
5228
+ */
5229
+ required?: boolean;
5230
+ /**
5231
+ * The value of the search term. This is optional.
5232
+ */
5233
+ value?: string;
5234
+ }
5054
5235
  interface OntarioStepIndicator {
5055
5236
  /**
5056
5237
  * URL for the back element to set a path for where the link will lead. If a URL is passed in, the back element will display as an anchor tag. The back element will require either the backButtonURL prop or the customOnClick prop to be passed in order for the back element to display.
@@ -5321,6 +5502,7 @@ declare namespace LocalJSX {
5321
5502
  'ontario-loading-indicator': OntarioLoadingIndicator;
5322
5503
  'ontario-page-alert': OntarioPageAlert;
5323
5504
  'ontario-radio-buttons': OntarioRadioButtons;
5505
+ 'ontario-search-box': OntarioSearchBox;
5324
5506
  'ontario-step-indicator': OntarioStepIndicator;
5325
5507
  'ontario-table': OntarioTable;
5326
5508
  'ontario-textarea': OntarioTextarea;
@@ -5525,6 +5707,7 @@ declare module '@stencil/core' {
5525
5707
  JSXBase.HTMLAttributes<HTMLOntarioLoadingIndicatorElement>;
5526
5708
  'ontario-page-alert': LocalJSX.OntarioPageAlert & JSXBase.HTMLAttributes<HTMLOntarioPageAlertElement>;
5527
5709
  'ontario-radio-buttons': LocalJSX.OntarioRadioButtons & JSXBase.HTMLAttributes<HTMLOntarioRadioButtonsElement>;
5710
+ 'ontario-search-box': LocalJSX.OntarioSearchBox & JSXBase.HTMLAttributes<HTMLOntarioSearchBoxElement>;
5528
5711
  'ontario-step-indicator': LocalJSX.OntarioStepIndicator & JSXBase.HTMLAttributes<HTMLOntarioStepIndicatorElement>;
5529
5712
  'ontario-table': LocalJSX.OntarioTable & JSXBase.HTMLAttributes<HTMLOntarioTableElement>;
5530
5713
  'ontario-textarea': LocalJSX.OntarioTextarea & JSXBase.HTMLAttributes<HTMLOntarioTextareaElement>;
@@ -17,6 +17,7 @@ export type InputProps = {
17
17
  onChange?: ((event: Event) => void) | undefined;
18
18
  onBlur?: ((event: Event) => void) | undefined;
19
19
  onFocus?: ((event: Event) => void) | undefined;
20
- ref?: (el: any) => HTMLElement;
20
+ onClick?: ((event: Event) => void) | undefined;
21
+ ref?: (el: HTMLInputElement) => HTMLElement;
21
22
  };
22
23
  export declare const Input: FunctionalComponent<InputProps>;
@@ -40,9 +40,15 @@ export declare class InputCaption implements CaptionInfo {
40
40
  /**
41
41
  * Return the `<label>` element for text inputs
42
42
  * @param captionFor Set the `htmlFor` attribute
43
+ * @param hasHintExpander Indicate whether the component the label is for has a hint expander or not
44
+ * @param disableRequiredFlag Disable the required/optional label text _(only use in highly special cases)_
43
45
  * @returns element containing the caption for the input
44
46
  */
45
- getCaption: (captionFor?: string | undefined, hasHintExpander?: boolean) => HTMLElement;
47
+ getCaption: (
48
+ captionFor?: string | undefined,
49
+ hasHintExpander?: boolean,
50
+ disableRequiredFlag?: boolean,
51
+ ) => HTMLElement;
46
52
  getHintExpanderAccessibilityText(captionText: string, hasHintExpanderOnOption?: boolean): HTMLElement;
47
53
  /**
48
54
  * Determines which flag text to use between `required` and `optional`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ongov/ontario-design-system-component-library",
3
- "version": "4.3.1-alpha.1",
3
+ "version": "5.0.0-alpha.1",
4
4
  "private": false,
5
5
  "description": "Ontario Design System Component Library",
6
6
  "license": "Apache-2.0",
@@ -102,5 +102,5 @@
102
102
  "collection:main": "dist/collection/index.js",
103
103
  "es2015": "dist/esm/index.mjs",
104
104
  "es2017": "dist/esm/index.mjs",
105
- "gitHead": "ab7fc8a847e4155ec0ad01347484aaed6dc2d981"
105
+ "gitHead": "2941db5cb66d3a161e359f36543b489922853b02"
106
106
  }