Skip to content

Commit ba43ea8

Browse files
author
Fergus Bisset
committed
feat(behaviours): add BehavioursLoader React component
- Create BehavioursLoader component for SSR-safe behaviour initialization - Export from /behaviours barrel for easy use in Next.js/React apps - Add comprehensive tests (7 test cases, all passing) - Add detailed documentation with usage examples - Update behaviours guide with React/SSR integration patterns - Deprecate example Next.js BehavioursLoader in favor of package export Features: - Defers initialization until after React hydration - Dynamically imports behaviours bundle (keeps out of server chunk) - Supports scoped initialization - Provides onInit/onError callbacks - Client-only component (uses 'use client' directive) Usage: import { BehavioursLoader } from '@fergusbisset/nhs-fdp-design-system/behaviours'; export default function RootLayout({ children }) { return <html><body>{children}<BehavioursLoader /></body></html>; }
1 parent 2f071c4 commit ba43ea8

File tree

10 files changed

+1040
-401
lines changed

10 files changed

+1040
-401
lines changed

dist/meta/components.json

Lines changed: 88 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"version": "0.0.42",
3-
"generatedAt": "2025-10-22T09:29:44.167Z",
2+
"version": "0.0.43",
3+
"generatedAt": "2025-10-22T09:30:39.872Z",
44
"count": 18,
55
"components": {
66
"Textarea": {
@@ -192,68 +192,6 @@
192192
],
193193
"source": "src/components/Tag/Tag.schema.ts"
194194
},
195-
"Radios": {
196-
"name": "Radios",
197-
"category": "form",
198-
"since": "0.1.1",
199-
"a11yNotes": [
200-
"Keyboard arrow navigation cycles through options.",
201-
"Conditional content container is hidden with --hidden class when inactive."
202-
],
203-
"props": [
204-
{
205-
"name": "name",
206-
"type": "string",
207-
"required": true,
208-
"description": "Group name"
209-
},
210-
{
211-
"name": "value",
212-
"type": "string",
213-
"description": "Controlled selected value"
214-
},
215-
{
216-
"name": "defaultValue",
217-
"type": "string",
218-
"description": "Uncontrolled initial value"
219-
},
220-
{
221-
"name": "hasError",
222-
"type": "boolean",
223-
"defaultValue": "false",
224-
"description": "Error style"
225-
},
226-
{
227-
"name": "describedBy",
228-
"type": "string",
229-
"description": "aria-describedby id list"
230-
},
231-
{
232-
"name": "className",
233-
"type": "string",
234-
"description": "Extra CSS classes"
235-
},
236-
{
237-
"name": "size",
238-
"type": "'normal'|'small'",
239-
"defaultValue": "normal",
240-
"description": "Size variant"
241-
},
242-
{
243-
"name": "inline",
244-
"type": "boolean",
245-
"defaultValue": "false",
246-
"description": "Inline layout"
247-
},
248-
{
249-
"name": "options",
250-
"type": "Array<{ value: string; text: string; hint?: string; disabled?: boolean; conditional?: any }>",
251-
"required": true,
252-
"description": "Radio options"
253-
}
254-
],
255-
"source": "src/components/Radios/Radios.schema.ts"
256-
},
257195
"Select": {
258196
"name": "Select",
259197
"category": "form",
@@ -343,6 +281,68 @@
343281
],
344282
"source": "src/components/Select/Select.schema.ts"
345283
},
284+
"Radios": {
285+
"name": "Radios",
286+
"category": "form",
287+
"since": "0.1.1",
288+
"a11yNotes": [
289+
"Keyboard arrow navigation cycles through options.",
290+
"Conditional content container is hidden with --hidden class when inactive."
291+
],
292+
"props": [
293+
{
294+
"name": "name",
295+
"type": "string",
296+
"required": true,
297+
"description": "Group name"
298+
},
299+
{
300+
"name": "value",
301+
"type": "string",
302+
"description": "Controlled selected value"
303+
},
304+
{
305+
"name": "defaultValue",
306+
"type": "string",
307+
"description": "Uncontrolled initial value"
308+
},
309+
{
310+
"name": "hasError",
311+
"type": "boolean",
312+
"defaultValue": "false",
313+
"description": "Error style"
314+
},
315+
{
316+
"name": "describedBy",
317+
"type": "string",
318+
"description": "aria-describedby id list"
319+
},
320+
{
321+
"name": "className",
322+
"type": "string",
323+
"description": "Extra CSS classes"
324+
},
325+
{
326+
"name": "size",
327+
"type": "'normal'|'small'",
328+
"defaultValue": "normal",
329+
"description": "Size variant"
330+
},
331+
{
332+
"name": "inline",
333+
"type": "boolean",
334+
"defaultValue": "false",
335+
"description": "Inline layout"
336+
},
337+
{
338+
"name": "options",
339+
"type": "Array<{ value: string; text: string; hint?: string; disabled?: boolean; conditional?: any }>",
340+
"required": true,
341+
"description": "Radio options"
342+
}
343+
],
344+
"source": "src/components/Radios/Radios.schema.ts"
345+
},
346346
"Panel": {
347347
"name": "Panel",
348348
"category": "content",
@@ -426,29 +426,6 @@
426426
],
427427
"source": "src/components/Label/Label.schema.ts"
428428
},
429-
"InsetText": {
430-
"name": "InsetText",
431-
"category": "content",
432-
"since": "0.1.1",
433-
"props": [
434-
{
435-
"name": "text",
436-
"type": "string",
437-
"description": "Plain text content (ignored if html is provided)"
438-
},
439-
{
440-
"name": "html",
441-
"type": "string",
442-
"description": "HTML content (overrides text)"
443-
},
444-
{
445-
"name": "className",
446-
"type": "string",
447-
"description": "Additional CSS classes"
448-
}
449-
],
450-
"source": "src/components/InsetText/InsetText.schema.ts"
451-
},
452429
"Input": {
453430
"name": "Input",
454431
"category": "form",
@@ -591,6 +568,29 @@
591568
],
592569
"source": "src/components/Input/Input.schema.ts"
593570
},
571+
"InsetText": {
572+
"name": "InsetText",
573+
"category": "content",
574+
"since": "0.1.1",
575+
"props": [
576+
{
577+
"name": "text",
578+
"type": "string",
579+
"description": "Plain text content (ignored if html is provided)"
580+
},
581+
{
582+
"name": "html",
583+
"type": "string",
584+
"description": "HTML content (overrides text)"
585+
},
586+
{
587+
"name": "className",
588+
"type": "string",
589+
"description": "Additional CSS classes"
590+
}
591+
],
592+
"source": "src/components/InsetText/InsetText.schema.ts"
593+
},
594594
"Hint": {
595595
"name": "Hint",
596596
"category": "typography",
@@ -1116,8 +1116,8 @@
11161116
"categories": {
11171117
"form": [
11181118
"Textarea",
1119-
"Radios",
11201119
"Select",
1120+
"Radios",
11211121
"Label",
11221122
"Input",
11231123
"Fieldset",

0 commit comments

Comments
 (0)