govuk-react 0.10.7 → 1.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 (194) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +45 -52
  3. package/dist/components/accordion/index.d.ts +68 -0
  4. package/dist/components/accordion/index.js +104 -0
  5. package/dist/components/accordion/index.js.map +1 -0
  6. package/dist/components/back-link/index.d.ts +1 -0
  7. package/dist/components/back-link/index.js +2 -0
  8. package/dist/components/back-link/index.js.map +1 -0
  9. package/dist/components/body/index.d.ts +1 -0
  10. package/dist/components/body/index.js +2 -0
  11. package/dist/components/body/index.js.map +1 -0
  12. package/dist/components/breadcrumbs/index.d.ts +1 -0
  13. package/dist/components/breadcrumbs/index.js +2 -0
  14. package/dist/components/breadcrumbs/index.js.map +1 -0
  15. package/dist/components/button/index.d.ts +24 -0
  16. package/dist/components/button/index.js +17 -0
  17. package/dist/components/button/index.js.map +1 -0
  18. package/dist/components/caption/index.d.ts +1 -0
  19. package/dist/components/caption/index.js +2 -0
  20. package/dist/components/caption/index.js.map +1 -0
  21. package/dist/components/character-count/index.d.ts +36 -0
  22. package/dist/components/character-count/index.js +82 -0
  23. package/dist/components/character-count/index.js.map +1 -0
  24. package/dist/components/checkboxes/index.d.ts +49 -0
  25. package/dist/components/checkboxes/index.js +73 -0
  26. package/dist/components/checkboxes/index.js.map +1 -0
  27. package/dist/components/cookie-banner/index.d.ts +1 -0
  28. package/dist/components/cookie-banner/index.js +2 -0
  29. package/dist/components/cookie-banner/index.js.map +1 -0
  30. package/dist/components/date-input/index.d.ts +1 -0
  31. package/dist/components/date-input/index.js +2 -0
  32. package/dist/components/date-input/index.js.map +1 -0
  33. package/dist/components/details/index.d.ts +1 -0
  34. package/dist/components/details/index.js +2 -0
  35. package/dist/components/details/index.js.map +1 -0
  36. package/dist/components/document-footer-metadata/index.d.ts +35 -0
  37. package/dist/components/document-footer-metadata/index.js +36 -0
  38. package/dist/components/document-footer-metadata/index.js.map +1 -0
  39. package/dist/components/error-message/index.d.ts +1 -0
  40. package/dist/components/error-message/index.js +2 -0
  41. package/dist/components/error-message/index.js.map +1 -0
  42. package/dist/components/error-summary/index.d.ts +22 -0
  43. package/dist/components/error-summary/index.js +49 -0
  44. package/dist/components/error-summary/index.js.map +1 -0
  45. package/dist/components/exit-this-page/index.d.ts +33 -0
  46. package/dist/components/exit-this-page/index.js +66 -0
  47. package/dist/components/exit-this-page/index.js.map +1 -0
  48. package/dist/components/feedback/index.d.ts +1 -0
  49. package/dist/components/feedback/index.js +2 -0
  50. package/dist/components/feedback/index.js.map +1 -0
  51. package/dist/components/fieldset/index.d.ts +1 -0
  52. package/dist/components/fieldset/index.js +2 -0
  53. package/dist/components/fieldset/index.js.map +1 -0
  54. package/dist/components/file-upload/control.d.ts +6 -0
  55. package/dist/components/file-upload/control.js +9 -0
  56. package/dist/components/file-upload/control.js.map +1 -0
  57. package/dist/components/file-upload/enhanced.d.ts +45 -0
  58. package/dist/components/file-upload/enhanced.js +84 -0
  59. package/dist/components/file-upload/enhanced.js.map +1 -0
  60. package/dist/components/file-upload/index.d.ts +12 -0
  61. package/dist/components/file-upload/index.js +18 -0
  62. package/dist/components/file-upload/index.js.map +1 -0
  63. package/dist/components/footer/index.d.ts +1 -0
  64. package/dist/components/footer/index.js +2 -0
  65. package/dist/components/footer/index.js.map +1 -0
  66. package/dist/components/form-group/index.d.ts +1 -0
  67. package/dist/components/form-group/index.js +2 -0
  68. package/dist/components/form-group/index.js.map +1 -0
  69. package/dist/components/generic-header/index.d.ts +1 -0
  70. package/dist/components/generic-header/index.js +2 -0
  71. package/dist/components/generic-header/index.js.map +1 -0
  72. package/dist/components/grid-column/index.d.ts +1 -0
  73. package/dist/components/grid-column/index.js +2 -0
  74. package/dist/components/grid-column/index.js.map +1 -0
  75. package/dist/components/grid-row/index.d.ts +1 -0
  76. package/dist/components/grid-row/index.js +2 -0
  77. package/dist/components/grid-row/index.js.map +1 -0
  78. package/dist/components/header/index.d.ts +1 -0
  79. package/dist/components/header/index.js +2 -0
  80. package/dist/components/header/index.js.map +1 -0
  81. package/dist/components/heading/index.d.ts +1 -0
  82. package/dist/components/heading/index.js +2 -0
  83. package/dist/components/heading/index.js.map +1 -0
  84. package/dist/components/hint/index.d.ts +1 -0
  85. package/dist/components/hint/index.js +2 -0
  86. package/dist/components/hint/index.js.map +1 -0
  87. package/dist/components/input/index.d.ts +1 -0
  88. package/dist/components/input/index.js +2 -0
  89. package/dist/components/input/index.js.map +1 -0
  90. package/dist/components/inset-text/index.d.ts +1 -0
  91. package/dist/components/inset-text/index.js +2 -0
  92. package/dist/components/inset-text/index.js.map +1 -0
  93. package/dist/components/label/index.d.ts +1 -0
  94. package/dist/components/label/index.js +2 -0
  95. package/dist/components/label/index.js.map +1 -0
  96. package/dist/components/language-navigation/index.d.ts +1 -0
  97. package/dist/components/language-navigation/index.js +2 -0
  98. package/dist/components/language-navigation/index.js.map +1 -0
  99. package/dist/components/link/index.d.ts +1 -0
  100. package/dist/components/link/index.js +2 -0
  101. package/dist/components/link/index.js.map +1 -0
  102. package/dist/components/list/index.d.ts +1 -0
  103. package/dist/components/list/index.js +2 -0
  104. package/dist/components/list/index.js.map +1 -0
  105. package/dist/components/loading-box/index.d.ts +35 -0
  106. package/dist/components/loading-box/index.js +45 -0
  107. package/dist/components/loading-box/index.js.map +1 -0
  108. package/dist/components/main-wrapper/index.d.ts +1 -0
  109. package/dist/components/main-wrapper/index.js +2 -0
  110. package/dist/components/main-wrapper/index.js.map +1 -0
  111. package/dist/components/modal/index.d.ts +33 -0
  112. package/dist/components/modal/index.js +55 -0
  113. package/dist/components/modal/index.js.map +1 -0
  114. package/dist/components/notification-banner/index.d.ts +17 -0
  115. package/dist/components/notification-banner/index.js +44 -0
  116. package/dist/components/notification-banner/index.js.map +1 -0
  117. package/dist/components/page/index.d.ts +23 -0
  118. package/dist/components/page/index.js +22 -0
  119. package/dist/components/page/index.js.map +1 -0
  120. package/dist/components/pagination/index.d.ts +1 -0
  121. package/dist/components/pagination/index.js +2 -0
  122. package/dist/components/pagination/index.js.map +1 -0
  123. package/dist/components/panel/index.d.ts +1 -0
  124. package/dist/components/panel/index.js +2 -0
  125. package/dist/components/panel/index.js.map +1 -0
  126. package/dist/components/password-input/index.d.ts +26 -0
  127. package/dist/components/password-input/index.js +60 -0
  128. package/dist/components/password-input/index.js.map +1 -0
  129. package/dist/components/phase-banner/index.d.ts +1 -0
  130. package/dist/components/phase-banner/index.js +2 -0
  131. package/dist/components/phase-banner/index.js.map +1 -0
  132. package/dist/components/radios/index.d.ts +33 -0
  133. package/dist/components/radios/index.js +70 -0
  134. package/dist/components/radios/index.js.map +1 -0
  135. package/dist/components/related-items/index.d.ts +33 -0
  136. package/dist/components/related-items/index.js +45 -0
  137. package/dist/components/related-items/index.js.map +1 -0
  138. package/dist/components/search-box/index.d.ts +89 -0
  139. package/dist/components/search-box/index.js +136 -0
  140. package/dist/components/search-box/index.js.map +1 -0
  141. package/dist/components/section-break/index.d.ts +1 -0
  142. package/dist/components/section-break/index.js +2 -0
  143. package/dist/components/section-break/index.js.map +1 -0
  144. package/dist/components/select/index.d.ts +1 -0
  145. package/dist/components/select/index.js +2 -0
  146. package/dist/components/select/index.js.map +1 -0
  147. package/dist/components/service-navigation/index.d.ts +64 -0
  148. package/dist/components/service-navigation/index.js +131 -0
  149. package/dist/components/service-navigation/index.js.map +1 -0
  150. package/dist/components/skip-link/index.d.ts +12 -0
  151. package/dist/components/skip-link/index.js +16 -0
  152. package/dist/components/skip-link/index.js.map +1 -0
  153. package/dist/components/summary-list/index.d.ts +1 -0
  154. package/dist/components/summary-list/index.js +2 -0
  155. package/dist/components/summary-list/index.js.map +1 -0
  156. package/dist/components/table/index.d.ts +1 -0
  157. package/dist/components/table/index.js +2 -0
  158. package/dist/components/table/index.js.map +1 -0
  159. package/dist/components/tabs/index.d.ts +98 -0
  160. package/dist/components/tabs/index.js +105 -0
  161. package/dist/components/tabs/index.js.map +1 -0
  162. package/dist/components/tag/index.d.ts +1 -0
  163. package/dist/components/tag/index.js +2 -0
  164. package/dist/components/tag/index.js.map +1 -0
  165. package/dist/components/task-list/index.d.ts +1 -0
  166. package/dist/components/task-list/index.js +2 -0
  167. package/dist/components/task-list/index.js.map +1 -0
  168. package/dist/components/textarea/index.d.ts +1 -0
  169. package/dist/components/textarea/index.js +2 -0
  170. package/dist/components/textarea/index.js.map +1 -0
  171. package/dist/components/visually-hidden/index.d.ts +1 -0
  172. package/dist/components/visually-hidden/index.js +2 -0
  173. package/dist/components/visually-hidden/index.js.map +1 -0
  174. package/dist/components/warning-text/index.d.ts +1 -0
  175. package/dist/components/warning-text/index.js +2 -0
  176. package/dist/components/warning-text/index.js.map +1 -0
  177. package/dist/components/width-container/index.d.ts +1 -0
  178. package/dist/components/width-container/index.js +2 -0
  179. package/dist/components/width-container/index.js.map +1 -0
  180. package/dist/index.d.ts +58 -0
  181. package/dist/index.js +61 -0
  182. package/dist/index.js.map +1 -0
  183. package/dist/utils/join-ids.d.ts +2 -0
  184. package/dist/utils/join-ids.js +6 -0
  185. package/dist/utils/join-ids.js.map +1 -0
  186. package/package.json +38 -66
  187. package/dist/declarations/src/index.d.ts +0 -52
  188. package/dist/govuk-react.cjs.d.ts +0 -2
  189. package/dist/govuk-react.cjs.dev.js +0 -351
  190. package/dist/govuk-react.cjs.js +0 -7
  191. package/dist/govuk-react.cjs.prod.js +0 -351
  192. package/dist/govuk-react.esm.js +0 -51
  193. package/src/index.ts +0 -56
  194. package/src/test.tsx +0 -56
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import * as Markup from 'govuk-frontend-react/file-upload';
3
+ export type FileUploadProps = Markup.FileUploadProps;
4
+ /** The file input. */
5
+ export declare function FileUpload(props: FileUploadProps): React.JSX.Element;
6
+ export type FileUploadTexts = Pick<Markup.FileUploadWrapperProps, 'chooseFilesButtonText' | 'noFileChosenText' | 'multipleFilesChosenText' | 'dropInstructionText' | 'enteredDropZoneText' | 'leftDropZoneText'>;
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ import * as Primitives from '@govuk-react/primitives/file-upload';
3
+ import * as Markup from 'govuk-frontend-react/file-upload';
4
+ /** The file input. */
5
+ export function FileUpload(props) {
6
+ return (React.createElement(Primitives.Input, { asChild: true },
7
+ React.createElement(Markup.FileUpload, { ...props })));
8
+ }
9
+ //# sourceMappingURL=control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control.js","sourceRoot":"","sources":["../../../src/components/file-upload/control.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,UAAU,MAAM,qCAAqC,CAAC;AAClE,OAAO,KAAK,MAAM,MAAM,kCAAkC,CAAC;AAI3D,sBAAsB;AACtB,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,OAAO,CACL,oBAAC,UAAU,CAAC,KAAK,IAAC,OAAO;QACvB,oBAAC,MAAM,CAAC,UAAU,OAAK,KAAK,GAAI,CACf,CACpB,CAAC;AACJ,CAAC","sourcesContent":["import * as React from 'react';\nimport * as Primitives from '@govuk-react/primitives/file-upload';\nimport * as Markup from 'govuk-frontend-react/file-upload';\n\nexport type FileUploadProps = Markup.FileUploadProps;\n\n/** The file input. */\nexport function FileUpload(props: FileUploadProps) {\n return (\n <Primitives.Input asChild>\n <Markup.FileUpload {...props} />\n </Primitives.Input>\n );\n}\n\nexport type FileUploadTexts = Pick<\n Markup.FileUploadWrapperProps,\n | 'chooseFilesButtonText'\n | 'noFileChosenText'\n | 'multipleFilesChosenText'\n | 'dropInstructionText'\n | 'enteredDropZoneText'\n | 'leftDropZoneText'\n>;\n"]}
@@ -0,0 +1,45 @@
1
+ import * as React from 'react';
2
+ import * as Primitives from '@govuk-react/primitives/file-upload';
3
+ import * as Markup from 'govuk-frontend-react/file-upload';
4
+ import { type FileUploadProps, type FileUploadTexts } from './control.js';
5
+ export type RootProps = Omit<Primitives.RootProps, 'noFileChosen' | 'multipleFilesChosen' | 'enteredDropZone' | 'leftDropZone' | 'emptyClass' | 'draggingClass' | 'disabledClass'> & Pick<FileUploadTexts, 'noFileChosenText' | 'multipleFilesChosenText' | 'enteredDropZoneText' | 'leftDropZoneText'>;
6
+ /** Holds `Wrapper` and `Announcements`, and turns the file input into a button and drop zone once JavaScript runs. */
7
+ export declare function Root({ noFileChosenText, multipleFilesChosenText, enteredDropZoneText, leftDropZoneText, ...props }: RootProps): React.JSX.Element;
8
+ export type WrapperProps = Markup.FileUploadWrapperProps;
9
+ /** The drop zone, holding `Button` and `FileUpload`. */
10
+ export declare function Wrapper(props: WrapperProps): React.JSX.Element;
11
+ export type ButtonProps = Omit<Primitives.ButtonProps, 'asChild'>;
12
+ /** Opens the file picker, and takes dropped files. Shown once JavaScript runs, before `FileUpload`. */
13
+ export declare function Button({ className, ...props }: ButtonProps): React.JSX.Element;
14
+ export type StatusProps = Omit<Primitives.StatusProps, 'asChild'>;
15
+ /** Which files are chosen, in `Button`. */
16
+ export declare function Status({ className, ...props }: StatusProps): React.JSX.Element;
17
+ export type CommaProps = Omit<Primitives.SeparatorProps, 'asChild'>;
18
+ /** A visually hidden comma between the label and the button's text in its accessible name, after `Status`. */
19
+ export declare function Comma({ className, ...props }: CommaProps): React.JSX.Element;
20
+ export type PseudoButtonContainerProps = React.ComponentProps<'span'>;
21
+ /** Holds `PseudoButton` and `Instruction`, in `Button`. */
22
+ export declare function PseudoButtonContainer({ className, ...props }: PseudoButtonContainerProps): React.JSX.Element;
23
+ export type PseudoButtonProps = React.ComponentProps<'span'>;
24
+ /** Looks like a secondary button. Defaults to "Choose file". */
25
+ export declare function PseudoButton({ className, children, ...props }: PseudoButtonProps): React.JSX.Element;
26
+ export type InstructionProps = React.ComponentProps<'span'>;
27
+ /** Tells users they can drop files. Defaults to "or drop file". */
28
+ export declare function Instruction({ className, children, ...props }: InstructionProps): React.JSX.Element;
29
+ export type ButtonCompositeProps = Omit<ButtonProps, 'children'> & Pick<FileUploadTexts, 'chooseFilesButtonText' | 'dropInstructionText'>;
30
+ /** `Button`, with its status and text. */
31
+ export declare function ButtonComposite({ chooseFilesButtonText, dropInstructionText, ...props }: ButtonCompositeProps): React.JSX.Element;
32
+ export type AnnouncementsProps = Omit<Primitives.AnnouncementsProps, 'asChild'>;
33
+ /** Tells screen reader users when they drag files into or out of the drop zone, after `Wrapper`. */
34
+ export declare function Announcements({ className, ...props }: AnnouncementsProps): React.JSX.Element;
35
+ export type CompositeProps = FileUploadProps & FileUploadTexts;
36
+ /** `Root`, with the drop zone, button, file input and announcements. Takes the file input's props. */
37
+ export declare function Composite({ chooseFilesButtonText, noFileChosenText, multipleFilesChosenText, dropInstructionText, enteredDropZoneText, leftDropZoneText, ...props }: CompositeProps): React.JSX.Element;
38
+ export type FieldProps = Omit<Markup.FileUploadFieldProps, 'javascript'>;
39
+ /**
40
+ * Help users select and upload a file, by choosing it or dropping it on the field. This is
41
+ * govuk-frontend's improved file upload. Without JavaScript it's a native file input.
42
+ *
43
+ * @see https://design-system.service.gov.uk/components/file-upload/#using-the-improved-file-upload-component
44
+ */
45
+ export declare function Field({ id: idProp, name, label, labelSize, labelIsPageHeading, hint, errorMessage, 'aria-describedby': describedBy, ...props }: FieldProps): React.JSX.Element;
@@ -0,0 +1,84 @@
1
+ import * as React from 'react';
2
+ import { clsx } from 'clsx';
3
+ import * as Primitives from '@govuk-react/primitives/file-upload';
4
+ import * as Markup from 'govuk-frontend-react/file-upload';
5
+ import { ErrorMessageComposite } from 'govuk-frontend-react/error-message';
6
+ import { FormGroup } from 'govuk-frontend-react/form-group';
7
+ import { Hint } from 'govuk-frontend-react/hint';
8
+ import { LabelComposite } from 'govuk-frontend-react/label';
9
+ import { FileUpload } from './control.js';
10
+ import { joinIds } from '../../utils/join-ids.js';
11
+ /** Holds `Wrapper` and `Announcements`, and turns the file input into a button and drop zone once JavaScript runs. */
12
+ export function Root({ noFileChosenText, multipleFilesChosenText, enteredDropZoneText, leftDropZoneText, ...props }) {
13
+ return (React.createElement(Primitives.Root, { noFileChosen: noFileChosenText, multipleFilesChosen: multipleFilesChosenText, enteredDropZone: enteredDropZoneText, leftDropZone: leftDropZoneText, emptyClass: "govuk-file-upload-button--empty", draggingClass: "govuk-file-upload-button--dragging", disabledClass: "govuk-file-upload-wrapper--disabled", ...props }));
14
+ }
15
+ /** The drop zone, holding `Button` and `FileUpload`. */
16
+ export function Wrapper(props) {
17
+ return (React.createElement(Primitives.DropZone, { asChild: true },
18
+ React.createElement(Markup.FileUploadWrapper, { ...props })));
19
+ }
20
+ /** Opens the file picker, and takes dropped files. Shown once JavaScript runs, before `FileUpload`. */
21
+ export function Button({ className, ...props }) {
22
+ return React.createElement(Primitives.Button, { className: clsx('govuk-file-upload-button', className), ...props });
23
+ }
24
+ /** Which files are chosen, in `Button`. */
25
+ export function Status({ className, ...props }) {
26
+ return React.createElement(Primitives.Status, { className: clsx('govuk-body', 'govuk-file-upload-button__status', className), ...props });
27
+ }
28
+ /** A visually hidden comma between the label and the button's text in its accessible name, after `Status`. */
29
+ export function Comma({ className, ...props }) {
30
+ return React.createElement(Primitives.Separator, { className: clsx('govuk-visually-hidden', className), ...props });
31
+ }
32
+ /** Holds `PseudoButton` and `Instruction`, in `Button`. */
33
+ export function PseudoButtonContainer({ className, ...props }) {
34
+ return React.createElement("span", { className: clsx('govuk-file-upload-button__pseudo-button-container', className), ...props });
35
+ }
36
+ /** Looks like a secondary button. Defaults to "Choose file". */
37
+ export function PseudoButton({ className, children = 'Choose file', ...props }) {
38
+ return (React.createElement("span", { className: clsx('govuk-button', 'govuk-button--secondary', 'govuk-file-upload-button__pseudo-button', className), ...props }, children));
39
+ }
40
+ /** Tells users they can drop files. Defaults to "or drop file". */
41
+ export function Instruction({ className, children = 'or drop file', ...props }) {
42
+ return (React.createElement("span", { className: clsx('govuk-body', 'govuk-file-upload-button__instruction', className), ...props }, children));
43
+ }
44
+ /** `Button`, with its status and text. */
45
+ export function ButtonComposite({ chooseFilesButtonText, dropInstructionText, ...props }) {
46
+ return (React.createElement(Button, { ...props },
47
+ React.createElement(Status, null),
48
+ React.createElement(Comma, null),
49
+ React.createElement(PseudoButtonContainer, null,
50
+ React.createElement(PseudoButton, null, chooseFilesButtonText),
51
+ " ",
52
+ React.createElement(Instruction, null, dropInstructionText))));
53
+ }
54
+ /** Tells screen reader users when they drag files into or out of the drop zone, after `Wrapper`. */
55
+ export function Announcements({ className, ...props }) {
56
+ return (React.createElement(Primitives.Announcements, { className: clsx('govuk-file-upload-announcements', 'govuk-visually-hidden', className), ...props }));
57
+ }
58
+ /** `Root`, with the drop zone, button, file input and announcements. Takes the file input's props. */
59
+ export function Composite({ chooseFilesButtonText, noFileChosenText, multipleFilesChosenText, dropInstructionText, enteredDropZoneText, leftDropZoneText, ...props }) {
60
+ return (React.createElement(Root, { noFileChosenText: noFileChosenText, multipleFilesChosenText: multipleFilesChosenText, enteredDropZoneText: enteredDropZoneText, leftDropZoneText: leftDropZoneText },
61
+ React.createElement(Wrapper, { chooseFilesButtonText: chooseFilesButtonText, noFileChosenText: noFileChosenText, multipleFilesChosenText: multipleFilesChosenText, dropInstructionText: dropInstructionText, enteredDropZoneText: enteredDropZoneText, leftDropZoneText: leftDropZoneText },
62
+ React.createElement(ButtonComposite, { chooseFilesButtonText: chooseFilesButtonText, dropInstructionText: dropInstructionText }),
63
+ React.createElement(FileUpload, { ...props })),
64
+ React.createElement(Announcements, null)));
65
+ }
66
+ const isSet = (node) => node !== undefined && node !== null && node !== false && node !== '';
67
+ /**
68
+ * Help users select and upload a file, by choosing it or dropping it on the field. This is
69
+ * govuk-frontend's improved file upload. Without JavaScript it's a native file input.
70
+ *
71
+ * @see https://design-system.service.gov.uk/components/file-upload/#using-the-improved-file-upload-component
72
+ */
73
+ export function Field({ id: idProp, name, label, labelSize, labelIsPageHeading, hint, errorMessage, 'aria-describedby': describedBy, ...props }) {
74
+ const id = idProp || name;
75
+ const hintId = isSet(hint) ? `${id}-hint` : undefined;
76
+ const errorId = isSet(errorMessage) ? `${id}-error` : undefined;
77
+ const ariaDescribedBy = joinIds(describedBy, hintId, errorId);
78
+ return (React.createElement(FormGroup, { error: Boolean(errorId) },
79
+ React.createElement(LabelComposite, { id: `${id}-label`, htmlFor: id, size: labelSize, isPageHeading: labelIsPageHeading }, label),
80
+ hintId && React.createElement(Hint, { id: hintId }, hint),
81
+ errorId && React.createElement(ErrorMessageComposite, { id: errorId }, errorMessage),
82
+ React.createElement(Composite, { id: id, name: name, error: Boolean(errorId), "aria-describedby": ariaDescribedBy, ...props })));
83
+ }
84
+ //# sourceMappingURL=enhanced.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enhanced.js","sourceRoot":"","sources":["../../../src/components/file-upload/enhanced.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,UAAU,MAAM,qCAAqC,CAAC;AAClE,OAAO,KAAK,MAAM,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAA8C,MAAM,cAAc,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAclD,sHAAsH;AACtH,MAAM,UAAU,IAAI,CAAC,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EAChB,GAAG,KAAK,EACE;IACV,OAAO,CACL,oBAAC,UAAU,CAAC,IAAI,IACd,YAAY,EAAE,gBAAgB,EAC9B,mBAAmB,EAAE,uBAAuB,EAC5C,eAAe,EAAE,mBAAmB,EACpC,YAAY,EAAE,g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AE,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,kBAAkB,IAC/F,KAAK,CACS;QAChB,MAAM,IAAI,oBAAC,IAAI,IAAC,EAAE,EAAE,MAAM,IAAG,IAAI,CAAQ;QACzC,OAAO,IAAI,oBAAC,qBAAqB,IAAC,EAAE,EAAE,OAAO,IAAG,YAAY,CAAyB;QACtF,oBAAC,SAAS,IAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,sBAAoB,eAAe,KAAM,KAAK,GAAI,CAC9F,CACb,CAAC;AACJ,CAAC","sourcesContent":["import * as React from 'react';\nimport { clsx } from 'clsx';\nimport * as Primitives from '@govuk-react/primitives/file-upload';\nimport * as Markup from 'govuk-frontend-react/file-upload';\nimport { ErrorMessageComposite } from 'govuk-frontend-react/error-message';\nimport { FormGroup } from 'govuk-frontend-react/form-group';\nimport { Hint } from 'govuk-frontend-react/hint';\nimport { LabelComposite } from 'govuk-frontend-react/label';\nimport { FileUpload, type FileUploadProps, type FileUploadTexts } from './control.js';\nimport { joinIds } from '../../utils/join-ids.js';\n\nexport type RootProps = Omit<\n Primitives.RootProps,\n | 'noFileChosen'\n | 'multipleFilesChosen'\n | 'enteredDropZone'\n | 'leftDropZone'\n | 'emptyClass'\n | 'draggingClass'\n | 'disabledClass'\n> &\n Pick<FileUploadTexts, 'noFileChosenText' | 'multipleFilesChosenText' | 'enteredDropZoneText' | 'leftDropZoneText'>;\n\n/** Holds `Wrapper` and `Announcements`, and turns the file input into a button and drop zone once JavaScript runs. */\nexport function Root({\n noFileChosenText,\n multipleFilesChosenText,\n enteredDropZoneText,\n leftDropZoneText,\n ...props\n}: RootProps) {\n return (\n <Primitives.Root\n noFileChosen={noFileChosenText}\n multipleFilesChosen={multipleFilesChosenText}\n enteredDropZone={enteredDropZoneText}\n leftDropZone={leftDropZoneText}\n emptyClass=\"govuk-file-upload-button--empty\"\n draggingClass=\"govuk-file-upload-button--dragging\"\n disabledClass=\"govuk-file-upload-wrapper--disabled\"\n {...props}\n />\n );\n}\n\nexport type WrapperProps = Markup.FileUploadWrapperProps;\n\n/** The drop zone, holding `Button` and `FileUpload`. */\nexport function Wrapper(props: WrapperProps) {\n return (\n <Primitives.DropZone asChild>\n <Markup.FileUploadWrapper {...props} />\n </Primitives.DropZone>\n );\n}\n\nexport type ButtonProps = Omit<Primitives.ButtonProps, 'asChild'>;\n\n/** Opens the file picker, and takes dropped files. Shown once JavaScript runs, before `FileUpload`. */\nexport function Button({ className, ...props }: ButtonProps) {\n return <Primitives.Button className={clsx('govuk-file-upload-button', className)} {...props} />;\n}\n\nexport type StatusProps = Omit<Primitives.StatusProps, 'asChild'>;\n\n/** Which files are chosen, in `Button`. */\nexport function Status({ className, ...props }: StatusProps) {\n return <Primitives.Status className={clsx('govuk-body', 'govuk-file-upload-button__status', className)} {...props} />;\n}\n\nexport type CommaProps = Omit<Primitives.SeparatorProps, 'asChild'>;\n\n/** A visually hidden comma between the label and the button's text in its accessible name, after `Status`. */\nexport function Comma({ className, ...props }: CommaProps) {\n return <Primitives.Separator className={clsx('govuk-visually-hidden', className)} {...props} />;\n}\n\nexport type PseudoButtonContainerProps = React.ComponentProps<'span'>;\n\n/** Holds `PseudoButton` and `Instruction`, in `Button`. */\nexport function PseudoButtonContainer({ className, ...props }: PseudoButtonContainerProps) {\n return <span className={clsx('govuk-file-upload-button__pseudo-button-container', className)} {...props} />;\n}\n\nexport type PseudoButtonProps = React.ComponentProps<'span'>;\n\n/** Looks like a secondary button. Defaults to \"Choose file\". */\nexport function PseudoButton({ className, children = 'Choose file', ...props }: PseudoButtonProps) {\n return (\n <span\n className={clsx('govuk-button', 'govuk-button--secondary', 'govuk-file-upload-button__pseudo-button', className)}\n {...props}\n >\n {children}\n </span>\n );\n}\n\nexport type InstructionProps = React.ComponentProps<'span'>;\n\n/** Tells users they can drop files. Defaults to \"or drop file\". */\nexport function Instruction({ className, children = 'or drop file', ...props }: InstructionProps) {\n return (\n <span className={clsx('govuk-body', 'govuk-file-upload-button__instruction', className)} {...props}>\n {children}\n </span>\n );\n}\n\nexport type ButtonCompositeProps = Omit<ButtonProps, 'children'> &\n Pick<FileUploadTexts, 'chooseFilesButtonText' | 'dropInstructionText'>;\n\n/** `Button`, with its status and text. */\nexport function ButtonComposite({ chooseFilesButtonText, dropInstructionText, ...props }: ButtonCompositeProps) {\n return (\n <Button {...props}>\n <Status />\n <Comma />\n <PseudoButtonContainer>\n <PseudoButton>{chooseFilesButtonText}</PseudoButton> <Instruction>{dropInstructionText}</Instruction>\n </PseudoButtonContainer>\n </Button>\n );\n}\n\nexport type AnnouncementsProps = Omit<Primitives.AnnouncementsProps, 'asChild'>;\n\n/** Tells screen reader users when they drag files into or out of the drop zone, after `Wrapper`. */\nexport function Announcements({ className, ...props }: AnnouncementsProps) {\n return (\n <Primitives.Announcements\n className={clsx('govuk-file-upload-announcements', 'govuk-visually-hidden', className)}\n {...props}\n />\n );\n}\n\nexport type CompositeProps = FileUploadProps & FileUploadTexts;\n\n/** `Root`, with the drop zone, button, file input and announcements. Takes the file input's props. */\nexport function Composite({\n chooseFilesButtonText,\n noFileChosenText,\n multipleFilesChosenText,\n dropInstructionText,\n enteredDropZoneText,\n leftDropZoneText,\n ...props\n}: CompositeProps) {\n return (\n <Root\n noFileChosenText={noFileChosenText}\n multipleFilesChosenText={multipleFilesChosenText}\n enteredDropZoneText={enteredDropZoneText}\n leftDropZoneText={leftDropZoneText}\n >\n <Wrapper\n chooseFilesButtonText={chooseFilesButtonText}\n noFileChosenText={noFileChosenText}\n multipleFilesChosenText={multipleFilesChosenText}\n dropInstructionText={dropInstructionText}\n enteredDropZoneText={enteredDropZoneText}\n leftDropZoneText={leftDropZoneText}\n >\n <ButtonComposite chooseFilesButtonText={chooseFilesButtonText} dropInstructionText={dropInstructionText} />\n <FileUpload {...props} />\n </Wrapper>\n <Announcements />\n </Root>\n );\n}\n\nexport type FieldProps = Omit<Markup.FileUploadFieldProps, 'javascript'>;\n\nconst isSet = (node: React.ReactNode) => node !== undefined && node !== null && node !== false && node !== '';\n\n/**\n * Help users select and upload a file, by choosing it or dropping it on the field. This is\n * govuk-frontend's improved file upload. Without JavaScript it's a native file input.\n *\n * @see https://design-system.service.gov.uk/components/file-upload/#using-the-improved-file-upload-component\n */\nexport function Field({\n id: idProp,\n name,\n label,\n labelSize,\n labelIsPageHeading,\n hint,\n errorMessage,\n 'aria-describedby': describedBy,\n ...props\n}: FieldProps) {\n const id = idProp || name;\n const hintId = isSet(hint) ? `${id}-hint` : undefined;\n const errorId = isSet(errorMessage) ? `${id}-error` : undefined;\n const ariaDescribedBy = joinIds(describedBy, hintId, errorId);\n\n return (\n <FormGroup error={Boolean(errorId)}>\n {/* The id govuk-frontend gives the label, which names the button. */}\n <LabelComposite id={`${id}-label`} htmlFor={id} size={labelSize} isPageHeading={labelIsPageHeading}>\n {label}\n </LabelComposite>\n {hintId && <Hint id={hintId}>{hint}</Hint>}\n {errorId && <ErrorMessageComposite id={errorId}>{errorMessage}</ErrorMessageComposite>}\n <Composite id={id} name={name} error={Boolean(errorId)} aria-describedby={ariaDescribedBy} {...props} />\n </FormGroup>\n );\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import * as Markup from 'govuk-frontend-react/file-upload';
3
+ import type { FileUploadTexts } from './control.js';
4
+ export { FileUpload, type FileUploadProps } from './control.js';
5
+ export type FileUploadFieldProps = Omit<Markup.FileUploadFieldProps, 'javascript' | keyof FileUploadTexts>;
6
+ /**
7
+ * Help users select and upload a file.
8
+ *
9
+ * @see https://design-system.service.gov.uk/components/file-upload/
10
+ */
11
+ export declare function FileUploadField(props: FileUploadFieldProps): React.JSX.Element;
12
+ export * as EnhancedFileUpload from './enhanced.js';
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+ import * as Markup from 'govuk-frontend-react/file-upload';
3
+ /*
4
+ * govuk-frontend-react's FileUpload markup. `FileUploadField` is the native file input. `EnhancedFileUpload.Field` is
5
+ * govuk-frontend's improved file upload, with behaviour from @govuk-react/primitives: without
6
+ * JavaScript it's the native file input too, and once JavaScript runs it's a button and drop zone.
7
+ */
8
+ export { FileUpload } from './control.js';
9
+ /**
10
+ * Help users select and upload a file.
11
+ *
12
+ * @see https://design-system.service.gov.uk/components/file-upload/
13
+ */
14
+ export function FileUploadField(props) {
15
+ return React.createElement(Markup.FileUploadField, { ...props });
16
+ }
17
+ export * as EnhancedFileUpload from './enhanced.js';
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/file-upload/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,kCAAkC,CAAC;AAG3D;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAwB,MAAM,cAAc,CAAC;AAIhE;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,OAAO,oBAAC,MAAM,CAAC,eAAe,OAAK,KAAK,GAAI,CAAC;AAC/C,CAAC;AAED,OAAO,KAAK,kBAAkB,MAAM,eAAe,CAAC","sourcesContent":["import * as React from 'react';\nimport * as Markup from 'govuk-frontend-react/file-upload';\nimport type { FileUploadTexts } from './control.js';\n\n/*\n * govuk-frontend-react's FileUpload markup. `FileUploadField` is the native file input. `EnhancedFileUpload.Field` is\n * govuk-frontend's improved file upload, with behaviour from @govuk-react/primitives: without\n * JavaScript it's the native file input too, and once JavaScript runs it's a button and drop zone.\n */\n\nexport { FileUpload, type FileUploadProps } from './control.js';\n\nexport type FileUploadFieldProps = Omit<Markup.FileUploadFieldProps, 'javascript' | keyof FileUploadTexts>;\n\n/**\n * Help users select and upload a file.\n *\n * @see https://design-system.service.gov.uk/components/file-upload/\n */\nexport function FileUploadField(props: FileUploadFieldProps) {\n return <Markup.FileUploadField {...props} />;\n}\n\nexport * as EnhancedFileUpload from './enhanced.js';\n"]}
@@ -0,0 +1 @@
1
+ export * from 'govuk-frontend-react/footer';
@@ -0,0 +1,2 @@
1
+ export * from 'govuk-frontend-react/footer';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/footer/index.tsx"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC","sourcesContent":["export * from 'govuk-frontend-react/footer';\n"]}
@@ -0,0 +1 @@
1
+ export { FormGroup, type FormGroupProps } from 'govuk-frontend-react/form-group';
@@ -0,0 +1,2 @@
1
+ export { FormGroup } from 'govuk-frontend-react/form-group';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/form-group/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuB,MAAM,iCAAiC,CAAC","sourcesContent":["export { FormGroup, type FormGroupProps } from 'govuk-frontend-react/form-group';\n"]}
@@ -0,0 +1 @@
1
+ export * from 'govuk-frontend-react/generic-header';
@@ -0,0 +1,2 @@
1
+ export * from 'govuk-frontend-react/generic-header';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/generic-header/index.tsx"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC","sourcesContent":["export * from 'govuk-frontend-react/generic-header';\n"]}
@@ -0,0 +1 @@
1
+ export { GridColumn, type GridColumnProps } from 'govuk-frontend-react/grid';
@@ -0,0 +1,2 @@
1
+ export { GridColumn } from 'govuk-frontend-react/grid';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/grid-column/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAwB,MAAM,2BAA2B,CAAC","sourcesContent":["export { GridColumn, type GridColumnProps } from 'govuk-frontend-react/grid';\n"]}
@@ -0,0 +1 @@
1
+ export { GridRow, type GridRowProps } from 'govuk-frontend-react/grid';
@@ -0,0 +1,2 @@
1
+ export { GridRow } from 'govuk-frontend-react/grid';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/grid-row/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAqB,MAAM,2BAA2B,CAAC","sourcesContent":["export { GridRow, type GridRowProps } from 'govuk-frontend-react/grid';\n"]}
@@ -0,0 +1 @@
1
+ export * from 'govuk-frontend-react/header';
@@ -0,0 +1,2 @@
1
+ export * from 'govuk-frontend-react/header';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/header/index.tsx"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC","sourcesContent":["export * from 'govuk-frontend-react/header';\n"]}
@@ -0,0 +1 @@
1
+ export { Heading, type HeadingProps } from 'govuk-frontend-react/heading';
@@ -0,0 +1,2 @@
1
+ export { Heading } from 'govuk-frontend-react/heading';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/heading/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAqB,MAAM,8BAA8B,CAAC","sourcesContent":["export { Heading, type HeadingProps } from 'govuk-frontend-react/heading';\n"]}
@@ -0,0 +1 @@
1
+ export { Hint, type HintProps } from 'govuk-frontend-react/hint';
@@ -0,0 +1,2 @@
1
+ export { Hint } from 'govuk-frontend-react/hint';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/hint/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,2BAA2B,CAAC","sourcesContent":["export { Hint, type HintProps } from 'govuk-frontend-react/hint';\n"]}
@@ -0,0 +1 @@
1
+ export * from 'govuk-frontend-react/input';
@@ -0,0 +1,2 @@
1
+ export * from 'govuk-frontend-react/input';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/input/index.tsx"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC","sourcesContent":["export * from 'govuk-frontend-react/input';\n"]}
@@ -0,0 +1 @@
1
+ export { InsetText, type InsetTextProps } from 'govuk-frontend-react/inset-text';
@@ -0,0 +1,2 @@
1
+ export { InsetText } from 'govuk-frontend-react/inset-text';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/inset-text/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuB,MAAM,iCAAiC,CAAC","sourcesContent":["export { InsetText, type InsetTextProps } from 'govuk-frontend-react/inset-text';\n"]}
@@ -0,0 +1 @@
1
+ export { Label, LabelComposite, LabelWrapper, type LabelProps, type LabelCompositeProps, type LabelWrapperProps, } from 'govuk-frontend-react/label';
@@ -0,0 +1,2 @@
1
+ export { Label, LabelComposite, LabelWrapper, } from 'govuk-frontend-react/label';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/label/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,cAAc,EACd,YAAY,GAIb,MAAM,4BAA4B,CAAC","sourcesContent":["export {\n Label,\n LabelComposite,\n LabelWrapper,\n type LabelProps,\n type LabelCompositeProps,\n type LabelWrapperProps,\n} from 'govuk-frontend-react/label';\n"]}
@@ -0,0 +1 @@
1
+ export * from 'govuk-frontend-react/language-navigation';
@@ -0,0 +1,2 @@
1
+ export * from 'govuk-frontend-react/language-navigation';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/language-navigation/index.tsx"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC","sourcesContent":["export * from 'govuk-frontend-react/language-navigation';\n"]}
@@ -0,0 +1 @@
1
+ export { Link, type LinkProps } from 'govuk-frontend-react/link';
@@ -0,0 +1,2 @@
1
+ export { Link } from 'govuk-frontend-react/link';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/link/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,2BAA2B,CAAC","sourcesContent":["export { Link, type LinkProps } from 'govuk-frontend-react/link';\n"]}
@@ -0,0 +1 @@
1
+ export { List, type ListProps } from 'govuk-frontend-react/list';
@@ -0,0 +1,2 @@
1
+ export { List } from 'govuk-frontend-react/list';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/list/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,2BAA2B,CAAC","sourcesContent":["export { List, type ListProps } from 'govuk-frontend-react/list';\n"]}
@@ -0,0 +1,35 @@
1
+ import * as React from 'react';
2
+ import type { ComponentProps, ReactNode } from 'react';
3
+ /** Static styles, hoisted and deduplicated by React. Dynamic values come in through custom properties. */
4
+ export declare const loadingBoxCss = "\n.govuk-react-loading-box{position:relative;padding-bottom:2px;min-height:10px}\n.govuk-react-loading-box__overlay{position:absolute;inset:0;z-index:100;display:flex;justify-content:center;visibility:hidden;transition:visibility 0s linear var(--govuk-react-loading-box-time-out)}\n.govuk-react-loading-box__backdrop{position:absolute;inset:0;background-color:var(--govuk-react-loading-box-background-colour);opacity:0;transition:opacity var(--govuk-react-loading-box-time-out) ease-in-out}\n.govuk-react-loading-box__spinner{position:absolute;z-index:1;display:block;width:50px;height:100%;max-height:calc(50vh + 100px);opacity:0;transition:opacity var(--govuk-react-loading-box-time-out) ease-in-out}\n.govuk-react-loading-box__spinner rect{animation:govuk-react-loading-box-fade 1s infinite linear}\n.govuk-react-loading-box--loading>.govuk-react-loading-box__overlay{visibility:visible;transition-delay:0s}\n.govuk-react-loading-box--loading>.govuk-react-loading-box__overlay>.govuk-react-loading-box__backdrop{opacity:var(--govuk-react-loading-box-background-opacity);transition-duration:var(--govuk-react-loading-box-time-in)}\n.govuk-react-loading-box--loading>.govuk-react-loading-box__overlay>.govuk-react-loading-box__spinner{opacity:1;transition-duration:var(--govuk-react-loading-box-time-in);transition-delay:calc(var(--govuk-react-loading-box-time-in) / 2)}\n\n.govuk-react-loading-box__text{display:none;position:absolute;z-index:1;margin:0;padding-top:20px}\n@media (prefers-reduced-motion:reduce){.govuk-react-loading-box__overlay,.govuk-react-loading-box__backdrop,.govuk-react-loading-box__spinner{transition:none}.govuk-react-loading-box__spinner{display:none}.govuk-react-loading-box__text{display:block}}\n@keyframes govuk-react-loading-box-fade{0%{opacity:.250075}.01%{opacity:.25}.03%{opacity:1}100%{opacity:.250075}}\n";
5
+ export type LoadingBoxProps = Omit<ComponentProps<'div'>, 'title'> & {
6
+ /** Content that the loading box overlays. */
7
+ children?: ReactNode;
8
+ /** Whether the content is loading. Shows the spinner and overlay, announces `statusText`, and sets `aria-busy` on the content. */
9
+ loading?: boolean;
10
+ /** Text announced to screen reader users while loading, and shown instead of the spinner when the user prefers reduced motion. Say what’s happening, such as “Sending your application”. */
11
+ statusText?: ReactNode;
12
+ /** Make the content inert while loading, so users can’t interact with it or move focus into it. Focus inside the content moves to the page body, so move focus yourself when loading ends. */
13
+ inertWhileLoading?: boolean;
14
+ /** Colour of the spinner, as any CSS colour. Defaults to the text colour. */
15
+ spinnerColor?: string;
16
+ /** Colour of the overlay, as any CSS colour. Defaults to the page background colour. */
17
+ backgroundColor?: string;
18
+ /** Opacity of the overlay, from 0 to 1. */
19
+ backgroundColorOpacity?: number;
20
+ /** Length of the fade-in, in milliseconds. */
21
+ timeIn?: number;
22
+ /** Length of the fade-out, in milliseconds. */
23
+ timeOut?: number;
24
+ };
25
+ /**
26
+ * Wraps content that loads asynchronously. While `loading` is `true`, a spinner and overlay cover the content and `statusText` is announced.
27
+ *
28
+ * - Say what’s happening in `statusText`, and keep it showing for at least a couple of seconds so it doesn’t flash and screen readers have time to announce it.
29
+ * - Don’t disable buttons while loading: disabled buttons have poor contrast and can confuse some users. Prevent repeat submissions in your submit handler, and on the server.
30
+ * - When loading ends, move focus to the result, or to the error summary if there are errors.
31
+ * - If loading fails or times out, show an error and a way to continue. Don’t leave the spinner running.
32
+ *
33
+ * @see https://github.com/alphagov/govuk-design-system/discussions/6167
34
+ */
35
+ export declare function LoadingBox({ children, loading, statusText, inertWhileLoading, spinnerColor, backgroundColor, backgroundColorOpacity, timeIn, timeOut, className, style, ...props }: LoadingBoxProps): React.JSX.Element;
@@ -0,0 +1,45 @@
1
+ import * as React from 'react';
2
+ const name = 'govuk-react-loading-box';
3
+ /** Static styles, hoisted and deduplicated by React. Dynamic values come in through custom properties. */
4
+ export const loadingBoxCss = `
5
+ .${name}{position:relative;padding-bottom:2px;min-height:10px}
6
+ .${name}__overlay{position:absolute;inset:0;z-index:100;display:flex;justify-content:center;visibility:hidden;transition:visibility 0s linear var(--${name}-time-out)}
7
+ .${name}__backdrop{position:absolute;inset:0;background-color:var(--${name}-background-colour);opacity:0;transition:opacity var(--${name}-time-out) ease-in-out}
8
+ .${name}__spinner{position:absolute;z-index:1;display:block;width:50px;height:100%;max-height:calc(50vh + 100px);opacity:0;transition:opacity var(--${name}-time-out) ease-in-out}
9
+ .${name}__spinner rect{animation:${name}-fade 1s infinite linear}
10
+ .${name}--loading>.${name}__overlay{visibility:visible;transition-delay:0s}
11
+ .${name}--loading>.${name}__overlay>.${name}__backdrop{opacity:var(--${name}-background-opacity);transition-duration:var(--${name}-time-in)}
12
+ .${name}--loading>.${name}__overlay>.${name}__spinner{opacity:1;transition-duration:var(--${name}-time-in);transition-delay:calc(var(--${name}-time-in) / 2)}
13
+
14
+ .${name}__text{display:none;position:absolute;z-index:1;margin:0;padding-top:20px}
15
+ @media (prefers-reduced-motion:reduce){.${name}__overlay,.${name}__backdrop,.${name}__spinner{transition:none}.${name}__spinner{display:none}.${name}__text{display:block}}
16
+ @keyframes ${name}-fade{0%{opacity:.250075}.01%{opacity:.25}.03%{opacity:1}100%{opacity:.250075}}
17
+ `;
18
+ /**
19
+ * Wraps content that loads asynchronously. While `loading` is `true`, a spinner and overlay cover the content and `statusText` is announced.
20
+ *
21
+ * - Say what’s happening in `statusText`, and keep it showing for at least a couple of seconds so it doesn’t flash and screen readers have time to announce it.
22
+ * - Don’t disable buttons while loading: disabled buttons have poor contrast and can confuse some users. Prevent repeat submissions in your submit handler, and on the server.
23
+ * - When loading ends, move focus to the result, or to the error summary if there are errors.
24
+ * - If loading fails or times out, show an error and a way to continue. Don’t leave the spinner running.
25
+ *
26
+ * @see https://github.com/alphagov/govuk-design-system/discussions/6167
27
+ */
28
+ export function LoadingBox({ children, loading = false, statusText = 'Loading', inertWhileLoading = false, spinnerColor = 'var(--govuk-text-colour, #0b0c0c)', backgroundColor = 'var(--govuk-body-background-colour, #fff)', backgroundColorOpacity = 0.85, timeIn = 800, timeOut = 200, className, style, ...props }) {
29
+ const variables = {
30
+ [`--${name}-background-colour`]: backgroundColor,
31
+ [`--${name}-background-opacity`]: String(backgroundColorOpacity),
32
+ [`--${name}-time-in`]: `${timeIn}ms`,
33
+ [`--${name}-time-out`]: `${timeOut}ms`,
34
+ ...style,
35
+ };
36
+ return (React.createElement("div", { className: [name, loading && `${name}--loading`, className].filter(Boolean).join(' '), style: variables, ...props },
37
+ React.createElement("style", { href: name, precedence: "default" }, loadingBoxCss),
38
+ React.createElement("div", { className: `${name}__overlay`, "aria-hidden": "true" },
39
+ React.createElement("svg", { className: `${name}__spinner`, viewBox: "-25 -25 50 50", preserveAspectRatio: "xMidYMid meet", fill: spinnerColor, focusable: "false" }, Array.from({ length: 12 }, (_, i) => (React.createElement("rect", { key: i, width: "12", height: "5", rx: "2.5", ry: "2.5", opacity: "0", transform: `rotate(${i * 30}, 0, 2) translate(10 0)`, style: { animationDelay: `${i * 83}ms` } })))),
40
+ React.createElement("p", { className: `govuk-body govuk-!-font-weight-bold ${name}__text` }, statusText),
41
+ React.createElement("div", { className: `${name}__backdrop` })),
42
+ React.createElement("div", { className: "govuk-visually-hidden", role: "status" }, loading ? statusText : null),
43
+ React.createElement("div", { "aria-busy": loading, inert: inertWhileLoading && loading }, children)));
44
+ }
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/loading-box/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,IAAI,GAAG,yBAAyB,CAAC;AAEvC,0GAA0G;AAC1G,MAAM,CAAC,MAAM,aAAa,GAAG;GAC1B,IAAI;GACJ,IAAI,+IAA+I,IAAI;GACvJ,IAAI,+DAA+D,IAAI,0DAA0D,IAAI;GACrI,IAAI,+IAA+I,IAAI;GACvJ,IAAI,4BAA4B,IAAI;GACpC,IAAI,cAAc,IAAI;GACtB,IAAI,cAAc,IAAI,cAAc,IAAI,4BAA4B,IAAI,kDAAkD,IAAI;GAC9H,IAAI,cAAc,IAAI,cAAc,IAAI,iDAAiD,IAAI,yCAAyC,IAAI;;GAE1I,IAAI;0CACmC,IAAI,cAAc,IAAI,eAAe,IAAI,8BAA8B,IAAI,2BAA2B,IAAI;aACvI,IAAI;CAChB,CAAC;AAuBF;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,QAAQ,EACR,OAAO,GAAG,KAAK,EACf,UAAU,GAAG,SAAS,EACtB,iBAAiB,GAAG,KAAK,EACzB,YAAY,GAAG,mCAAmC,EAClD,eAAe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EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GACxC,CACH,CAAC,CACE;YACN,2BAAG,SAAS,EAAE,uCAAuC,IAAI,QAAQ,IAAG,UAAU,CAAK;YACnF,6BAAK,SAAS,EAAE,GAAG,IAAI,YAAY,GAAI,CACnC;QACN,6BAAK,SAAS,EAAC,uBAAuB,EAAC,IAAI,EAAC,QAAQ,IACjD,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CACxB;QACN,0CAAgB,OAAO,EAAE,KAAK,EAAE,iBAAiB,IAAI,OAAO,IACzD,QAAQ,CACL,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["import * as React from 'react';\nimport type { CSSProperties, ComponentProps, ReactNode } from 'react';\n\nconst name = 'govuk-react-loading-box';\n\n/** Static styles, hoisted and deduplicated by React. Dynamic values come in through custom properties. */\nexport const loadingBoxCss = `\n.${name}{position:relative;padding-bottom:2px;min-height:10px}\n.${name}__overlay{position:absolute;inset:0;z-index:100;display:flex;justify-content:center;visibility:hidden;transition:visibility 0s linear var(--${name}-time-out)}\n.${name}__backdrop{position:absolute;inset:0;background-color:var(--${name}-background-colour);opacity:0;transition:opacity var(--${name}-time-out) ease-in-out}\n.${name}__spinner{position:absolute;z-index:1;display:block;width:50px;height:100%;max-height:calc(50vh + 100px);opacity:0;transition:opacity var(--${name}-time-out) ease-in-out}\n.${name}__spinner rect{animation:${name}-fade 1s infinite linear}\n.${name}--loading>.${name}__overlay{visibility:visible;transition-delay:0s}\n.${name}--loading>.${name}__overlay>.${name}__backdrop{opacity:var(--${name}-background-opacity);transition-duration:var(--${name}-time-in)}\n.${name}--loading>.${name}__overlay>.${name}__spinner{opacity:1;transition-duration:var(--${name}-time-in);transition-delay:calc(var(--${name}-time-in) / 2)}\n\n.${name}__text{display:none;position:absolute;z-index:1;margin:0;padding-top:20px}\n@media (prefers-reduced-motion:reduce){.${name}__overlay,.${name}__backdrop,.${name}__spinner{transition:none}.${name}__spinner{display:none}.${name}__text{display:block}}\n@keyframes ${name}-fade{0%{opacity:.250075}.01%{opacity:.25}.03%{opacity:1}100%{opacity:.250075}}\n`;\n\nexport type LoadingBoxProps = Omit<ComponentProps<'div'>, 'title'> & {\n /** Content that the loading box overlays. */\n children?: ReactNode;\n /** Whether the content is loading. Shows the spinner and overlay, announces `statusText`, and sets `aria-busy` on the content. */\n loading?: boolean;\n /** Text announced to screen reader users while loading, and shown instead of the spinner when the user prefers reduced motion. Say what’s happening, such as “Sending your application”. */\n statusText?: ReactNode;\n /** Make the content inert while loading, so users can’t interact with it or move focus into it. Focus inside the content moves to the page body, so move focus yourself when loading ends. */\n inertWhileLoading?: boolean;\n /** Colour of the spinner, as any CSS colour. Defaults to the text colour. */\n spinnerColor?: string;\n /** Colour of the overlay, as any CSS colour. Defaults to the page background colour. */\n backgroundColor?: string;\n /** Opacity of the overlay, from 0 to 1. */\n backgroundColorOpacity?: number;\n /** Length of the fade-in, in milliseconds. */\n timeIn?: number;\n /** Length of the fade-out, in milliseconds. */\n timeOut?: number;\n};\n\n/**\n * Wraps content that loads asynchronously. While `loading` is `true`, a spinner and overlay cover the content and `statusText` is announced.\n *\n * - Say what’s happening in `statusText`, and keep it showing for at least a couple of seconds so it doesn’t flash and screen readers have time to announce it.\n * - Don’t disable buttons while loading: disabled buttons have poor contrast and can confuse some users. Prevent repeat submissions in your submit handler, and on the server.\n * - When loading ends, move focus to the result, or to the error summary if there are errors.\n * - If loading fails or times out, show an error and a way to continue. Don’t leave the spinner running.\n *\n * @see https://github.com/alphagov/govuk-design-system/discussions/6167\n */\nexport function LoadingBox({\n children,\n loading = false,\n statusText = 'Loading',\n inertWhileLoading = false,\n spinnerColor = 'var(--govuk-text-colour, #0b0c0c)',\n backgroundColor = 'var(--govuk-body-background-colour, #fff)',\n backgroundColorOpacity = 0.85,\n timeIn = 800,\n timeOut = 200,\n className,\n style,\n ...props\n}: LoadingBoxProps) {\n const variables: CSSProperties & Record<`--${string}`, string> = {\n [`--${name}-background-colour`]: backgroundColor,\n [`--${name}-background-opacity`]: String(backgroundColorOpacity),\n [`--${name}-time-in`]: `${timeIn}ms`,\n [`--${name}-time-out`]: `${timeOut}ms`,\n ...style,\n };\n return (\n <div\n className={[name, loading && `${name}--loading`, className].filter(Boolean).join(' ')}\n style={variables}\n {...props}\n >\n <style href={name} precedence=\"default\">\n {loadingBoxCss}\n </style>\n <div className={`${name}__overlay`} aria-hidden=\"true\">\n <svg\n className={`${name}__spinner`}\n viewBox=\"-25 -25 50 50\"\n preserveAspectRatio=\"xMidYMid meet\"\n fill={spinnerColor}\n focusable=\"false\"\n >\n {Array.from({ length: 12 }, (_, i) => (\n <rect\n key={i}\n width=\"12\"\n height=\"5\"\n rx=\"2.5\"\n ry=\"2.5\"\n opacity=\"0\"\n transform={`rotate(${i * 30}, 0, 2) translate(10 0)`}\n style={{ animationDelay: `${i * 83}ms` }}\n />\n ))}\n </svg>\n <p className={`govuk-body govuk-!-font-weight-bold ${name}__text`}>{statusText}</p>\n <div className={`${name}__backdrop`} />\n </div>\n <div className=\"govuk-visually-hidden\" role=\"status\">\n {loading ? statusText : null}\n </div>\n <div aria-busy={loading} inert={inertWhileLoading && loading}>\n {children}\n </div>\n </div>\n );\n}\n"]}
@@ -0,0 +1 @@
1
+ export { MainWrapper, type MainWrapperProps } from 'govuk-frontend-react/main-wrapper';
@@ -0,0 +1,2 @@
1
+ export { MainWrapper } from 'govuk-frontend-react/main-wrapper';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/main-wrapper/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAyB,MAAM,mCAAmC,CAAC","sourcesContent":["export { MainWrapper, type MainWrapperProps } from 'govuk-frontend-react/main-wrapper';\n"]}
@@ -0,0 +1,33 @@
1
+ import * as React from 'react';
2
+ import type { ReactNode } from 'react';
3
+ import * as Primitives from '@govuk-react/primitives/modal';
4
+ import { type ButtonProps } from 'govuk-frontend-react/button';
5
+ /** Styles govuk-frontend has no class for, hoisted and deduplicated by React. */
6
+ export declare const modalCss = "\n.govuk-react-modal{box-sizing:border-box;width:calc(100% - 30px);max-width:640px;max-height:calc(100% - 30px);padding:30px;border:5px solid var(--govuk-text-colour,#0b0c0c);background:var(--govuk-body-background-colour,#fff);color:var(--govuk-text-colour,#0b0c0c)}\n.govuk-react-modal:focus{outline:3px solid var(--govuk-focus-colour,#fd0);outline-offset:0}\n.govuk-react-modal::backdrop{background:rgb(11 12 12 / .8)}\n.govuk-react-modal>:last-child{margin-bottom:0}\n@media (max-width:40.0525em){.govuk-react-modal{padding:15px}}\n";
7
+ export type RootProps = Primitives.RootProps;
8
+ /** Holds the modal and the buttons that open and close it. */
9
+ export declare function Root({ children, ...props }: RootProps): React.JSX.Element;
10
+ export type TriggerProps = Omit<ButtonProps, 'as' | 'href' | 'type'> & Pick<Primitives.TriggerProps, 'dialogId'>;
11
+ /** A button that opens the modal. */
12
+ export declare function Trigger({ dialogId, ...props }: TriggerProps): React.JSX.Element;
13
+ export type CloseProps = TriggerProps;
14
+ /** A button that closes the modal. A secondary button, unless you pass another `variant`, or `undefined` for a primary one. */
15
+ export declare function Close({ dialogId, ...props }: CloseProps): React.JSX.Element;
16
+ export type ContentProps = Omit<Primitives.ContentProps, 'asChild'>;
17
+ /** The modal dialog. Give it a Title. */
18
+ export declare function Content({ className, ...props }: ContentProps): React.JSX.Element;
19
+ export type TitleProps = Omit<Primitives.TitleProps, 'asChild'>;
20
+ /** The modal's heading, which names it. */
21
+ export declare function Title({ className, ...props }: TitleProps): React.JSX.Element;
22
+ export type CompositeProps = Omit<RootProps, 'title'> & {
23
+ /** The text of the button that opens the modal. */
24
+ triggerText: ReactNode;
25
+ /** The modal's heading. */
26
+ title: ReactNode;
27
+ /** The text of the button that closes the modal. Defaults to "Cancel". */
28
+ closeText?: ReactNode;
29
+ /** Other actions, such as a button that confirms, shown before the close button. */
30
+ actions?: ReactNode;
31
+ };
32
+ /** A button that opens a modal with a title, content and actions. */
33
+ export declare function Composite({ triggerText, title, closeText, actions, children, ...props }: CompositeProps): React.JSX.Element;