@ongov/ontario-design-system-component-library-react 6.0.0 → 7.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/README.md +34 -3
- package/dist/components/components.d.ts +19 -19
- package/dist/components/components.js +151 -151
- package/dist/components/components.js.map +1 -1
- package/dist/components/components.server.d.ts +19 -22
- package/dist/components/components.server.js +152 -3
- package/dist/components/components.server.js.map +1 -1
- package/dist/styles/slotted-styles/callouts-asides.scss +2 -2
- package/dist/styles/slotted-styles/page-alerts.scss +2 -2
- package/dist/styles/theme.scss +1 -1
- package/package.json +12 -11
- package/src/components/components.server.ts +324 -180
- package/src/components/components.ts +170 -176
- package/src/types/stencil-hydrate.d.ts +6 -0
package/README.md
CHANGED
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
## Introduction
|
|
10
10
|
|
|
11
|
-
This library was generated using Stencil's React output target dependency. It is based
|
|
11
|
+
This library was generated using Stencil's React output target dependency. It is based on the [Ontario Design System Component Library](https://www.npmjs.com/package/@ongov/ontario-design-system-component-library) built using [Stencil](https://stenciljs.com/). For more information, [find it on NPM](https://www.npmjs.com/package/@ongov/ontario-design-system-component-library-react).
|
|
12
|
+
|
|
13
|
+
### React 19 support and tooling
|
|
14
|
+
|
|
15
|
+
This package targets React 19 and ships bindings that align with React 19's JSX/runtime expectations and tooling. React 18 is no longer supported by this package's peer dependencies.
|
|
12
16
|
|
|
13
17
|
## Installation and usage
|
|
14
18
|
|
|
@@ -25,10 +29,29 @@ To use the Ontario Design System React component library, follow these steps:
|
|
|
25
29
|
2. Import the theme file into your project’s entry point.
|
|
26
30
|
|
|
27
31
|
```tsx
|
|
28
|
-
import '@ongov/ontario-design-system-component-library-react/
|
|
32
|
+
import '@ongov/ontario-design-system-component-library-react/styles';
|
|
29
33
|
```
|
|
30
34
|
|
|
31
|
-
3.
|
|
35
|
+
3. Configure the asset path (recommended when assets are not served from `/`).
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { setAssetPath } from '@ongov/ontario-design-system-component-library-react';
|
|
39
|
+
|
|
40
|
+
setAssetPath(`${window.location.origin}/assets/`);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Call `setAssetPath` once, before rendering any components. This ensures Stencil can resolve component assets (fonts, images, favicons) when they are hosted under a custom base path.
|
|
44
|
+
|
|
45
|
+
If you need to override the global styles theme with a custom asset base path, you can create a local theme wrapper that forwards the global styles and sets `$asset-base-path`, then import that wrapper in your app entry point.
|
|
46
|
+
|
|
47
|
+
```scss
|
|
48
|
+
// src/styles/ontario-theme.scss
|
|
49
|
+
@forward 'pkg:@ongov/ontario-design-system-global-styles/styles/scss/theme.scss' with (
|
|
50
|
+
$asset-base-path: '/assets'
|
|
51
|
+
);
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
4. Import the desired components from the component library.
|
|
32
55
|
|
|
33
56
|
```tsx
|
|
34
57
|
import { OntarioButton } from '@ongov/ontario-design-system-component-library-react';
|
|
@@ -50,6 +73,14 @@ You can now use the React components in your component and template files.
|
|
|
50
73
|
></OntarioBlockquote>
|
|
51
74
|
```
|
|
52
75
|
|
|
76
|
+
### Sass (optional)
|
|
77
|
+
|
|
78
|
+
If you use Sass and want `pkg:` resolution via `@use`, import the styles entry point:
|
|
79
|
+
|
|
80
|
+
```scss
|
|
81
|
+
@use 'pkg:@ongov/ontario-design-system-component-library-react/styles' as ods;
|
|
82
|
+
```
|
|
83
|
+
|
|
53
84
|
### Local assets
|
|
54
85
|
|
|
55
86
|
Along with the components, the local assets (logos, fonts, etc.) need to be copied into your project so that they are available for bundling upon building your React application.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This file was automatically generated by the Stencil React Output Target.
|
|
3
3
|
* Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
4
4
|
*/
|
|
5
|
-
import { type AccordionChangeDetail, type DateInputFieldType, type HeaderLanguageToggleEventDetails, type InputFocusBlurEvent, type InputInputEvent, type InputInteractionEvent, type Language, type OntarioAccordionCustomEvent, type OntarioCheckboxesCustomEvent, type OntarioDateInputCustomEvent, type OntarioDropdownListCustomEvent, type OntarioHintExpanderCustomEvent, type OntarioInputCustomEvent, type OntarioLanguageToggleCustomEvent, type OntarioRadioButtonsCustomEvent, type OntarioSearchBoxCustomEvent, type OntarioTextareaCustomEvent, type RadioAndCheckboxChangeEvent } from "@ongov/ontario-design-system-component-library";
|
|
5
|
+
import { type AccordionChangeDetail, type DateInputFieldType, type HeaderLanguageToggleEventDetails, type InputFocusBlurEvent, type InputInputEvent, type InputInteractionEvent, type Language, type OntarioAccordionCustomEvent, type OntarioCheckboxesCustomEvent, type OntarioDateInputCustomEvent, type OntarioDropdownListCustomEvent, type OntarioHeaderCustomEvent, type OntarioHeaderMenuTabsCustomEvent, type OntarioHeaderOverflowMenuCustomEvent, type OntarioHintExpanderCustomEvent, type OntarioInputCustomEvent, type OntarioLanguageToggleCustomEvent, type OntarioRadioButtonsCustomEvent, type OntarioSearchBoxCustomEvent, type OntarioTextareaCustomEvent, type RadioAndCheckboxChangeEvent } from "@ongov/ontario-design-system-component-library";
|
|
6
6
|
import { OntarioAccordion as OntarioAccordionElement } from "@ongov/ontario-design-system-component-library/components/ontario-accordion.js";
|
|
7
7
|
import { OntarioAside as OntarioAsideElement } from "@ongov/ontario-design-system-component-library/components/ontario-aside.js";
|
|
8
8
|
import { OntarioBackToTop as OntarioBackToTopElement } from "@ongov/ontario-design-system-component-library/components/ontario-back-to-top.js";
|
|
@@ -179,7 +179,7 @@ export type OntarioCheckboxesEvents = {
|
|
|
179
179
|
onCheckboxOnChange: EventName<OntarioCheckboxesCustomEvent<RadioAndCheckboxChangeEvent>>;
|
|
180
180
|
onCheckboxOnBlur: EventName<OntarioCheckboxesCustomEvent<InputFocusBlurEvent>>;
|
|
181
181
|
onCheckboxOnFocus: EventName<OntarioCheckboxesCustomEvent<InputFocusBlurEvent>>;
|
|
182
|
-
onInputErrorOccurred: EventName<
|
|
182
|
+
onInputErrorOccurred: EventName<OntarioCheckboxesCustomEvent<{
|
|
183
183
|
errorMessage: string;
|
|
184
184
|
}>>;
|
|
185
185
|
};
|
|
@@ -187,17 +187,17 @@ export declare const OntarioCheckboxes: StencilReactComponent<OntarioCheckboxesE
|
|
|
187
187
|
export type OntarioCriticalAlertEvents = NonNullable<unknown>;
|
|
188
188
|
export declare const OntarioCriticalAlert: StencilReactComponent<OntarioCriticalAlertElement, OntarioCriticalAlertEvents>;
|
|
189
189
|
export type OntarioDateInputEvents = {
|
|
190
|
-
onInputOnInput: EventName<
|
|
190
|
+
onInputOnInput: EventName<OntarioDateInputCustomEvent<{
|
|
191
191
|
value: string;
|
|
192
192
|
fieldType: 'day' | 'month' | 'year';
|
|
193
193
|
}>>;
|
|
194
|
-
onInputOnChange: EventName<
|
|
194
|
+
onInputOnChange: EventName<OntarioDateInputCustomEvent<{
|
|
195
195
|
value: string;
|
|
196
196
|
fieldType: 'day' | 'month' | 'year';
|
|
197
197
|
}>>;
|
|
198
198
|
onInputOnBlur: EventName<OntarioDateInputCustomEvent<DateInputFieldType>>;
|
|
199
199
|
onInputOnFocus: EventName<OntarioDateInputCustomEvent<DateInputFieldType>>;
|
|
200
|
-
onInputErrorOccurred: EventName<
|
|
200
|
+
onInputErrorOccurred: EventName<OntarioDateInputCustomEvent<{
|
|
201
201
|
inputId: string;
|
|
202
202
|
errorMessage: string;
|
|
203
203
|
}>>;
|
|
@@ -207,7 +207,7 @@ export type OntarioDropdownListEvents = {
|
|
|
207
207
|
onDropdownOnChange: EventName<OntarioDropdownListCustomEvent<InputInteractionEvent>>;
|
|
208
208
|
onDropdownOnBlur: EventName<OntarioDropdownListCustomEvent<InputFocusBlurEvent>>;
|
|
209
209
|
onDropdownOnFocus: EventName<OntarioDropdownListCustomEvent<InputFocusBlurEvent>>;
|
|
210
|
-
onInputErrorOccurred: EventName<
|
|
210
|
+
onInputErrorOccurred: EventName<OntarioDropdownListCustomEvent<{
|
|
211
211
|
errorMessage: string;
|
|
212
212
|
}>>;
|
|
213
213
|
};
|
|
@@ -219,23 +219,23 @@ export declare const OntarioFooter: StencilReactComponent<OntarioFooterElement,
|
|
|
219
219
|
export type OntarioFormContainerEvents = NonNullable<unknown>;
|
|
220
220
|
export declare const OntarioFormContainer: StencilReactComponent<OntarioFormContainerElement, OntarioFormContainerEvents>;
|
|
221
221
|
export type OntarioHeaderEvents = {
|
|
222
|
-
onMenuButtonToggled: EventName<
|
|
222
|
+
onMenuButtonToggled: EventName<OntarioHeaderCustomEvent<boolean>>;
|
|
223
223
|
};
|
|
224
224
|
export declare const OntarioHeader: StencilReactComponent<OntarioHeaderElement, OntarioHeaderEvents>;
|
|
225
225
|
export type OntarioHeaderMenuTabsEvents = {
|
|
226
|
-
onTakeOwnership: EventName<
|
|
226
|
+
onTakeOwnership: EventName<OntarioHeaderMenuTabsCustomEvent<{
|
|
227
227
|
panelId: string | null;
|
|
228
228
|
}>>;
|
|
229
|
-
onFocusFirstItem: EventName<
|
|
230
|
-
onFocusMenuButton: EventName<
|
|
229
|
+
onFocusFirstItem: EventName<OntarioHeaderMenuTabsCustomEvent<void>>;
|
|
230
|
+
onFocusMenuButton: EventName<OntarioHeaderMenuTabsCustomEvent<void>>;
|
|
231
231
|
};
|
|
232
232
|
export declare const OntarioHeaderMenuTabs: StencilReactComponent<OntarioHeaderMenuTabsElement, OntarioHeaderMenuTabsEvents>;
|
|
233
233
|
export type OntarioHeaderOverflowMenuEvents = {
|
|
234
|
-
onMenuClosed: EventName<
|
|
235
|
-
onEndOfMenuReached: EventName<
|
|
236
|
-
onFocusMenuButton: EventName<
|
|
237
|
-
onFocusNextElement: EventName<
|
|
238
|
-
onMenuButtonTabPressed: EventName<
|
|
234
|
+
onMenuClosed: EventName<OntarioHeaderOverflowMenuCustomEvent<void>>;
|
|
235
|
+
onEndOfMenuReached: EventName<OntarioHeaderOverflowMenuCustomEvent<void>>;
|
|
236
|
+
onFocusMenuButton: EventName<OntarioHeaderOverflowMenuCustomEvent<void>>;
|
|
237
|
+
onFocusNextElement: EventName<OntarioHeaderOverflowMenuCustomEvent<void>>;
|
|
238
|
+
onMenuButtonTabPressed: EventName<OntarioHeaderOverflowMenuCustomEvent<void>>;
|
|
239
239
|
};
|
|
240
240
|
export declare const OntarioHeaderOverflowMenu: StencilReactComponent<OntarioHeaderOverflowMenuElement, OntarioHeaderOverflowMenuEvents>;
|
|
241
241
|
export type OntarioHintExpanderEvents = {
|
|
@@ -487,7 +487,7 @@ export type OntarioInputEvents = {
|
|
|
487
487
|
onInputOnChange: EventName<OntarioInputCustomEvent<InputInteractionEvent>>;
|
|
488
488
|
onInputOnBlur: EventName<OntarioInputCustomEvent<InputFocusBlurEvent>>;
|
|
489
489
|
onInputOnFocus: EventName<OntarioInputCustomEvent<InputFocusBlurEvent>>;
|
|
490
|
-
onInputErrorOccurred: EventName<
|
|
490
|
+
onInputErrorOccurred: EventName<OntarioInputCustomEvent<{
|
|
491
491
|
inputId: string;
|
|
492
492
|
errorMessage: string;
|
|
493
493
|
}>>;
|
|
@@ -506,13 +506,13 @@ export type OntarioRadioButtonsEvents = {
|
|
|
506
506
|
onRadioOnChange: EventName<OntarioRadioButtonsCustomEvent<RadioAndCheckboxChangeEvent>>;
|
|
507
507
|
onRadioOnBlur: EventName<OntarioRadioButtonsCustomEvent<InputFocusBlurEvent>>;
|
|
508
508
|
onRadioOnFocus: EventName<OntarioRadioButtonsCustomEvent<InputFocusBlurEvent>>;
|
|
509
|
-
onInputErrorOccurred: EventName<
|
|
509
|
+
onInputErrorOccurred: EventName<OntarioRadioButtonsCustomEvent<{
|
|
510
510
|
errorMessage: string;
|
|
511
511
|
}>>;
|
|
512
512
|
};
|
|
513
513
|
export declare const OntarioRadioButtons: StencilReactComponent<OntarioRadioButtonsElement, OntarioRadioButtonsEvents>;
|
|
514
514
|
export type OntarioSearchBoxEvents = {
|
|
515
|
-
onSearchOnSubmit: EventName<
|
|
515
|
+
onSearchOnSubmit: EventName<OntarioSearchBoxCustomEvent<string>>;
|
|
516
516
|
onInputOnInput: EventName<OntarioSearchBoxCustomEvent<InputInputEvent>>;
|
|
517
517
|
onInputOnChange: EventName<OntarioSearchBoxCustomEvent<InputInteractionEvent>>;
|
|
518
518
|
onInputOnBlur: EventName<OntarioSearchBoxCustomEvent<InputFocusBlurEvent>>;
|
|
@@ -532,7 +532,7 @@ export type OntarioTextareaEvents = {
|
|
|
532
532
|
onInputOnChange: EventName<OntarioTextareaCustomEvent<InputInteractionEvent>>;
|
|
533
533
|
onInputOnBlur: EventName<OntarioTextareaCustomEvent<InputFocusBlurEvent>>;
|
|
534
534
|
onInputOnFocus: EventName<OntarioTextareaCustomEvent<InputFocusBlurEvent>>;
|
|
535
|
-
onInputErrorOccurred: EventName<
|
|
535
|
+
onInputErrorOccurred: EventName<OntarioTextareaCustomEvent<{
|
|
536
536
|
inputId: string;
|
|
537
537
|
errorMessage: string;
|
|
538
538
|
}>>;
|