@modernpoacher/sprockets 0.0.287 → 1.0.0
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/.prettierignore +4 -0
- package/babel.config.cjs +6 -2
- package/eslint.config.mjs +33 -71
- package/index.d.mts +156 -6
- package/jest.after-each.mjs +10 -0
- package/jest.before-each.mjs +10 -0
- package/jest.config.mjs +11 -1
- package/package.json +103 -45
- package/src/js/components/common/text-content/index.cjs +20 -0
- package/src/js/components/common/text-content/index.d.cts +2 -0
- package/src/{components → js/components}/common/text-content/index.d.mts +1 -3
- package/src/{components → js/components}/common/text-content/index.jsx +7 -6
- package/src/{components → js/components}/common/visually-hidden-text/index.cjs +5 -2
- package/src/js/components/common/visually-hidden-text/index.d.cts +2 -0
- package/src/{components → js/components}/common/visually-hidden-text/index.d.mts +1 -3
- package/src/{components → js/components}/common/visually-hidden-text/index.jsx +7 -6
- package/src/{components → js/components}/description/index.cjs +5 -2
- package/src/js/components/description/index.d.cts +2 -0
- package/src/{components → js/components}/description/index.d.mts +2 -7
- package/src/js/components/description/index.jsx +5 -0
- package/src/{components → js/components}/error-message/index.cjs +5 -2
- package/src/js/components/error-message/index.d.cts +2 -0
- package/src/{components → js/components}/error-message/index.d.mts +2 -7
- package/src/js/components/error-message/index.jsx +5 -0
- package/src/{components → js/components}/group/index.cjs +5 -2
- package/src/js/components/group/index.d.cts +2 -0
- package/src/js/components/group/index.d.mts +9 -0
- package/src/js/components/group/index.jsx +5 -0
- package/src/js/components/index.cjs +32 -0
- package/src/js/components/index.d.cts +4 -0
- package/src/js/components/index.d.mts +4 -0
- package/src/js/components/index.mjs +10 -0
- package/src/{components → js/components}/title/index.cjs +5 -2
- package/src/js/components/title/index.d.cts +2 -0
- package/src/{components → js/components}/title/index.d.mts +2 -7
- package/src/js/components/title/index.jsx +5 -0
- package/src/js/index.d.cts +34 -0
- package/src/js/index.d.mts +34 -0
- package/src/js/sprockets/check-answers/group/answer-item.d.cts +1 -0
- package/src/js/sprockets/check-answers/group/answer-item.d.mts +11 -0
- package/src/{sprockets → js/sprockets}/check-answers/group/answer-item.jsx +9 -0
- package/src/{sprockets → js/sprockets}/check-answers/group/answer-title.cjs +1 -0
- package/src/js/sprockets/check-answers/group/answer-title.d.cts +1 -0
- package/src/js/sprockets/check-answers/group/answer-title.d.mts +9 -0
- package/src/{sprockets → js/sprockets}/check-answers/group/answer-title.jsx +2 -2
- package/src/{sprockets → js/sprockets}/check-answers/group/answer-value.cjs +1 -0
- package/src/js/sprockets/check-answers/group/answer-value.d.cts +1 -0
- package/src/js/sprockets/check-answers/group/answer-value.d.mts +9 -0
- package/src/js/sprockets/check-answers/group/answer-value.jsx +63 -0
- package/src/{sprockets → js/sprockets}/check-answers/group/change-answer.cjs +1 -0
- package/src/js/sprockets/check-answers/group/change-answer.d.cts +1 -0
- package/src/js/sprockets/check-answers/group/change-answer.d.mts +9 -0
- package/src/{sprockets → js/sprockets}/check-answers/group/change-answer.jsx +20 -12
- package/src/{sprockets → js/sprockets}/check-answers/group/index.cjs +5 -2
- package/src/js/sprockets/check-answers/group/index.d.cts +2 -0
- package/src/js/sprockets/check-answers/group/index.d.mts +13 -0
- package/src/js/sprockets/check-answers/group/index.jsx +134 -0
- package/src/{sprockets → js/sprockets}/check-answers/index.cjs +5 -2
- package/src/js/sprockets/check-answers/index.d.cts +2 -0
- package/src/js/sprockets/check-answers/index.d.mts +12 -0
- package/src/{sprockets → js/sprockets}/check-answers/index.jsx +25 -12
- package/src/{sprockets → js/sprockets}/check-answers/title/index.cjs +5 -2
- package/src/js/sprockets/check-answers/title/index.d.cts +2 -0
- package/src/js/sprockets/check-answers/title/index.d.mts +12 -0
- package/src/js/sprockets/check-answers/title/index.jsx +37 -0
- package/src/{sprockets → js/sprockets}/error-summary/group/index.cjs +5 -2
- package/src/js/sprockets/error-summary/group/index.d.cts +2 -0
- package/src/js/sprockets/error-summary/group/index.d.mts +13 -0
- package/src/js/sprockets/error-summary/group/index.jsx +124 -0
- package/src/{sprockets → js/sprockets}/error-summary/index.cjs +5 -2
- package/src/js/sprockets/error-summary/index.d.cts +2 -0
- package/src/js/sprockets/error-summary/index.d.mts +12 -0
- package/src/{sprockets → js/sprockets}/error-summary/index.jsx +26 -13
- package/src/{sprockets → js/sprockets}/error-summary/title/index.cjs +5 -2
- package/src/js/sprockets/error-summary/title/index.d.cts +2 -0
- package/src/js/sprockets/error-summary/title/index.d.mts +12 -0
- package/src/js/sprockets/error-summary/title/index.jsx +37 -0
- package/src/{sprockets → js/sprockets}/fieldset/description/index.cjs +5 -2
- package/src/js/sprockets/fieldset/description/index.d.cts +1 -0
- package/src/{sprockets → js/sprockets}/fieldset/description/index.jsx +2 -7
- package/src/{sprockets → js/sprockets}/fieldset/error-message/index.cjs +5 -2
- package/src/js/sprockets/fieldset/error-message/index.d.cts +1 -0
- package/src/{sprockets → js/sprockets}/fieldset/error-message/index.d.mts +1 -1
- package/src/{sprockets → js/sprockets}/fieldset/error-message/index.jsx +2 -7
- package/src/{sprockets → js/sprockets}/fieldset/group/index.cjs +5 -2
- package/src/js/sprockets/fieldset/group/index.d.cts +2 -0
- package/src/js/sprockets/fieldset/group/index.d.mts +13 -0
- package/src/js/sprockets/fieldset/group/index.jsx +21 -0
- package/src/{sprockets → js/sprockets}/fieldset/index.cjs +5 -2
- package/src/js/sprockets/fieldset/index.d.cts +2 -0
- package/src/js/sprockets/fieldset/index.d.mts +18 -0
- package/src/{sprockets → js/sprockets}/fieldset/index.jsx +26 -26
- package/src/{sprockets → js/sprockets}/fieldset/title/index.cjs +5 -2
- package/src/js/sprockets/fieldset/title/index.d.cts +2 -0
- package/src/js/sprockets/fieldset/title/index.d.mts +12 -0
- package/src/js/sprockets/fieldset/title/index.jsx +20 -0
- package/src/{sprockets → js/sprockets}/index.cjs +5 -5
- package/src/js/sprockets/index.d.cts +2 -0
- package/src/js/sprockets/index.d.mts +9 -0
- package/src/js/sprockets/index.jsx +5 -0
- package/src/js/super/components/description/index.cjs +20 -0
- package/src/js/super/components/description/index.d.cts +2 -0
- package/src/js/super/components/description/index.d.mts +18 -0
- package/src/{components → js/super/components}/description/index.jsx +15 -3
- package/src/js/super/components/error-message/index.cjs +20 -0
- package/src/js/super/components/error-message/index.d.cts +2 -0
- package/src/js/super/components/error-message/index.d.mts +27 -0
- package/src/{components → js/super/components}/error-message/index.jsx +8 -6
- package/src/js/super/components/group/index.cjs +20 -0
- package/src/js/super/components/group/index.d.cts +2 -0
- package/src/js/super/components/group/index.d.mts +19 -0
- package/src/js/super/components/group/index.jsx +59 -0
- package/src/js/super/components/index.cjs +32 -0
- package/src/js/super/components/index.d.cts +4 -0
- package/src/js/super/components/index.d.mts +4 -0
- package/src/js/super/components/index.mjs +10 -0
- package/src/js/super/components/title/index.cjs +20 -0
- package/src/js/super/components/title/index.d.cts +2 -0
- package/src/js/super/components/title/index.d.mts +20 -0
- package/src/js/super/components/title/index.jsx +62 -0
- package/src/{components/common/text-content → js/super/sprockets}/index.cjs +6 -3
- package/src/js/super/sprockets/index.d.cts +2 -0
- package/src/js/super/sprockets/index.d.mts +22 -0
- package/src/{sprockets → js/super/sprockets}/index.jsx +11 -18
- package/src/js/transformers/common/index.d.mts +1 -0
- package/src/{transformers → js/transformers}/common/index.mjs +5 -5
- package/src/js/transformers/index.d.mts +1 -0
- package/src/js/transformers/index.mjs +1 -0
- package/src/sass/.stylelintrc +14 -0
- package/src/sass/_sprockets.scss +77 -0
- package/src/sass/sprockets/_check-answers.scss +54 -0
- package/src/sass/sprockets/_error-summary.scss +57 -0
- package/src/sass/sprockets/_error.scss +47 -0
- package/jsconfig.json +0 -5
- package/src/common/index.d.mts +0 -9
- package/src/common/index.mjs +0 -7
- package/src/components/group/index.d.mts +0 -16
- package/src/components/group/index.jsx +0 -59
- package/src/components/title/index.jsx +0 -59
- package/src/index.d.mts +0 -9
- package/src/sprockets/check-answers/group/answer-value.jsx +0 -46
- package/src/sprockets/check-answers/group/index.d.mts +0 -9
- package/src/sprockets/check-answers/group/index.jsx +0 -125
- package/src/sprockets/check-answers/index.d.mts +0 -9
- package/src/sprockets/check-answers/title/index.d.mts +0 -9
- package/src/sprockets/check-answers/title/index.jsx +0 -29
- package/src/sprockets/error-summary/group/error-item.cjs +0 -13
- package/src/sprockets/error-summary/group/error-item.jsx +0 -22
- package/src/sprockets/error-summary/group/index.d.mts +0 -9
- package/src/sprockets/error-summary/group/index.jsx +0 -115
- package/src/sprockets/error-summary/index.d.mts +0 -9
- package/src/sprockets/error-summary/title/index.d.mts +0 -9
- package/src/sprockets/error-summary/title/index.jsx +0 -29
- package/src/sprockets/fieldset/group/index.d.mts +0 -9
- package/src/sprockets/fieldset/group/index.jsx +0 -16
- package/src/sprockets/fieldset/index.d.mts +0 -9
- package/src/sprockets/fieldset/title/index.d.mts +0 -9
- package/src/sprockets/fieldset/title/index.jsx +0 -15
- package/src/sprockets/index.d.mts +0 -17
- package/src/transformers/common/index.d.mts +0 -7
- package/tsconfig.json +0 -18
- /package/src/{index.cjs → js/index.cjs} +0 -0
- /package/src/{index.mjs → js/index.mjs} +0 -0
- /package/src/{sprockets → js/sprockets}/check-answers/group/answer-item.cjs +0 -0
- /package/src/{sprockets → js/sprockets}/fieldset/description/index.d.mts +0 -0
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
declare module '#sprockets/components/common/text-content' {
|
|
2
2
|
import type React from 'react'
|
|
3
3
|
|
|
4
|
-
export
|
|
5
|
-
textContent: string
|
|
6
|
-
}
|
|
4
|
+
export type TextContentProps = SprocketsTypes.Components.Common.TextContent.TextContentProps
|
|
7
5
|
|
|
8
6
|
export default function TextContent (props: TextContentProps): React.JSX.Element | null
|
|
9
7
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TextContent
|
|
3
|
-
*
|
|
4
|
-
* @typedef {import('@modernpoacher/sprockets/components/common/text-content').TextContentProps} TextContentProps
|
|
2
|
+
* @typedef {SprocketsTypes.Components.Common.TextContent.TextContentProps} TextContentProps
|
|
5
3
|
*/
|
|
6
4
|
|
|
5
|
+
/**
|
|
6
|
+
* TextContent component
|
|
7
|
+
*/
|
|
7
8
|
import React from 'react'
|
|
8
9
|
import PropTypes from 'prop-types'
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
12
|
+
* @param {TextContentProps} props
|
|
13
|
+
* @returns {React.JSX.Element | null}
|
|
13
14
|
*/
|
|
14
15
|
export default function TextContent ({ textContent }) {
|
|
15
16
|
if (textContent) {
|
|
@@ -24,5 +25,5 @@ export default function TextContent ({ textContent }) {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
TextContent.propTypes = {
|
|
27
|
-
textContent: PropTypes.string
|
|
28
|
+
textContent: PropTypes.string
|
|
28
29
|
}
|
|
@@ -11,7 +11,10 @@ const log = debug('@modernpoacher/sprockets/components/common/visually-hidden-te
|
|
|
11
11
|
log('`sprockets` is awake')
|
|
12
12
|
|
|
13
13
|
const {
|
|
14
|
-
default:
|
|
14
|
+
default: VisuallyHiddenText
|
|
15
15
|
} = require('./index.jsx')
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Exports only default
|
|
19
|
+
*/
|
|
20
|
+
module.exports = VisuallyHiddenText
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
declare module '#sprockets/components/common/visually-hidden-text' {
|
|
2
2
|
import type React from 'react'
|
|
3
3
|
|
|
4
|
-
export
|
|
5
|
-
visuallyHiddenText: string
|
|
6
|
-
}
|
|
4
|
+
export type VisuallyHiddenTextProps = SprocketsTypes.Components.Common.VisuallyHiddenText.VisuallyHiddenTextProps
|
|
7
5
|
|
|
8
6
|
export default function VisuallyHiddenText (props: VisuallyHiddenTextProps): React.JSX.Element | null
|
|
9
7
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* VisuallyHiddenText
|
|
3
|
-
*
|
|
4
|
-
* @typedef {import('@modernpoacher/sprockets/components/common/visually-hidden-text').VisuallyHiddenTextProps} VisuallyHiddenTextProps
|
|
2
|
+
* @typedef {SprocketsTypes.Components.Common.VisuallyHiddenText.VisuallyHiddenTextProps} VisuallyHiddenTextProps
|
|
5
3
|
*/
|
|
6
4
|
|
|
5
|
+
/**
|
|
6
|
+
* VisuallyHiddenText component
|
|
7
|
+
*/
|
|
7
8
|
import React from 'react'
|
|
8
9
|
import PropTypes from 'prop-types'
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
12
|
+
* @param {VisuallyHiddenTextProps} props
|
|
13
|
+
* @returns {React.JSX.Element | null}
|
|
13
14
|
*/
|
|
14
15
|
export default function VisuallyHiddenText ({ visuallyHiddenText }) {
|
|
15
16
|
if (visuallyHiddenText) {
|
|
@@ -24,5 +25,5 @@ export default function VisuallyHiddenText ({ visuallyHiddenText }) {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
VisuallyHiddenText.propTypes = {
|
|
27
|
-
visuallyHiddenText: PropTypes.string
|
|
28
|
+
visuallyHiddenText: PropTypes.string
|
|
28
29
|
}
|
|
@@ -11,7 +11,10 @@ const log = debug('@modernpoacher/sprockets/components/description')
|
|
|
11
11
|
log('`sprockets` is awake')
|
|
12
12
|
|
|
13
13
|
const {
|
|
14
|
-
default:
|
|
14
|
+
default: Description
|
|
15
15
|
} = require('./index.jsx')
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Exports only default
|
|
19
|
+
*/
|
|
20
|
+
module.exports = Description
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
declare module '#sprockets/components/description' {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export interface DescriptionProps {
|
|
5
|
-
description: string
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export default class Description extends React.Component<DescriptionProps> {}
|
|
2
|
+
export { default } from '#sprockets/super/components/description'
|
|
3
|
+
export * from '#sprockets/super/components/description'
|
|
9
4
|
}
|
|
10
5
|
|
|
11
6
|
declare module '@modernpoacher/sprockets/components/description' {
|
|
@@ -11,7 +11,10 @@ const log = debug('@modernpoacher/sprockets/components/error-message')
|
|
|
11
11
|
log('`sprockets` is awake')
|
|
12
12
|
|
|
13
13
|
const {
|
|
14
|
-
default:
|
|
14
|
+
default: ErrorMessage
|
|
15
15
|
} = require('./index.jsx')
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Exports only default
|
|
19
|
+
*/
|
|
20
|
+
module.exports = ErrorMessage
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
declare module '#sprockets/components/error-message' {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export interface ErrorMessageProps {
|
|
5
|
-
errorMessage: string
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export default class ErrorMessage extends React.Component<ErrorMessageProps> {}
|
|
2
|
+
export { default } from '#sprockets/super/components/error-message'
|
|
3
|
+
export * from '#sprockets/super/components/error-message'
|
|
9
4
|
}
|
|
10
5
|
|
|
11
6
|
declare module '@modernpoacher/sprockets/components/error-message' {
|
|
@@ -11,7 +11,10 @@ const log = debug('@modernpoacher/sprockets/components/group')
|
|
|
11
11
|
log('`sprockets` is awake')
|
|
12
12
|
|
|
13
13
|
const {
|
|
14
|
-
default:
|
|
14
|
+
default: Group
|
|
15
15
|
} = require('./index.jsx')
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Exports only default
|
|
19
|
+
*/
|
|
20
|
+
module.exports = Group
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare module '#sprockets/components/group' {
|
|
2
|
+
export { default } from '#sprockets/super/components/group'
|
|
3
|
+
export * from '#sprockets/super/components/group'
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
declare module '@modernpoacher/sprockets/components/group' {
|
|
7
|
+
export { default } from '#sprockets/components/group'
|
|
8
|
+
export * from '#sprockets/components/group'
|
|
9
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require('@babel/register')({
|
|
2
|
+
ignore: [
|
|
3
|
+
/node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/sprockets|@modernpoacher\/gremlins)/
|
|
4
|
+
]
|
|
5
|
+
})
|
|
6
|
+
|
|
7
|
+
const debug = require('debug')
|
|
8
|
+
|
|
9
|
+
const log = debug('@modernpoacher/sprockets/components')
|
|
10
|
+
|
|
11
|
+
log('`sprockets` is awake')
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
default: Description
|
|
15
|
+
} = require('./description/index.jsx')
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
default: ErrorMessage
|
|
19
|
+
} = require('./error-message/index.jsx')
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
default: Group
|
|
23
|
+
} = require('./group/index.jsx')
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
default: Title
|
|
27
|
+
} = require('./title/index.jsx')
|
|
28
|
+
|
|
29
|
+
module.exports.Description = Description
|
|
30
|
+
module.exports.ErrorMessage = ErrorMessage
|
|
31
|
+
module.exports.Group = Group
|
|
32
|
+
module.exports.Title = Title
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as Description } from '#sprockets/components/description'
|
|
2
|
+
export { default as ErrorMessage } from '#sprockets/components/error-message'
|
|
3
|
+
export { default as Group } from '#sprockets/components/group'
|
|
4
|
+
export { default as Title } from '#sprockets/components/title'
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as Description } from '#sprockets/components/description'
|
|
2
|
+
export { default as ErrorMessage } from '#sprockets/components/error-message'
|
|
3
|
+
export { default as Group } from '#sprockets/components/group'
|
|
4
|
+
export { default as Title } from '#sprockets/components/title'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import debug from 'debug'
|
|
2
|
+
|
|
3
|
+
const log = debug('@modernpoacher/sprockets/components')
|
|
4
|
+
|
|
5
|
+
log('`sprockets` is awake')
|
|
6
|
+
|
|
7
|
+
export { default as Description } from './description/index.cjs'
|
|
8
|
+
export { default as ErrorMessage } from './error-message/index.cjs'
|
|
9
|
+
export { default as Group } from './group/index.cjs'
|
|
10
|
+
export { default as Title } from './title/index.cjs'
|
|
@@ -11,7 +11,10 @@ const log = debug('@modernpoacher/sprockets/components/title')
|
|
|
11
11
|
log('`sprockets` is awake')
|
|
12
12
|
|
|
13
13
|
const {
|
|
14
|
-
default:
|
|
14
|
+
default: Title
|
|
15
15
|
} = require('./index.jsx')
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Exports only default
|
|
19
|
+
*/
|
|
20
|
+
module.exports = Title
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
declare module '#sprockets/components/title' {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export interface TitleProps {
|
|
5
|
-
title: string
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export default class Title extends React.Component<TitleProps> {}
|
|
2
|
+
export { default } from '#sprockets/super/components/title'
|
|
3
|
+
export * from '#sprockets/super/components/title'
|
|
9
4
|
}
|
|
10
5
|
|
|
11
6
|
declare module '@modernpoacher/sprockets/components/title' {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type CheckAnswersSprocket from '#sprockets/sprockets/check-answers'
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
CheckAnswersProps
|
|
5
|
+
} from '#sprockets/sprockets/check-answers'
|
|
6
|
+
|
|
7
|
+
import type ErrorSummarySprocket from '#sprockets/sprockets/error-summary'
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
ErrorSummaryProps
|
|
11
|
+
} from '#sprockets/sprockets/error-summary'
|
|
12
|
+
|
|
13
|
+
import type FieldsetSprocket from '#sprockets/sprockets/fieldset'
|
|
14
|
+
|
|
15
|
+
import type {
|
|
16
|
+
FieldsetProps
|
|
17
|
+
} from '#sprockets/sprockets/fieldset'
|
|
18
|
+
|
|
19
|
+
export type AnswerDefinitionType = SprocketsTypes.AnswerDefinitionType
|
|
20
|
+
export type FieldChangeType = SprocketsTypes.FieldChangeType
|
|
21
|
+
export type ErrorDefinitionType = SprocketsTypes.ErrorDefinitionType
|
|
22
|
+
export type FieldErrorType = SprocketsTypes.FieldErrorType
|
|
23
|
+
|
|
24
|
+
export { default as CheckAnswersSprocket } from '#sprockets/sprockets/check-answers'
|
|
25
|
+
export { default as ErrorSummarySprocket } from '#sprockets/sprockets/error-summary'
|
|
26
|
+
export { default as FieldsetSprocket } from '#sprockets/sprockets/fieldset'
|
|
27
|
+
|
|
28
|
+
declare const sprockets: {
|
|
29
|
+
CheckAnswersSprocket: CheckAnswersSprocket<CheckAnswersProps>
|
|
30
|
+
ErrorSummarySprocket: ErrorSummarySprocket<ErrorSummaryProps>
|
|
31
|
+
FieldsetSprocket: FieldsetSprocket<FieldsetProps>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default sprockets
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type CheckAnswersSprocket from '#sprockets/sprockets/check-answers'
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
CheckAnswersProps
|
|
5
|
+
} from '#sprockets/sprockets/check-answers'
|
|
6
|
+
|
|
7
|
+
import type ErrorSummarySprocket from '#sprockets/sprockets/error-summary'
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
ErrorSummaryProps
|
|
11
|
+
} from '#sprockets/sprockets/error-summary'
|
|
12
|
+
|
|
13
|
+
import type FieldsetSprocket from '#sprockets/sprockets/fieldset'
|
|
14
|
+
|
|
15
|
+
import type {
|
|
16
|
+
FieldsetProps
|
|
17
|
+
} from '#sprockets/sprockets/fieldset'
|
|
18
|
+
|
|
19
|
+
export type AnswerDefinitionType = SprocketsTypes.AnswerDefinitionType
|
|
20
|
+
export type FieldChangeType = SprocketsTypes.FieldChangeType
|
|
21
|
+
export type ErrorDefinitionType = SprocketsTypes.ErrorDefinitionType
|
|
22
|
+
export type FieldErrorType = SprocketsTypes.FieldErrorType
|
|
23
|
+
|
|
24
|
+
export { default as CheckAnswersSprocket } from '#sprockets/sprockets/check-answers'
|
|
25
|
+
export { default as ErrorSummarySprocket } from '#sprockets/sprockets/error-summary'
|
|
26
|
+
export { default as FieldsetSprocket } from '#sprockets/sprockets/fieldset'
|
|
27
|
+
|
|
28
|
+
declare const sprockets: {
|
|
29
|
+
CheckAnswersSprocket: CheckAnswersSprocket<CheckAnswersProps>
|
|
30
|
+
ErrorSummarySprocket: ErrorSummarySprocket<ErrorSummaryProps>
|
|
31
|
+
FieldsetSprocket: FieldsetSprocket<FieldsetProps>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default sprockets
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '#sprockets/sprockets/check-answers/group/answer-item'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare module '#sprockets/sprockets/check-answers/group/answer-item' {
|
|
2
|
+
import type React from 'react'
|
|
3
|
+
|
|
4
|
+
type AnswerDefinitionType = SprocketsTypes.AnswerDefinitionType
|
|
5
|
+
|
|
6
|
+
export default function AnswerItem (props: AnswerDefinitionType): React.JSX.Element
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare module '@modernpoacher/sprockets/sprockets/check-answers/group/answer-item' {
|
|
10
|
+
export { default } from '#sprockets/sprockets/check-answers/group/answer-item'
|
|
11
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {SprocketsTypes.AnswerDefinitionType} AnswerDefinitionType
|
|
3
|
+
*/
|
|
4
|
+
|
|
1
5
|
import React from 'react'
|
|
2
6
|
import PropTypes from 'prop-types'
|
|
3
7
|
|
|
@@ -5,6 +9,11 @@ import AnswerTitle from './answer-title.jsx'
|
|
|
5
9
|
import AnswerValue from './answer-value.jsx'
|
|
6
10
|
import ChangeAnswer from './change-answer.jsx'
|
|
7
11
|
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param {AnswerDefinitionType} props
|
|
15
|
+
* @returns {React.JSX.Element}
|
|
16
|
+
*/
|
|
8
17
|
export default function AnswerItem ({ answer: { title, value }, changeAnswer: { href, text, visuallyHiddenText } }) {
|
|
9
18
|
return (
|
|
10
19
|
<div className='answer'>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '#sprockets/sprockets/check-answers/group/answer-title'
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare module '#sprockets/sprockets/check-answers/group/answer-title' {
|
|
2
|
+
import type React from 'react'
|
|
3
|
+
|
|
4
|
+
export default function AnswerItem (props: { title: string }): React.JSX.Element
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare module '@modernpoacher/sprockets/sprockets/check-answers/group/answer-title' {
|
|
8
|
+
export { default } from '#sprockets/sprockets/check-answers/group/answer-title'
|
|
9
|
+
}
|
|
@@ -2,8 +2,8 @@ import React from 'react'
|
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* @param {{ title: string }} props
|
|
6
|
+
* @returns {React.JSX.Element}
|
|
7
7
|
*/
|
|
8
8
|
export default function AnswerTitle ({ title }) {
|
|
9
9
|
return (
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '#sprockets/sprockets/check-answers/group/answer-value'
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare module '#sprockets/sprockets/check-answers/group/answer-value' {
|
|
2
|
+
import type React from 'react'
|
|
3
|
+
|
|
4
|
+
export default function AnswerValue (props: { value: string | string[] }): React.JSX.Element
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare module '@modernpoacher/sprockets/sprockets/check-answers/group/answer-value' {
|
|
8
|
+
export { default } from '#sprockets/sprockets/check-answers/group/answer-value'
|
|
9
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {number} n
|
|
6
|
+
* @returns {(
|
|
7
|
+
* a: Array<string | React.JSX.Element>,
|
|
8
|
+
* v: string,
|
|
9
|
+
* i: number
|
|
10
|
+
* ) => Array<string | React.JSX.Element>}
|
|
11
|
+
*/
|
|
12
|
+
function getReduce (n) {
|
|
13
|
+
/**
|
|
14
|
+
* @param {Array<string | React.JSX.Element>} a
|
|
15
|
+
* @param {string} v
|
|
16
|
+
* @param {number} i
|
|
17
|
+
* @returns {Array<string | React.JSX.Element>}
|
|
18
|
+
*/
|
|
19
|
+
return function reduce (a, v, i) {
|
|
20
|
+
const s = String(v)
|
|
21
|
+
|
|
22
|
+
return (i !== n)
|
|
23
|
+
? a.concat(s).concat(<br key={i} />)
|
|
24
|
+
: a.concat(s)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @param {string | string[]} value
|
|
30
|
+
* @returns {string | Array<string | React.JSX.Element>}
|
|
31
|
+
*/
|
|
32
|
+
function getAnswerValue (value) {
|
|
33
|
+
if (Array.isArray(value)) {
|
|
34
|
+
const n = value.length - 1
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
value.reduce(getReduce(n), [])
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return String(value)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @param {{ value: string | string[] }} props
|
|
46
|
+
* @returns {React.JSX.Element}
|
|
47
|
+
*/
|
|
48
|
+
export default function AnswerValue ({ value }) {
|
|
49
|
+
return (
|
|
50
|
+
<dd className='answer-value'>
|
|
51
|
+
{getAnswerValue(value)}
|
|
52
|
+
</dd>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
AnswerValue.propTypes = {
|
|
57
|
+
value: PropTypes.oneOfType([
|
|
58
|
+
PropTypes.string,
|
|
59
|
+
PropTypes.arrayOf(
|
|
60
|
+
PropTypes.string
|
|
61
|
+
)
|
|
62
|
+
]).isRequired
|
|
63
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '#sprockets/sprockets/check-answers/group/answer-value'
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare module '#sprockets/sprockets/check-answers/group/change-answer' {
|
|
2
|
+
import type React from 'react'
|
|
3
|
+
|
|
4
|
+
export default function ChangeAnswer (props: { href: string; text: string; visuallyHiddenText?: string }): React.JSX.Element
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare module '@modernpoacher/sprockets/sprockets/check-answers/group/change-answer' {
|
|
8
|
+
export { default } from '#sprockets/sprockets/check-answers/group/change-answer'
|
|
9
|
+
}
|
|
@@ -12,6 +12,10 @@ import VisuallyHiddenText from '#sprockets/components/common/visually-hidden-tex
|
|
|
12
12
|
|
|
13
13
|
const log = debug('@modernpoacher/sprockets/sprockets/check-answers/group/change-answer')
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* @param {{ textContent?: string, visuallyHiddenText: string }} props
|
|
17
|
+
* @returns {React.JSX.Element | null}
|
|
18
|
+
*/
|
|
15
19
|
function TextContentWithVisuallyHiddenText ({ textContent, visuallyHiddenText }) {
|
|
16
20
|
return (
|
|
17
21
|
<>
|
|
@@ -23,10 +27,14 @@ function TextContentWithVisuallyHiddenText ({ textContent, visuallyHiddenText })
|
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
TextContentWithVisuallyHiddenText.propTypes = {
|
|
26
|
-
textContent: PropTypes.string
|
|
27
|
-
visuallyHiddenText: PropTypes.string
|
|
30
|
+
textContent: PropTypes.string,
|
|
31
|
+
visuallyHiddenText: PropTypes.string
|
|
28
32
|
}
|
|
29
33
|
|
|
34
|
+
/**
|
|
35
|
+
* @param {{ textContent?: string, visuallyHiddenText?: string }} props
|
|
36
|
+
* @returns {React.JSX.Element | null}
|
|
37
|
+
*/
|
|
30
38
|
function LinkText ({ textContent, visuallyHiddenText }) {
|
|
31
39
|
if (textContent) {
|
|
32
40
|
return (
|
|
@@ -35,18 +43,20 @@ function LinkText ({ textContent, visuallyHiddenText }) {
|
|
|
35
43
|
: <TextContent textContent={textContent} />
|
|
36
44
|
)
|
|
37
45
|
}
|
|
46
|
+
|
|
47
|
+
return null
|
|
38
48
|
}
|
|
39
49
|
|
|
40
50
|
LinkText.propTypes = {
|
|
41
|
-
textContent: PropTypes.string
|
|
42
|
-
visuallyHiddenText: PropTypes.string
|
|
51
|
+
textContent: PropTypes.string,
|
|
52
|
+
visuallyHiddenText: PropTypes.string
|
|
43
53
|
}
|
|
44
54
|
|
|
45
55
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
56
|
+
* @param {{ href: string, text: string, visuallyHiddenText?: string }} props
|
|
57
|
+
* @returns {React.JSX.Element}
|
|
48
58
|
*/
|
|
49
|
-
export default function ChangeAnswer ({
|
|
59
|
+
export default function ChangeAnswer ({ href, text, visuallyHiddenText }) {
|
|
50
60
|
log('ChangeAnswer')
|
|
51
61
|
|
|
52
62
|
return (
|
|
@@ -59,9 +69,7 @@ export default function ChangeAnswer ({ changeAnswer: { href, text, visuallyHidd
|
|
|
59
69
|
}
|
|
60
70
|
|
|
61
71
|
ChangeAnswer.propTypes = {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
visuallyHiddenText: PropTypes.string.isRequired
|
|
66
|
-
}).isRequired
|
|
72
|
+
href: PropTypes.string.isRequired,
|
|
73
|
+
text: PropTypes.string.isRequired,
|
|
74
|
+
visuallyHiddenText: PropTypes.string
|
|
67
75
|
}
|
|
@@ -11,7 +11,10 @@ const log = debug('@modernpoacher/sprockets/sprockets/check-answers/group')
|
|
|
11
11
|
log('`sprockets` is awake')
|
|
12
12
|
|
|
13
13
|
const {
|
|
14
|
-
default:
|
|
14
|
+
default: Group
|
|
15
15
|
} = require('./index.jsx')
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Exports only default
|
|
19
|
+
*/
|
|
20
|
+
module.exports = Group
|