@govuk-react/primitives 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{accordion-element.d.ts → accordion/element.d.ts} +2 -5
- package/dist/accordion/element.js +302 -0
- package/dist/accordion/element.js.map +1 -0
- package/dist/accordion/index.d.ts +74 -0
- package/dist/accordion/index.js +138 -0
- package/dist/accordion/index.js.map +1 -0
- package/dist/auto-focus/element.d.ts +1 -0
- package/dist/auto-focus/element.js +75 -0
- package/dist/auto-focus/element.js.map +1 -0
- package/dist/{index-Bul0NJh_.d.ts → auto-focus/index.d.ts} +27 -40
- package/dist/auto-focus/index.js +29 -0
- package/dist/{chunk-6ZFU4VYW.js.map → auto-focus/index.js.map} +1 -1
- package/dist/{autocomplete-element.d.ts → autocomplete/element.d.ts} +4 -7
- package/dist/autocomplete/element.js +597 -0
- package/dist/autocomplete/element.js.map +1 -0
- package/dist/{index-D7lMYMUR.d.ts → autocomplete/index.d.ts} +34 -57
- package/dist/autocomplete/index.js +108 -0
- package/dist/autocomplete/index.js.map +1 -0
- package/dist/button/element.d.ts +1 -0
- package/dist/button/element.js +59 -0
- package/dist/button/element.js.map +1 -0
- package/dist/button/index.d.ts +10 -0
- package/dist/button/index.js +9 -0
- package/dist/button/index.js.map +1 -0
- package/dist/{character-count-element.d.ts → character-count/element.d.ts} +2 -5
- package/dist/character-count/element.js +287 -0
- package/dist/character-count/element.js.map +1 -0
- package/dist/character-count/index.d.ts +57 -0
- package/dist/character-count/index.js +79 -0
- package/dist/character-count/index.js.map +1 -0
- package/dist/character-count/messages.d.ts +20 -0
- package/dist/character-count/messages.js +54 -0
- package/dist/character-count/messages.js.map +1 -0
- package/dist/choices/element.d.ts +5 -0
- package/dist/choices/element.js +202 -0
- package/dist/choices/element.js.map +1 -0
- package/dist/{index-WuGvkTxu.d.ts → choices/index.d.ts} +30 -44
- package/dist/choices/index.js +37 -0
- package/dist/choices/index.js.map +1 -0
- package/dist/{disclosure-element.d.ts → disclosure/element.d.ts} +2 -5
- package/dist/disclosure/element.js +123 -0
- package/dist/disclosure/element.js.map +1 -0
- package/dist/{index-D4Gzyvfu.d.ts → disclosure/index.d.ts} +40 -54
- package/dist/disclosure/index.js +66 -0
- package/dist/disclosure/index.js.map +1 -0
- package/dist/exit-this-page/element.d.ts +19 -0
- package/dist/exit-this-page/element.js +201 -0
- package/dist/exit-this-page/element.js.map +1 -0
- package/dist/{index-qF0jIQCW.d.ts → exit-this-page/index.d.ts} +36 -60
- package/dist/exit-this-page/index.js +54 -0
- package/dist/exit-this-page/index.js.map +1 -0
- package/dist/{file-upload-element.d.ts → file-upload/element.d.ts} +5 -9
- package/dist/file-upload/element.js +270 -0
- package/dist/file-upload/element.js.map +1 -0
- package/dist/file-upload/index.d.ts +46 -0
- package/dist/file-upload/index.js +65 -0
- package/dist/file-upload/index.js.map +1 -0
- package/dist/focus-links/element.d.ts +1 -0
- package/dist/focus-links/element.js +90 -0
- package/dist/focus-links/element.js.map +1 -0
- package/dist/{index-BR3MAGF8.d.ts → focus-links/index.d.ts} +24 -35
- package/dist/focus-links/index.js +7 -0
- package/dist/focus-links/index.js.map +1 -0
- package/dist/index.d.ts +13 -17
- package/dist/index.js +13 -72
- package/dist/index.js.map +1 -1
- package/dist/inline/accordion-element.js +1 -1
- package/dist/inline/auto-focus-element.js +1 -1
- package/dist/inline/autocomplete-element.js +1 -1
- package/dist/inline/character-count-element.js +1 -1
- package/dist/inline/choices-element.js +1 -1
- package/dist/inline/disclosure-element.js +1 -1
- package/dist/inline/exit-this-page-element.js +1 -1
- package/dist/inline/file-upload-element.js +1 -1
- package/dist/inline/focus-links-element.js +1 -1
- package/dist/inline/modal-element.js +1 -1
- package/dist/inline/password-input-element.js +1 -1
- package/dist/inline/tabs-element.js +1 -1
- package/dist/inline-script/index.d.ts +26 -0
- package/dist/inline-script/index.js +31 -0
- package/dist/inline-script/index.js.map +1 -0
- package/dist/{modal-element.d.ts → modal/element.d.ts} +2 -4
- package/dist/modal/element.js +114 -0
- package/dist/modal/element.js.map +1 -0
- package/dist/modal/index.d.ts +36 -0
- package/dist/modal/index.js +109 -0
- package/dist/modal/index.js.map +1 -0
- package/dist/password-input/element.d.ts +1 -0
- package/dist/password-input/element.js +134 -0
- package/dist/password-input/element.js.map +1 -0
- package/dist/{index-sEHnx4-M.d.ts → password-input/index.d.ts} +32 -48
- package/dist/password-input/index.js +35 -0
- package/dist/password-input/index.js.map +1 -0
- package/dist/{tabs-element.d.ts → tabs/element.d.ts} +2 -5
- package/dist/tabs/element.js +416 -0
- package/dist/tabs/element.js.map +1 -0
- package/dist/tabs/index.d.ts +83 -0
- package/dist/tabs/index.js +138 -0
- package/dist/tabs/index.js.map +1 -0
- package/dist/utils/dom.d.ts +9 -0
- package/dist/utils/dom.js +27 -0
- package/dist/utils/dom.js.map +1 -0
- package/dist/utils/on-property-set.d.ts +9 -0
- package/dist/utils/on-property-set.js +38 -0
- package/dist/utils/on-property-set.js.map +1 -0
- package/dist/utils/set-focus.d.ts +11 -0
- package/dist/utils/set-focus.js +38 -0
- package/dist/utils/set-focus.js.map +1 -0
- package/dist/utils/set-up-when-ready.d.ts +6 -0
- package/dist/utils/set-up-when-ready.js +16 -0
- package/dist/utils/set-up-when-ready.js.map +1 -0
- package/dist/utils/slot.d.ts +13 -0
- package/dist/utils/slot.js +40 -0
- package/dist/utils/slot.js.map +1 -0
- package/dist/utils/translation.d.ts +13 -0
- package/dist/utils/translation.js +57 -0
- package/dist/utils/translation.js.map +1 -0
- package/package.json +11 -4
- package/dist/accordion-element.js +0 -9
- package/dist/accordion-element.js.map +0 -1
- package/dist/accordion.d.ts +0 -2
- package/dist/accordion.js +0 -34
- package/dist/accordion.js.map +0 -1
- package/dist/auto-focus-element.d.ts +0 -3
- package/dist/auto-focus-element.js +0 -10
- package/dist/auto-focus-element.js.map +0 -1
- package/dist/auto-focus.d.ts +0 -2
- package/dist/auto-focus.js +0 -15
- package/dist/auto-focus.js.map +0 -1
- package/dist/autocomplete-element.js +0 -12
- package/dist/autocomplete-element.js.map +0 -1
- package/dist/autocomplete.d.ts +0 -4
- package/dist/autocomplete.js +0 -25
- package/dist/autocomplete.js.map +0 -1
- package/dist/button-element.d.ts +0 -2
- package/dist/button-element.js +0 -3
- package/dist/button-element.js.map +0 -1
- package/dist/button.d.ts +0 -2
- package/dist/button.js +0 -12
- package/dist/button.js.map +0 -1
- package/dist/character-count-element.js +0 -10
- package/dist/character-count-element.js.map +0 -1
- package/dist/character-count.d.ts +0 -3
- package/dist/character-count.js +0 -26
- package/dist/character-count.js.map +0 -1
- package/dist/choices-element.d.ts +0 -8
- package/dist/choices-element.js +0 -9
- package/dist/choices-element.js.map +0 -1
- package/dist/choices.d.ts +0 -2
- package/dist/choices.js +0 -16
- package/dist/choices.js.map +0 -1
- package/dist/chunk-2IHAQAYF.js +0 -23
- package/dist/chunk-2IHAQAYF.js.map +0 -1
- package/dist/chunk-2ZJVSNC2.js +0 -31
- package/dist/chunk-2ZJVSNC2.js.map +0 -1
- package/dist/chunk-47NMY4SS.js +0 -108
- package/dist/chunk-47NMY4SS.js.map +0 -1
- package/dist/chunk-4XAR4FFG.js +0 -83
- package/dist/chunk-4XAR4FFG.js.map +0 -1
- package/dist/chunk-5HWRMQK2.js +0 -91
- package/dist/chunk-5HWRMQK2.js.map +0 -1
- package/dist/chunk-6ZFU4VYW.js +0 -41
- package/dist/chunk-B2I4J5NL.js +0 -264
- package/dist/chunk-B2I4J5NL.js.map +0 -1
- package/dist/chunk-DPERPCUH.js +0 -188
- package/dist/chunk-DPERPCUH.js.map +0 -1
- package/dist/chunk-ECYGKE4D.js +0 -168
- package/dist/chunk-ECYGKE4D.js.map +0 -1
- package/dist/chunk-ESBMTI25.js +0 -11
- package/dist/chunk-ESBMTI25.js.map +0 -1
- package/dist/chunk-ET7DCQM7.js +0 -133
- package/dist/chunk-ET7DCQM7.js.map +0 -1
- package/dist/chunk-F5XFC4QJ.js +0 -177
- package/dist/chunk-F5XFC4QJ.js.map +0 -1
- package/dist/chunk-GVGBDSDN.js +0 -78
- package/dist/chunk-GVGBDSDN.js.map +0 -1
- package/dist/chunk-IZQ2C4BC.js +0 -351
- package/dist/chunk-IZQ2C4BC.js.map +0 -1
- package/dist/chunk-L7E6GN2D.js +0 -87
- package/dist/chunk-L7E6GN2D.js.map +0 -1
- package/dist/chunk-LWIA644X.js +0 -34
- package/dist/chunk-LWIA644X.js.map +0 -1
- package/dist/chunk-NX4B3NKM.js +0 -35
- package/dist/chunk-NX4B3NKM.js.map +0 -1
- package/dist/chunk-PNWPGD7B.js +0 -68
- package/dist/chunk-PNWPGD7B.js.map +0 -1
- package/dist/chunk-QLQ6O7OW.js +0 -111
- package/dist/chunk-QLQ6O7OW.js.map +0 -1
- package/dist/chunk-RDUPELOK.js +0 -55
- package/dist/chunk-RDUPELOK.js.map +0 -1
- package/dist/chunk-RPMHI67T.js +0 -104
- package/dist/chunk-RPMHI67T.js.map +0 -1
- package/dist/chunk-TE4RUYVK.js +0 -97
- package/dist/chunk-TE4RUYVK.js.map +0 -1
- package/dist/chunk-TJVBFRIE.js +0 -60
- package/dist/chunk-TJVBFRIE.js.map +0 -1
- package/dist/chunk-U5OKNKYC.js +0 -510
- package/dist/chunk-U5OKNKYC.js.map +0 -1
- package/dist/chunk-UXJO4AJP.js +0 -290
- package/dist/chunk-UXJO4AJP.js.map +0 -1
- package/dist/chunk-VNXXENCU.js +0 -39
- package/dist/chunk-VNXXENCU.js.map +0 -1
- package/dist/chunk-XGK73UCD.js +0 -62
- package/dist/chunk-XGK73UCD.js.map +0 -1
- package/dist/chunk-XJYLFTYE.js +0 -157
- package/dist/chunk-XJYLFTYE.js.map +0 -1
- package/dist/chunk-YCESNTXQ.js +0 -241
- package/dist/chunk-YCESNTXQ.js.map +0 -1
- package/dist/chunk-ZTJLVNR4.js +0 -62
- package/dist/chunk-ZTJLVNR4.js.map +0 -1
- package/dist/disclosure-element.js +0 -9
- package/dist/disclosure-element.js.map +0 -1
- package/dist/disclosure.d.ts +0 -2
- package/dist/disclosure.js +0 -16
- package/dist/disclosure.js.map +0 -1
- package/dist/exit-this-page-element.d.ts +0 -22
- package/dist/exit-this-page-element.js +0 -13
- package/dist/exit-this-page-element.js.map +0 -1
- package/dist/exit-this-page.d.ts +0 -3
- package/dist/exit-this-page.js +0 -25
- package/dist/exit-this-page.js.map +0 -1
- package/dist/file-upload-element.js +0 -14
- package/dist/file-upload-element.js.map +0 -1
- package/dist/file-upload.d.ts +0 -3
- package/dist/file-upload.js +0 -25
- package/dist/file-upload.js.map +0 -1
- package/dist/focus-links-element.d.ts +0 -3
- package/dist/focus-links-element.js +0 -10
- package/dist/focus-links-element.js.map +0 -1
- package/dist/focus-links.d.ts +0 -2
- package/dist/focus-links.js +0 -12
- package/dist/focus-links.js.map +0 -1
- package/dist/index--FxJgSOS.d.ts +0 -108
- package/dist/index-CikOyFud.d.ts +0 -54
- package/dist/index-D8N5vxTL.d.ts +0 -90
- package/dist/index-DMWpkC_d.d.ts +0 -105
- package/dist/index-DN7fGMc3.d.ts +0 -20
- package/dist/index-DPXR1Yua.d.ts +0 -69
- package/dist/inline-script.d.ts +0 -29
- package/dist/inline-script.js +0 -63
- package/dist/inline-script.js.map +0 -1
- package/dist/modal-element.js +0 -11
- package/dist/modal-element.js.map +0 -1
- package/dist/modal.d.ts +0 -2
- package/dist/modal.js +0 -20
- package/dist/modal.js.map +0 -1
- package/dist/password-input-element.d.ts +0 -3
- package/dist/password-input-element.js +0 -9
- package/dist/password-input-element.js.map +0 -1
- package/dist/password-input.d.ts +0 -2
- package/dist/password-input.js +0 -18
- package/dist/password-input.js.map +0 -1
- package/dist/tabs-element.js +0 -9
- package/dist/tabs-element.js.map +0 -1
- package/dist/tabs.d.ts +0 -2
- package/dist/tabs.js +0 -28
- package/dist/tabs.js.map +0 -1
- package/dist/translation-BnpO2mN2.d.ts +0 -4
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/auto-focus.d.ts
DELETED
package/dist/auto-focus.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use client";
|
|
3
|
-
import {
|
|
4
|
-
Root,
|
|
5
|
-
Target
|
|
6
|
-
} from "./chunk-6ZFU4VYW.js";
|
|
7
|
-
import "./chunk-XGK73UCD.js";
|
|
8
|
-
import "./chunk-LWIA644X.js";
|
|
9
|
-
import "./chunk-NX4B3NKM.js";
|
|
10
|
-
import "./chunk-ESBMTI25.js";
|
|
11
|
-
export {
|
|
12
|
-
Root,
|
|
13
|
-
Target
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=auto-focus.js.map
|
package/dist/auto-focus.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/autocomplete.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import 'react';
|
|
2
|
-
export { T as Translation } from './translation-BnpO2mN2.js';
|
|
3
|
-
export { Filter } from './autocomplete-element.js';
|
|
4
|
-
export { A as AssistiveHint, a as AssistiveHintProps, I as Input, b as InputProps, L as Listbox, c as ListboxProps, N as NoResults, d as NoResultsProps, O as Option, e as OptionProps, R as Root, f as RootProps, S as Status, g as StatusProps } from './index-D7lMYMUR.js';
|
package/dist/autocomplete.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use client";
|
|
3
|
-
import {
|
|
4
|
-
AssistiveHint,
|
|
5
|
-
Input,
|
|
6
|
-
Listbox,
|
|
7
|
-
NoResults,
|
|
8
|
-
Option,
|
|
9
|
-
Root,
|
|
10
|
-
Status
|
|
11
|
-
} from "./chunk-XJYLFTYE.js";
|
|
12
|
-
import "./chunk-U5OKNKYC.js";
|
|
13
|
-
import "./chunk-RDUPELOK.js";
|
|
14
|
-
import "./chunk-NX4B3NKM.js";
|
|
15
|
-
import "./chunk-ESBMTI25.js";
|
|
16
|
-
export {
|
|
17
|
-
AssistiveHint,
|
|
18
|
-
Input,
|
|
19
|
-
Listbox,
|
|
20
|
-
NoResults,
|
|
21
|
-
Option,
|
|
22
|
-
Root,
|
|
23
|
-
Status
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=autocomplete.js.map
|
package/dist/autocomplete.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/button-element.d.ts
DELETED
package/dist/button-element.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/button.d.ts
DELETED
package/dist/button.js
DELETED
package/dist/button.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import 'react';
|
|
2
|
-
export { C as CountType, D as Description, a as DescriptionProps, I as Input, b as InputProps, R as Root, c as RootProps, S as ScreenReaderStatus, d as ScreenReaderStatusProps, e as Status, f as StatusProps, g as countMessage, h as countOf } from './index-D8N5vxTL.js';
|
|
3
|
-
export { T as Translation } from './translation-BnpO2mN2.js';
|
package/dist/character-count.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use client";
|
|
3
|
-
import {
|
|
4
|
-
Description,
|
|
5
|
-
Input,
|
|
6
|
-
Root,
|
|
7
|
-
ScreenReaderStatus,
|
|
8
|
-
Status
|
|
9
|
-
} from "./chunk-QLQ6O7OW.js";
|
|
10
|
-
import {
|
|
11
|
-
countMessage,
|
|
12
|
-
countOf
|
|
13
|
-
} from "./chunk-UXJO4AJP.js";
|
|
14
|
-
import "./chunk-RDUPELOK.js";
|
|
15
|
-
import "./chunk-NX4B3NKM.js";
|
|
16
|
-
import "./chunk-ESBMTI25.js";
|
|
17
|
-
export {
|
|
18
|
-
Description,
|
|
19
|
-
Input,
|
|
20
|
-
Root,
|
|
21
|
-
ScreenReaderStatus,
|
|
22
|
-
Status,
|
|
23
|
-
countMessage,
|
|
24
|
-
countOf
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=character-count.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/choices-element.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/choices.d.ts
DELETED
package/dist/choices.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use client";
|
|
3
|
-
import {
|
|
4
|
-
Conditional,
|
|
5
|
-
Input,
|
|
6
|
-
Root
|
|
7
|
-
} from "./chunk-TJVBFRIE.js";
|
|
8
|
-
import "./chunk-ET7DCQM7.js";
|
|
9
|
-
import "./chunk-NX4B3NKM.js";
|
|
10
|
-
import "./chunk-ESBMTI25.js";
|
|
11
|
-
export {
|
|
12
|
-
Conditional,
|
|
13
|
-
Input,
|
|
14
|
-
Root
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=choices.js.map
|
package/dist/choices.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/chunk-2IHAQAYF.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import {
|
|
3
|
-
tagName
|
|
4
|
-
} from "./chunk-PNWPGD7B.js";
|
|
5
|
-
import {
|
|
6
|
-
__export
|
|
7
|
-
} from "./chunk-ESBMTI25.js";
|
|
8
|
-
|
|
9
|
-
// src/focus-links/index.tsx
|
|
10
|
-
var focus_links_exports = {};
|
|
11
|
-
__export(focus_links_exports, {
|
|
12
|
-
Root: () => Root
|
|
13
|
-
});
|
|
14
|
-
import * as React from "react";
|
|
15
|
-
function Root({ focusedClass, ...props }) {
|
|
16
|
-
return React.createElement(tagName, { ...props, "focused-class": focusedClass });
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export {
|
|
20
|
-
Root,
|
|
21
|
-
focus_links_exports
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=chunk-2IHAQAYF.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/focus-links/index.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { tagName } from './element';\n\n/*\n * Headless focus links: the <govuk-react-focus-links> element (./element.ts) makes links to a part\n * of the same page, inside it, move focus there. Links to a form field also scroll its label or\n * legend into view.\n */\n\nexport type RootProps = React.HTMLAttributes<HTMLElement> & {\n /** Classes for a target that isn't a form field while it has focus. */\n focusedClass?: string;\n};\n\nexport function Root({ focusedClass, ...props }: RootProps) {\n return React.createElement(tagName, { ...props, 'focused-class': focusedClass });\n}\n"],"mappings":";;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAEA,YAAY,WAAW;AAchB,SAAS,KAAK,EAAE,cAAc,GAAG,MAAM,GAAc;AAC1D,SAAa,oBAAc,SAAS,EAAE,GAAG,OAAO,iBAAiB,aAAa,CAAC;AACjF;","names":[]}
|
package/dist/chunk-2ZJVSNC2.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import {
|
|
3
|
-
Slot
|
|
4
|
-
} from "./chunk-NX4B3NKM.js";
|
|
5
|
-
import {
|
|
6
|
-
__export
|
|
7
|
-
} from "./chunk-ESBMTI25.js";
|
|
8
|
-
|
|
9
|
-
// src/button/index.tsx
|
|
10
|
-
var button_exports = {};
|
|
11
|
-
__export(button_exports, {
|
|
12
|
-
Root: () => Root
|
|
13
|
-
});
|
|
14
|
-
import * as React from "react";
|
|
15
|
-
function Root({ asChild, preventDoubleClick, ...props }) {
|
|
16
|
-
const Element = asChild ? Slot : "button";
|
|
17
|
-
return /* @__PURE__ */ React.createElement(
|
|
18
|
-
Element,
|
|
19
|
-
{
|
|
20
|
-
"data-button": "",
|
|
21
|
-
"data-prevent-double-click": preventDoubleClick === void 0 ? void 0 : String(preventDoubleClick),
|
|
22
|
-
...props
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export {
|
|
28
|
-
Root,
|
|
29
|
-
button_exports
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=chunk-2ZJVSNC2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/button/index.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { ComponentProps } from 'react';\nimport { Slot } from '../utils/slot';\nimport './element';\n\n/*\n * Headless button behaviour (./element.ts): `Root` marks a button or link button for it. Prevents\n * double clicks with `preventDoubleClick`, and makes Space activate a link with `role=\"button\"`.\n */\n\nexport type RootProps = ComponentProps<'button'> & {\n /** Render the only child instead, such as a link with `role=\"button\"`, with this part's props merged onto it. */\n asChild?: boolean;\n /** Cancel a second click within a second of the first, so a form isn't submitted twice. */\n preventDoubleClick?: boolean;\n};\n\nexport function Root({ asChild, preventDoubleClick, ...props }: RootProps) {\n const Element = asChild ? Slot : 'button';\n return (\n <Element\n data-button=\"\"\n data-prevent-double-click={preventDoubleClick === undefined ? undefined : String(preventDoubleClick)}\n {...props}\n />\n );\n}\n"],"mappings":";;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAEA,YAAY,WAAW;AAiBhB,SAAS,KAAK,EAAE,SAAS,oBAAoB,GAAG,MAAM,GAAc;AACzE,QAAM,UAAU,UAAU,OAAO;AACjC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAY;AAAA,MACZ,6BAA2B,uBAAuB,SAAY,SAAY,OAAO,kBAAkB;AAAA,MAClG,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
|
package/dist/chunk-47NMY4SS.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import {
|
|
3
|
-
tagName
|
|
4
|
-
} from "./chunk-L7E6GN2D.js";
|
|
5
|
-
import {
|
|
6
|
-
Slot
|
|
7
|
-
} from "./chunk-NX4B3NKM.js";
|
|
8
|
-
import {
|
|
9
|
-
__export
|
|
10
|
-
} from "./chunk-ESBMTI25.js";
|
|
11
|
-
|
|
12
|
-
// src/modal/index.tsx
|
|
13
|
-
var modal_exports = {};
|
|
14
|
-
__export(modal_exports, {
|
|
15
|
-
Close: () => Close,
|
|
16
|
-
Content: () => Content,
|
|
17
|
-
Root: () => Root,
|
|
18
|
-
Title: () => Title,
|
|
19
|
-
Trigger: () => Trigger
|
|
20
|
-
});
|
|
21
|
-
import * as React from "react";
|
|
22
|
-
import { createContext, useContext, useEffect, useId, useRef } from "react";
|
|
23
|
-
var ModalContext = createContext({});
|
|
24
|
-
function Root({ children, open, onOpenChange, dialogId: dialogIdProp, ...props }) {
|
|
25
|
-
const generatedId = useId();
|
|
26
|
-
const dialogId = dialogIdProp != null ? dialogIdProp : generatedId;
|
|
27
|
-
return /* @__PURE__ */ React.createElement(ModalContext.Provider, { value: { dialogId, titleId: `${dialogId}-title`, onOpenChange } }, React.createElement(
|
|
28
|
-
tagName,
|
|
29
|
-
{
|
|
30
|
-
...props,
|
|
31
|
-
open: open === void 0 ? void 0 : String(open),
|
|
32
|
-
suppressHydrationWarning: true
|
|
33
|
-
},
|
|
34
|
-
children
|
|
35
|
-
));
|
|
36
|
-
}
|
|
37
|
-
function Command({ command, asChild, dialogId, ...props }) {
|
|
38
|
-
const context = useContext(ModalContext);
|
|
39
|
-
const invoker = { command, commandfor: dialogId != null ? dialogId : context.dialogId };
|
|
40
|
-
if (asChild) return /* @__PURE__ */ React.createElement(Slot, { ...invoker, ...props });
|
|
41
|
-
return /* @__PURE__ */ React.createElement("button", { type: "button", ...invoker, ...props });
|
|
42
|
-
}
|
|
43
|
-
function Trigger(props) {
|
|
44
|
-
return /* @__PURE__ */ React.createElement(Command, { command: "show-modal", ...props });
|
|
45
|
-
}
|
|
46
|
-
function Close(props) {
|
|
47
|
-
return /* @__PURE__ */ React.createElement(Command, { command: "close", ...props });
|
|
48
|
-
}
|
|
49
|
-
function Content({ asChild, id, onClose, ref, ...props }) {
|
|
50
|
-
const context = useContext(ModalContext);
|
|
51
|
-
const reported = useRef(void 0);
|
|
52
|
-
const onOpenChange = useRef(context.onOpenChange);
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
onOpenChange.current = context.onOpenChange;
|
|
55
|
-
});
|
|
56
|
-
const report = (dialog) => {
|
|
57
|
-
var _a;
|
|
58
|
-
if (reported.current === dialog.open) return;
|
|
59
|
-
reported.current = dialog.open;
|
|
60
|
-
(_a = onOpenChange.current) == null ? void 0 : _a.call(onOpenChange, dialog.open);
|
|
61
|
-
};
|
|
62
|
-
const dialogRef = useRef(null);
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
var _a;
|
|
65
|
-
const dialog = dialogRef.current;
|
|
66
|
-
if ((dialog == null ? void 0 : dialog.open) && reported.current === void 0) {
|
|
67
|
-
reported.current = true;
|
|
68
|
-
(_a = onOpenChange.current) == null ? void 0 : _a.call(onOpenChange, true);
|
|
69
|
-
}
|
|
70
|
-
}, []);
|
|
71
|
-
const listen = (dialog) => {
|
|
72
|
-
dialogRef.current = dialog;
|
|
73
|
-
if (typeof ref === "function") ref(dialog);
|
|
74
|
-
else if (ref) ref.current = dialog;
|
|
75
|
-
if (!dialog) return void 0;
|
|
76
|
-
const onToggle = () => report(dialog);
|
|
77
|
-
dialog.addEventListener("toggle", onToggle);
|
|
78
|
-
return () => dialog.removeEventListener("toggle", onToggle);
|
|
79
|
-
};
|
|
80
|
-
const shared = {
|
|
81
|
-
id: id != null ? id : context.dialogId,
|
|
82
|
-
"aria-labelledby": props["aria-label"] ? void 0 : context.titleId,
|
|
83
|
-
ref: listen,
|
|
84
|
-
onClose: (event) => {
|
|
85
|
-
onClose == null ? void 0 : onClose(event);
|
|
86
|
-
report(event.currentTarget);
|
|
87
|
-
},
|
|
88
|
-
// The dialog's open state belongs to the browser.
|
|
89
|
-
suppressHydrationWarning: true
|
|
90
|
-
};
|
|
91
|
-
if (asChild) return /* @__PURE__ */ React.createElement(Slot, { ...shared, ...props });
|
|
92
|
-
return /* @__PURE__ */ React.createElement("dialog", { ...shared, ...props });
|
|
93
|
-
}
|
|
94
|
-
function Title({ asChild, ...props }) {
|
|
95
|
-
const context = useContext(ModalContext);
|
|
96
|
-
const Element = asChild ? Slot : "h2";
|
|
97
|
-
return /* @__PURE__ */ React.createElement(Element, { id: context.titleId, ...props });
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export {
|
|
101
|
-
Root,
|
|
102
|
-
Trigger,
|
|
103
|
-
Close,
|
|
104
|
-
Content,
|
|
105
|
-
Title,
|
|
106
|
-
modal_exports
|
|
107
|
-
};
|
|
108
|
-
//# sourceMappingURL=chunk-47NMY4SS.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/modal/index.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { createContext, useContext, useEffect, useId, useRef } from 'react';\nimport type { ComponentProps, ReactNode, SyntheticEvent } from 'react';\nimport { Slot } from '../utils/slot';\nimport { tagName } from './element';\n\n/*\n * Headless modal dialog: unstyled parts over a native `dialog` and the <govuk-react-modal>\n * element (./element.ts). Every part except Root takes `asChild`.\n *\n * Trigger and Close are buttons with invoker commands (`command` and `commandfor`), so where\n * the browser supports them the dialog opens as a true modal with no JavaScript: the page behind\n * is inert, focus moves into the dialog, and Escape closes it. The element runs the commands in\n * browsers without them, and applies `open` when controlled.\n *\n * Context only fills in ids: in an island without a Root, pass `dialogId` to Trigger and Close,\n * and `id` to Content.\n */\n\nconst ModalContext = createContext<{\n dialogId?: string;\n titleId?: string;\n onOpenChange?: (open: boolean) => void;\n}>({});\n\nexport type RootProps = Omit<React.HTMLAttributes<HTMLElement>, 'onChange'> & {\n children?: ReactNode;\n /** Whether the dialog is open, to control it. Without it, the buttons alone open and close it. */\n open?: boolean;\n /** Called when the dialog opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** The dialog's id, which the buttons' `commandfor` names. Defaults to a generated one. */\n dialogId?: string;\n};\n\nexport function Root({ children, open, onOpenChange, dialogId: dialogIdProp, ...props }: RootProps) {\n const generatedId = useId();\n const dialogId = dialogIdProp ?? generatedId;\n return (\n <ModalContext.Provider value={{ dialogId, titleId: `${dialogId}-title`, onOpenChange }}>\n {React.createElement(\n tagName,\n {\n ...props,\n open: open === undefined ? undefined : String(open),\n suppressHydrationWarning: true,\n },\n children\n )}\n </ModalContext.Provider>\n );\n}\n\ntype PartProps<E extends keyof React.JSX.IntrinsicElements> = ComponentProps<E> & {\n /** Render the only child instead, with this part's props merged onto it. */\n asChild?: boolean;\n};\n\ntype CommandProps = PartProps<'button'> & {\n /** The dialog's id. Set by Root. */\n dialogId?: string;\n};\n\nfunction Command({ command, asChild, dialogId, ...props }: CommandProps & { command: string }) {\n const context = useContext(ModalContext);\n // `command` and `commandfor` aren't in React's types yet, so they go in as a spread.\n const invoker = { command, commandfor: dialogId ?? context.dialogId };\n if (asChild) return <Slot {...invoker} {...props} />;\n return <button type=\"button\" {...invoker} {...props} />;\n}\n\nexport type TriggerProps = CommandProps;\n\n/** A button that opens the dialog as a modal. */\nexport function Trigger(props: TriggerProps) {\n return <Command command=\"show-modal\" {...props} />;\n}\n\nexport type CloseProps = CommandProps;\n\n/** A button that closes the dialog. */\nexport function Close(props: CloseProps) {\n return <Command command=\"close\" {...props} />;\n}\n\nexport type ContentProps = PartProps<'dialog'>;\n\n/**\n * The dialog. It's named by Title, unless you pass `aria-labelledby` or `aria-label`. Pass\n * `closedby=\"any\"` to also close it when the user clicks outside it.\n */\nexport function Content({ asChild, id, onClose, ref, ...props }: ContentProps) {\n const context = useContext(ModalContext);\n const reported = useRef<boolean | undefined>(undefined);\n const onOpenChange = useRef(context.onOpenChange);\n useEffect(() => {\n onOpenChange.current = context.onOpenChange;\n });\n // Report each change once: `toggle` fires on opening and closing where the browser fires it on\n // dialogs, and `close` on closing everywhere.\n const report = (dialog: HTMLDialogElement) => {\n if (reported.current === dialog.open) return;\n reported.current = dialog.open;\n onOpenChange.current?.(dialog.open);\n };\n // A dialog the user opened before hydration, through its invoker command or the element, fired\n // nothing React heard, so report it once.\n const dialogRef = useRef<HTMLDialogElement | null>(null);\n useEffect(() => {\n const dialog = dialogRef.current;\n if (dialog?.open && reported.current === undefined) {\n reported.current = true;\n onOpenChange.current?.(true);\n }\n }, []);\n // React doesn't listen for `toggle` on a dialog, so listen natively.\n const listen = (dialog: HTMLDialogElement | null) => {\n dialogRef.current = dialog;\n if (typeof ref === 'function') ref(dialog);\n else if (ref) ref.current = dialog;\n if (!dialog) return undefined;\n const onToggle = () => report(dialog);\n dialog.addEventListener('toggle', onToggle);\n return () => dialog.removeEventListener('toggle', onToggle);\n };\n const shared = {\n id: id ?? context.dialogId,\n 'aria-labelledby': props['aria-label'] ? undefined : context.titleId,\n ref: listen,\n onClose: (event: SyntheticEvent<HTMLDialogElement>) => {\n onClose?.(event);\n report(event.currentTarget);\n },\n // The dialog's open state belongs to the browser.\n suppressHydrationWarning: true,\n };\n if (asChild) return <Slot {...shared} {...props} />;\n return <dialog {...shared} {...props} />;\n}\n\nexport type TitleProps = PartProps<'h2'>;\n\n/** The dialog's heading, which names it. */\nexport function Title({ asChild, ...props }: TitleProps) {\n const context = useContext(ModalContext);\n const Element = asChild ? Slot : 'h2';\n return <Element id={context.titleId} {...props} />;\n}\n"],"mappings":";;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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
5
|
-
} from "./chunk-ECYGKE4D.js";
|
|
6
|
-
import {
|
|
7
|
-
Slot
|
|
8
|
-
} from "./chunk-NX4B3NKM.js";
|
|
9
|
-
import {
|
|
10
|
-
__export
|
|
11
|
-
} from "./chunk-ESBMTI25.js";
|
|
12
|
-
|
|
13
|
-
// src/exit-this-page/index.tsx
|
|
14
|
-
var exit_this_page_exports = {};
|
|
15
|
-
__export(exit_this_page_exports, {
|
|
16
|
-
Button: () => Button,
|
|
17
|
-
Indicator: () => Indicator,
|
|
18
|
-
Light: () => Light,
|
|
19
|
-
Root: () => Root,
|
|
20
|
-
SkipLink: () => SkipLink,
|
|
21
|
-
Status: () => Status,
|
|
22
|
-
defaultMessages: () => defaultMessages
|
|
23
|
-
});
|
|
24
|
-
import * as React from "react";
|
|
25
|
-
function Root({
|
|
26
|
-
activatedText,
|
|
27
|
-
timedOutText,
|
|
28
|
-
pressTwoMoreTimesText,
|
|
29
|
-
pressOneMoreTimeText,
|
|
30
|
-
indicatorVisibleClass,
|
|
31
|
-
lightOnClass,
|
|
32
|
-
hideContentClass,
|
|
33
|
-
overlayClass,
|
|
34
|
-
...props
|
|
35
|
-
}) {
|
|
36
|
-
return React.createElement(tagName, {
|
|
37
|
-
...props,
|
|
38
|
-
activated: activatedText,
|
|
39
|
-
"timed-out": timedOutText,
|
|
40
|
-
"press-two-more-times": pressTwoMoreTimesText,
|
|
41
|
-
"press-one-more-time": pressOneMoreTimeText,
|
|
42
|
-
"indicator-visible-class": indicatorVisibleClass,
|
|
43
|
-
"light-on-class": lightOnClass,
|
|
44
|
-
"hide-content-class": hideContentClass,
|
|
45
|
-
"overlay-class": overlayClass,
|
|
46
|
-
// The element owns `data-upgraded`.
|
|
47
|
-
suppressHydrationWarning: true
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
function Button({ asChild, ...props }) {
|
|
51
|
-
const Element = asChild ? Slot : "a";
|
|
52
|
-
return /* @__PURE__ */ React.createElement(Element, { "data-exit-this-page-button": "", ...props });
|
|
53
|
-
}
|
|
54
|
-
function SkipLink({ asChild, ...props }) {
|
|
55
|
-
const Element = asChild ? Slot : "a";
|
|
56
|
-
return /* @__PURE__ */ React.createElement(Element, { "data-exit-this-page-skiplink": "", ...props });
|
|
57
|
-
}
|
|
58
|
-
function Indicator({ asChild, children, ...props }) {
|
|
59
|
-
const Element = asChild ? Slot : "div";
|
|
60
|
-
return (
|
|
61
|
-
// The element owns `data-visible` and its classes.
|
|
62
|
-
/* @__PURE__ */ React.createElement(Element, { "data-exit-this-page-indicator": "", "aria-hidden": "true", suppressHydrationWarning: true, ...props }, children != null ? children : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Light, null), /* @__PURE__ */ React.createElement(Light, null), /* @__PURE__ */ React.createElement(Light, null)))
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
function Light({ asChild, ...props }) {
|
|
66
|
-
const Element = asChild ? Slot : "div";
|
|
67
|
-
return /* @__PURE__ */ React.createElement(Element, { "data-exit-this-page-light": "", suppressHydrationWarning: true, ...props });
|
|
68
|
-
}
|
|
69
|
-
function Status({ asChild, children, ...props }) {
|
|
70
|
-
const Element = asChild ? Slot : "span";
|
|
71
|
-
return /* @__PURE__ */ React.createElement(Element, { "data-exit-this-page-status": "", role: "status", suppressHydrationWarning: true, ...props }, children != null ? children : "");
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export {
|
|
75
|
-
Root,
|
|
76
|
-
Button,
|
|
77
|
-
SkipLink,
|
|
78
|
-
Indicator,
|
|
79
|
-
Light,
|
|
80
|
-
Status,
|
|
81
|
-
exit_this_page_exports
|
|
82
|
-
};
|
|
83
|
-
//# sourceMappingURL=chunk-4XAR4FFG.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/exit-this-page/index.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { ComponentProps } from 'react';\nimport { Slot } from '../utils/slot';\nimport { tagName } from './element';\n\nexport { defaultMessages, type ExitThisPageElement, type MessageName } from './element';\n\n/*\n * Headless exit this page: unstyled parts over the <govuk-react-exit-this-page> element\n * (./element.ts). The button, a SkipLink, or pressing Shift 3 times hides the page and goes to\n * the button's `href`. Every part except Root takes `asChild`.\n *\n * Without JavaScript the button is a plain link. To stay on the page, such as in a test, listen for\n * `govuk-react-exit-this-page:exit` and cancel it.\n */\n\nexport type RootProps = React.HTMLAttributes<HTMLElement> & {\n /** Announced once activated. Defaults to \"Loading.\". */\n activatedText?: string;\n /** Announced when the Shift presses time out. Defaults to \"Exit this page expired.\". */\n timedOutText?: string;\n /** Announced after one press of Shift. Defaults to \"Shift, press 2 more times to exit.\". */\n pressTwoMoreTimesText?: string;\n /** Announced after two presses of Shift. Defaults to \"Shift, press 1 more time to exit.\". */\n pressOneMoreTimeText?: string;\n /** Classes for the indicator while counting presses. */\n indicatorVisibleClass?: string;\n /** Classes for each light of the indicator once pressed. */\n lightOnClass?: string;\n /** Classes for `body` that hide the page behind the overlay. */\n hideContentClass?: string;\n /** Classes for the overlay. Without them, inline styles cover the page. */\n overlayClass?: string;\n};\n\nexport function Root({\n activatedText,\n timedOutText,\n pressTwoMoreTimesText,\n pressOneMoreTimeText,\n indicatorVisibleClass,\n lightOnClass,\n hideContentClass,\n overlayClass,\n ...props\n}: RootProps) {\n return React.createElement(tagName, {\n ...props,\n activated: activatedText,\n 'timed-out': timedOutText,\n 'press-two-more-times': pressTwoMoreTimesText,\n 'press-one-more-time': pressOneMoreTimeText,\n 'indicator-visible-class': indicatorVisibleClass,\n 'light-on-class': lightOnClass,\n 'hide-content-class': hideContentClass,\n 'overlay-class': overlayClass,\n // The element owns `data-upgraded`.\n suppressHydrationWarning: true,\n });\n}\n\ntype PartProps<E extends keyof React.JSX.IntrinsicElements> = ComponentProps<E> & {\n /** Render the only child instead, with this part's props merged onto it. */\n asChild?: boolean;\n};\n\nexport type ButtonProps = PartProps<'a'>;\n\n/** The link to a safe page, which the element follows once it has hidden the page. */\nexport function Button({ asChild, ...props }: ButtonProps) {\n const Element = asChild ? Slot : 'a';\n return <Element data-exit-this-page-button=\"\" {...props} />;\n}\n\nexport type SkipLinkProps = PartProps<'a'>;\n\n/** A link anywhere on the page, such as in the skip links, that exits too. */\nexport function SkipLink({ asChild, ...props }: SkipLinkProps) {\n const Element = asChild ? Slot : 'a';\n return <Element data-exit-this-page-skiplink=\"\" {...props} />;\n}\n\nexport type IndicatorProps = PartProps<'div'>;\n\n/** Shows how many times Shift has been pressed. Has three Lights unless given children. */\nexport function Indicator({ asChild, children, ...props }: IndicatorProps) {\n const Element = asChild ? Slot : 'div';\n return (\n // The element owns `data-visible` and its classes.\n <Element data-exit-this-page-indicator=\"\" aria-hidden=\"true\" suppressHydrationWarning {...props}>\n {children ?? (\n <>\n <Light />\n <Light />\n <Light />\n </>\n )}\n </Element>\n );\n}\n\nexport type LightProps = PartProps<'div'>;\n\n/** One press of Shift. */\nexport function Light({ asChild, ...props }: LightProps) {\n const Element = asChild ? Slot : 'div';\n // The element owns `data-on` and its classes.\n return <Element data-exit-this-page-light=\"\" suppressHydrationWarning {...props} />;\n}\n\nexport type StatusProps = PartProps<'span'>;\n\n/** Tells screen readers how many more presses are needed. Make it visually hidden. */\nexport function Status({ asChild, children, ...props }: StatusProps) {\n const Element = asChild ? Slot : 'span';\n // The element owns its text. A string child, even an empty one, is hydrated as text, so text the\n // element set before hydration is kept rather than being a mismatch.\n return (\n <Element data-exit-this-page-status=\"\" role=\"status\" suppressHydrationWarning {...props}>\n {children ?? ''}\n </Element>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAY,WAAW;AAmChB,SAAS,KAAK;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAc;AACZ,SAAa,oBAAc,SAA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4
|
-
statusText,
|
|
5
|
-
tagName
|
|
6
|
-
} from "./chunk-YCESNTXQ.js";
|
|
7
|
-
import {
|
|
8
|
-
translationAttributes
|
|
9
|
-
} from "./chunk-RDUPELOK.js";
|
|
10
|
-
import {
|
|
11
|
-
Slot
|
|
12
|
-
} from "./chunk-NX4B3NKM.js";
|
|
13
|
-
import {
|
|
14
|
-
__export
|
|
15
|
-
} from "./chunk-ESBMTI25.js";
|
|
16
|
-
|
|
17
|
-
// src/file-upload/index.tsx
|
|
18
|
-
var file_upload_exports = {};
|
|
19
|
-
__export(file_upload_exports, {
|
|
20
|
-
Announcements: () => Announcements,
|
|
21
|
-
Button: () => Button,
|
|
22
|
-
DropZone: () => DropZone,
|
|
23
|
-
Input: () => Input,
|
|
24
|
-
Root: () => Root,
|
|
25
|
-
Separator: () => Separator,
|
|
26
|
-
Status: () => Status
|
|
27
|
-
});
|
|
28
|
-
import * as React from "react";
|
|
29
|
-
import { createContext, useContext, useState } from "react";
|
|
30
|
-
var InitialStatus = createContext(defaults["no-file-chosen"]);
|
|
31
|
-
function Root({
|
|
32
|
-
noFileChosen,
|
|
33
|
-
multipleFilesChosen,
|
|
34
|
-
enteredDropZone,
|
|
35
|
-
leftDropZone,
|
|
36
|
-
emptyClass,
|
|
37
|
-
draggingClass,
|
|
38
|
-
disabledClass,
|
|
39
|
-
...props
|
|
40
|
-
}) {
|
|
41
|
-
const [initial] = useState(() => statusText([], { "no-file-chosen": noFileChosen }, props.lang || "en"));
|
|
42
|
-
return /* @__PURE__ */ React.createElement(InitialStatus.Provider, { value: initial }, React.createElement(tagName, {
|
|
43
|
-
...props,
|
|
44
|
-
// The element owns `data-upgraded`.
|
|
45
|
-
suppressHydrationWarning: true,
|
|
46
|
-
"no-file-chosen": noFileChosen,
|
|
47
|
-
...translationAttributes("multiple-files-chosen", multipleFilesChosen),
|
|
48
|
-
"entered-drop-zone": enteredDropZone,
|
|
49
|
-
"left-drop-zone": leftDropZone,
|
|
50
|
-
"empty-class": emptyClass,
|
|
51
|
-
"dragging-class": draggingClass,
|
|
52
|
-
"disabled-class": disabledClass
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
function DropZone({ asChild, ...props }) {
|
|
56
|
-
const Element = asChild ? Slot : "div";
|
|
57
|
-
return /* @__PURE__ */ React.createElement(Element, { "data-file-upload-drop-zone": "", suppressHydrationWarning: true, ...props });
|
|
58
|
-
}
|
|
59
|
-
function Input({ asChild, ...props }) {
|
|
60
|
-
const Element = asChild ? Slot : "input";
|
|
61
|
-
return /* @__PURE__ */ React.createElement(Element, { type: "file", suppressHydrationWarning: true, ...props });
|
|
62
|
-
}
|
|
63
|
-
function Button({ asChild, ...props }) {
|
|
64
|
-
const Element = asChild ? Slot : "button";
|
|
65
|
-
return /* @__PURE__ */ React.createElement(Element, { "data-file-upload-button": "", type: "button", hidden: true, suppressHydrationWarning: true, ...props });
|
|
66
|
-
}
|
|
67
|
-
function Status({ asChild, children, ...props }) {
|
|
68
|
-
const initial = useContext(InitialStatus);
|
|
69
|
-
const Element = asChild ? Slot : "span";
|
|
70
|
-
return /* @__PURE__ */ React.createElement(Element, { "data-file-upload-status": "", "aria-live": "polite", suppressHydrationWarning: true, ...props }, children != null ? children : initial);
|
|
71
|
-
}
|
|
72
|
-
function Separator({ asChild, children = ", ", ...props }) {
|
|
73
|
-
const Element = asChild ? Slot : "span";
|
|
74
|
-
return /* @__PURE__ */ React.createElement(Element, { "data-file-upload-separator": "", suppressHydrationWarning: true, ...props }, children);
|
|
75
|
-
}
|
|
76
|
-
function Announcements({ asChild, ...props }) {
|
|
77
|
-
const Element = asChild ? Slot : "span";
|
|
78
|
-
return /* @__PURE__ */ React.createElement(Element, { "data-file-upload-announcements": "", "aria-live": "assertive", suppressHydrationWarning: true, ...props });
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export {
|
|
82
|
-
Root,
|
|
83
|
-
DropZone,
|
|
84
|
-
Input,
|
|
85
|
-
Button,
|
|
86
|
-
Status,
|
|
87
|
-
Separator,
|
|
88
|
-
Announcements,
|
|
89
|
-
file_upload_exports
|
|
90
|
-
};
|
|
91
|
-
//# sourceMappingURL=chunk-5HWRMQK2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/file-upload/index.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { createContext, useContext, useState } from 'react';\nimport type { ComponentProps } from 'react';\nimport { Slot } from '../utils/slot';\nimport { translationAttributes, type Translation } from '../utils/translation';\nimport { defaults, statusText, tagName } from './element';\n\nexport type { Translation } from '../utils/translation';\n\n/*\n * Headless file upload: unstyled parts over the <govuk-react-file-upload> element (./element.ts),\n * which shows the button on upgrade, hides the input and handles dropped files. Every part except\n * Root takes `asChild`.\n *\n * The input's files are the state, owned by the browser, so there is nothing to control. Without\n * JavaScript the native file input shows and the button stays hidden.\n */\n\nexport type RootProps = React.HTMLAttributes<HTMLElement> & {\n /** Shown while no file is chosen. Defaults to \"No file chosen\". */\n noFileChosen?: string;\n /** Shown when more than one file is chosen. `%{count}` is the number. Defaults to \"%{count} files chosen\". */\n multipleFilesChosen?: Translation;\n /** Announced when the user drags files into the drop zone. Defaults to \"Entered drop zone\". */\n enteredDropZone?: string;\n /** Announced when the user drags files out of the drop zone. Defaults to \"Left drop zone\". */\n leftDropZone?: string;\n /** Classes for the button while no file is chosen. */\n emptyClass?: string;\n /** Classes for the button while files are dragged over the drop zone. */\n draggingClass?: string;\n /** Classes for the drop zone while the input is disabled. */\n disabledClass?: string;\n};\n\n// What the status starts with, so the element only changes text React rendered.\nconst InitialStatus = createContext<string>(defaults['no-file-chosen']);\n\nexport function Root({\n noFileChosen,\n multipleFilesChosen,\n enteredDropZone,\n leftDropZone,\n emptyClass,\n draggingClass,\n disabledClass,\n ...props\n}: RootProps) {\n // Rendered once and then left to the element, so a re-render never puts back a stale status.\n const [initial] = useState(() => statusText([], { 'no-file-chosen': noFileChosen }, props.lang || 'en'));\n return (\n <InitialStatus.Provider value={initial}>\n {React.createElement(tagName, {\n ...props,\n // The element owns `data-upgraded`.\n suppressHydrationWarning: true,\n 'no-file-chosen': noFileChosen,\n ...translationAttributes('multiple-files-chosen', multipleFilesChosen),\n 'entered-drop-zone': enteredDropZone,\n 'left-drop-zone': leftDropZone,\n 'empty-class': emptyClass,\n 'dragging-class': draggingClass,\n 'disabled-class': disabledClass,\n })}\n </InitialStatus.Provider>\n );\n}\n\ntype PartProps<E extends keyof React.JSX.IntrinsicElements> = ComponentProps<E> & {\n /** Render the only child instead, with this part's props merged onto it. */\n asChild?: boolean;\n};\n\nexport type DropZoneProps = PartProps<'div'>;\n\n/** The area that shows files are being dragged over it. Holds the button and the input. */\nexport function DropZone({ asChild, ...props }: DropZoneProps) {\n const Element = asChild ? Slot : 'div';\n // The element owns its disabled classes after upgrade.\n return <Element data-file-upload-drop-zone=\"\" suppressHydrationWarning {...props} />;\n}\n\nexport type InputProps = Omit<PartProps<'input'>, 'type'>;\n\n/** The file input, with an `id` and a `label`. Shown without JavaScript, and hidden on upgrade. */\nexport function Input({ asChild, ...props }: InputProps) {\n const Element = asChild ? Slot : 'input';\n // The element owns `id` and `hidden` after upgrade.\n return <Element type=\"file\" suppressHydrationWarning {...props} />;\n}\n\nexport type ButtonProps = PartProps<'button'>;\n\n/**\n * Opens the file picker, and takes dropped files. Hidden until the element upgrades, when it\n * takes the input's id, so the input's label names it. Holds `Status`.\n */\nexport function Button({ asChild, ...props }: ButtonProps) {\n const Element = asChild ? Slot : 'button';\n // The element owns `id`, `hidden`, `disabled`, its ARIA and its classes after upgrade.\n return <Element data-file-upload-button=\"\" type=\"button\" hidden suppressHydrationWarning {...props} />;\n}\n\nexport type StatusProps = PartProps<'span'>;\n\n/** Which files are chosen: \"No file chosen\", the file's name, or how many files. In `Button`. */\nexport function Status({ asChild, children, ...props }: StatusProps) {\n const initial = useContext(InitialStatus);\n const Element = asChild ? Slot : 'span';\n // The element owns its text after upgrade.\n return (\n <Element data-file-upload-status=\"\" aria-live=\"polite\" suppressHydrationWarning {...props}>\n {children ?? initial}\n </Element>\n );\n}\n\nexport type SeparatorProps = PartProps<'span'>;\n\n/** Between the label and the button's text in the button's accessible name. Defaults to \", \". In `Button`. */\nexport function Separator({ asChild, children = ', ', ...props }: SeparatorProps) {\n const Element = asChild ? Slot : 'span';\n // The element owns its `id` after upgrade.\n return (\n <Element data-file-upload-separator=\"\" suppressHydrationWarning {...props}>\n {children}\n </Element>\n );\n}\n\nexport type AnnouncementsProps = PartProps<'span'>;\n\n/** Announces entering and leaving the drop zone. Make it visually hidden. */\nexport function Announcements({ asChild, ...props }: AnnouncementsProps) {\n const Element = asChild ? Slot : 'span';\n // The element owns its text after upgrade.\n return <Element data-file-upload-announcements=\"\" aria-live=\"assertive\" suppressHydrationWarning {...props} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAY,WAAW;AACvB,SAAS,eAAe,YAAY,gBAAgB;AAmCpD,IAAM,gBAAgB,cAAsB,SAAS,gBAAgB,CAAC;AAE/D,SAAS,KAAK;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAc;AAEZ,QAAM,CAAC,OAAO,IAAI,SAAS,MAAM,WAAW,CAAC,GAAG,EAAE,kBAAkB,aAAa,GAAG,MAAM,QAAQ,IAAI,CAAC;AACvG,SACE,oCAAC,cAAc,UAAd,EAAuB,OAAO,WACtB,oBAAc,SAAS;AAAA,IAC5B,GAAG;AAAA;AAAA,IAEH,0BAA0B;AAAA,IAC1B,kBAAkB;AAAA,IAClB,GAAG,sBAAsB,yBAAyB,mBAAmB;AAAA,IACrE,qBAAqB;AAAA,IACrB,kBAAkB;AAAA,IAClB,eAAe;AAAA,IACf,kBAAkB;AAAA,IAClB,kBAAkB;AAAA,EACpB,CAAC,CACH;AAEJ;AAUO,SA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