@modernpoacher/sprockets 0.0.288 → 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 +93 -35
- 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
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as Description } from '#sprockets/super/components/description'
|
|
2
|
+
export { default as ErrorMessage } from '#sprockets/super/components/error-message'
|
|
3
|
+
export { default as Group } from '#sprockets/super/components/group'
|
|
4
|
+
export { default as Title } from '#sprockets/super/components/title'
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as Description } from '#sprockets/super/components/description'
|
|
2
|
+
export { default as ErrorMessage } from '#sprockets/super/components/error-message'
|
|
3
|
+
export { default as Group } from '#sprockets/super/components/group'
|
|
4
|
+
export { default as Title } from '#sprockets/super/components/title'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import debug from 'debug'
|
|
2
|
+
|
|
3
|
+
const log = debug('@modernpoacher/sprockets/super/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'
|
|
@@ -0,0 +1,20 @@
|
|
|
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/super/components/title')
|
|
10
|
+
|
|
11
|
+
log('`sprockets` is awake')
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
default: Title
|
|
15
|
+
} = require('./index.jsx')
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Exports only default
|
|
19
|
+
*/
|
|
20
|
+
module.exports = Title
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare module '#sprockets/super/components/title' {
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
export type TitleProps = SprocketsTypes.Super.Components.Title.TitleProps
|
|
5
|
+
|
|
6
|
+
export default class Title<P extends TitleProps> extends React.Component<P> {
|
|
7
|
+
static propTypes: object
|
|
8
|
+
|
|
9
|
+
getClassName (): string
|
|
10
|
+
|
|
11
|
+
shouldComponentUpdate (props: TitleProps): boolean
|
|
12
|
+
|
|
13
|
+
renderTextContent (textContent: string): React.JSX.Element
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare module '@modernpoacher/sprockets/super/components/title' {
|
|
18
|
+
export { default } from '#sprockets/super/components/title'
|
|
19
|
+
export * from '#sprockets/super/components/title'
|
|
20
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {SprocketsTypes.Super.Components.Title.TitleProps} TitleProps
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Title component
|
|
7
|
+
*/
|
|
8
|
+
import React, { Component } from 'react'
|
|
9
|
+
import PropTypes from 'prop-types'
|
|
10
|
+
|
|
11
|
+
import TextContent from '#sprockets/components/common/text-content'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @extends {Component<TitleProps>}
|
|
15
|
+
*/
|
|
16
|
+
export default class Title extends Component {
|
|
17
|
+
getClassName () {
|
|
18
|
+
return 'title'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @param {TitleProps} props
|
|
23
|
+
* @returns {boolean}
|
|
24
|
+
*/
|
|
25
|
+
shouldComponentUpdate (props) {
|
|
26
|
+
return (
|
|
27
|
+
(props.title !== this.props.title)
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @param {string} textContent
|
|
33
|
+
* @returns {React.JSX.Element}
|
|
34
|
+
*/
|
|
35
|
+
renderTextContent (textContent) {
|
|
36
|
+
return (
|
|
37
|
+
<TextContent
|
|
38
|
+
textContent={textContent}
|
|
39
|
+
/>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
render () {
|
|
44
|
+
const {
|
|
45
|
+
title
|
|
46
|
+
} = this.props
|
|
47
|
+
|
|
48
|
+
if (title) {
|
|
49
|
+
return (
|
|
50
|
+
<legend className={this.getClassName()}>
|
|
51
|
+
{this.renderTextContent(title)}
|
|
52
|
+
</legend>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return null
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
Title.propTypes = {
|
|
61
|
+
title: PropTypes.string
|
|
62
|
+
}
|
|
@@ -6,12 +6,15 @@ require('@babel/register')({
|
|
|
6
6
|
|
|
7
7
|
const debug = require('debug')
|
|
8
8
|
|
|
9
|
-
const log = debug('@modernpoacher/sprockets/sprockets
|
|
9
|
+
const log = debug('@modernpoacher/sprockets/super/sprockets')
|
|
10
10
|
|
|
11
11
|
log('`sprockets` is awake')
|
|
12
12
|
|
|
13
13
|
const {
|
|
14
|
-
default:
|
|
14
|
+
default: Sprocket
|
|
15
15
|
} = require('./index.jsx')
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Exports only default
|
|
19
|
+
*/
|
|
20
|
+
module.exports = Sprocket
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare module '#sprockets/super/sprockets' {
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
export type SprocketProps = SprocketsTypes.Super.Sprockets.SprocketProps
|
|
5
|
+
|
|
6
|
+
export default class Sprocket<P extends SprocketProps> extends React.Component<P> {
|
|
7
|
+
static propTypes: object
|
|
8
|
+
|
|
9
|
+
getClassName (): string
|
|
10
|
+
|
|
11
|
+
shouldComponentUpdate (props: SprocketProps): boolean
|
|
12
|
+
|
|
13
|
+
renderTitle (): React.JSX.Element | null
|
|
14
|
+
|
|
15
|
+
renderGroup (): React.JSX.Element | null
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare module '@modernpoacher/sprockets/super/sprockets' {
|
|
20
|
+
export { default } from '#sprockets/super/sprockets'
|
|
21
|
+
export * from '#sprockets/super/sprockets'
|
|
22
|
+
}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @typedef {import('@modernpoacher/sprockets/sprockets').SprocketProps} SprocketProps
|
|
2
|
+
* @typedef {SprocketsTypes.Super.Sprockets.SprocketProps} SprocketProps
|
|
5
3
|
*/
|
|
6
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Sprocket component
|
|
7
|
+
*/
|
|
7
8
|
import React, { Component } from 'react'
|
|
8
9
|
import PropTypes from 'prop-types'
|
|
9
10
|
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
} from '#sprockets/common'
|
|
13
|
-
|
|
14
|
-
import Title from '#sprockets/components/title'
|
|
15
|
-
import Group from '#sprockets/components/group'
|
|
11
|
+
import Title from '#sprockets/super/components/title'
|
|
12
|
+
import Group from '#sprockets/super/components/group'
|
|
16
13
|
|
|
17
14
|
export default class Sprocket extends Component {
|
|
18
15
|
getClassName () {
|
|
@@ -20,14 +17,13 @@ export default class Sprocket extends Component {
|
|
|
20
17
|
}
|
|
21
18
|
|
|
22
19
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
20
|
+
* @param {SprocketProps} props
|
|
21
|
+
* @returns {boolean}
|
|
25
22
|
*/
|
|
26
|
-
shouldComponentUpdate (props
|
|
23
|
+
shouldComponentUpdate (props) {
|
|
27
24
|
return (
|
|
28
25
|
(props.children !== this.props.children) ||
|
|
29
|
-
(props.title !== this.props.title)
|
|
30
|
-
(props.onChange !== this.props.onChange)
|
|
26
|
+
(props.title !== this.props.title)
|
|
31
27
|
)
|
|
32
28
|
}
|
|
33
29
|
|
|
@@ -45,14 +41,12 @@ export default class Sprocket extends Component {
|
|
|
45
41
|
|
|
46
42
|
renderGroup () {
|
|
47
43
|
const {
|
|
48
|
-
onChange = DEFAULT_HANDLE_CHANGE,
|
|
49
44
|
groupRef,
|
|
50
45
|
children
|
|
51
46
|
} = this.props
|
|
52
47
|
|
|
53
48
|
return (
|
|
54
49
|
<Group
|
|
55
|
-
onChange={onChange}
|
|
56
50
|
groupRef={groupRef}>
|
|
57
51
|
{this.renderTitle()}
|
|
58
52
|
{children}
|
|
@@ -73,7 +67,6 @@ export default class Sprocket extends Component {
|
|
|
73
67
|
|
|
74
68
|
Sprocket.propTypes = {
|
|
75
69
|
title: PropTypes.string,
|
|
76
|
-
onChange: PropTypes.func,
|
|
77
70
|
children: PropTypes.oneOfType([
|
|
78
71
|
PropTypes.node,
|
|
79
72
|
PropTypes.arrayOf(
|
|
@@ -81,6 +74,6 @@ Sprocket.propTypes = {
|
|
|
81
74
|
)
|
|
82
75
|
]),
|
|
83
76
|
groupRef: PropTypes.shape({
|
|
84
|
-
current: PropTypes.shape()
|
|
77
|
+
current: PropTypes.shape({})
|
|
85
78
|
})
|
|
86
79
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function getKey (href: string, text: string, index: number): string
|
|
@@ -5,13 +5,13 @@ const CHAR45 = String.fromCharCode(45)
|
|
|
5
5
|
|
|
6
6
|
const log = debug('@modernpoacher/sprockets/transformers/common')
|
|
7
7
|
|
|
8
|
-
log('`
|
|
8
|
+
log('`sprockets` is awake')
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* @param {string} href
|
|
12
|
+
* @param {string} text
|
|
13
|
+
* @param {number} index
|
|
14
|
+
* @returns {string}
|
|
15
15
|
*/
|
|
16
16
|
export function getKey (href, text, index) {
|
|
17
17
|
return (
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as common from '#sprockets/transformers/common'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as common from './common/index.mjs'
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
@use "design-system/palette";
|
|
2
|
+
@use "design-system/typography";
|
|
3
|
+
|
|
4
|
+
@use "sprockets/error-summary";
|
|
5
|
+
@use "sprockets/check-answers";
|
|
6
|
+
@use "sprockets/error";
|
|
7
|
+
|
|
8
|
+
@mixin sprockets {
|
|
9
|
+
padding: 0;
|
|
10
|
+
margin: 1rem 0;
|
|
11
|
+
|
|
12
|
+
&:first-child {
|
|
13
|
+
margin-top: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&:last-child {
|
|
17
|
+
margin-bottom: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
line-height: 1.375rem;
|
|
21
|
+
|
|
22
|
+
&.error-summary {
|
|
23
|
+
@include error-summary.sprocket-error-summary;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.check-answers {
|
|
27
|
+
@include check-answers.sprocket-check-answers;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&.fieldset {
|
|
31
|
+
legend {
|
|
32
|
+
@include typography.heading-m;
|
|
33
|
+
|
|
34
|
+
& /* stylelint-disable-line no-duplicate-selectors */ {
|
|
35
|
+
padding: 0;
|
|
36
|
+
margin-top: 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.error {
|
|
41
|
+
@include error.sprocket-error;
|
|
42
|
+
|
|
43
|
+
padding-left: 1rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.description {
|
|
47
|
+
@include typography.secondary-text;
|
|
48
|
+
|
|
49
|
+
& /* stylelint-disable-line no-duplicate-selectors */ {
|
|
50
|
+
display: block;
|
|
51
|
+
padding: 0;
|
|
52
|
+
margin: 0 0 0.25rem 0;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.error-message {
|
|
57
|
+
@include typography.error-standard;
|
|
58
|
+
|
|
59
|
+
& /* stylelint-disable-line no-duplicate-selectors */ {
|
|
60
|
+
display: block;
|
|
61
|
+
padding: 0;
|
|
62
|
+
margin: 0 0 0.25rem 0;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Descendants
|
|
69
|
+
*/
|
|
70
|
+
.sprocket {
|
|
71
|
+
margin-bottom: 0;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
%sprockets {
|
|
76
|
+
@include sprockets;
|
|
77
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
@use "design-system/helpers/invisible";
|
|
2
|
+
|
|
3
|
+
@use "design-system/palette";
|
|
4
|
+
@use "design-system/typography";
|
|
5
|
+
|
|
6
|
+
@mixin sprocket-check-answers {
|
|
7
|
+
& > h2:first-child {
|
|
8
|
+
margin-top: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
dl {
|
|
12
|
+
display: table;
|
|
13
|
+
width: 100%;
|
|
14
|
+
table-layout: fixed;
|
|
15
|
+
|
|
16
|
+
.answer {
|
|
17
|
+
display: table-row;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
dt,
|
|
21
|
+
dd {
|
|
22
|
+
display: table-cell;
|
|
23
|
+
padding: 0.25rem 0;
|
|
24
|
+
border-bottom: 2px solid palette.$grey-1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.answer-title {
|
|
28
|
+
@include typography.heading-s;
|
|
29
|
+
|
|
30
|
+
& /* stylelint-disable-line no-duplicate-selectors */ {
|
|
31
|
+
width: 30%;
|
|
32
|
+
padding-right: 1rem;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.answer-value {
|
|
37
|
+
width: 50%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.change-answer {
|
|
41
|
+
width: 20%;
|
|
42
|
+
padding-left: 1rem;
|
|
43
|
+
text-align: right;
|
|
44
|
+
|
|
45
|
+
.visually-hidden-text {
|
|
46
|
+
@include invisible.invisible;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
%sprocket-check-answers {
|
|
53
|
+
@include sprocket-check-answers;
|
|
54
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
@use "design-system/helpers/invisible";
|
|
2
|
+
|
|
3
|
+
@use "design-system/palette";
|
|
4
|
+
@use "design-system/typography";
|
|
5
|
+
|
|
6
|
+
@mixin sprocket-error-summary {
|
|
7
|
+
background-color: palette.$white;
|
|
8
|
+
border: 0.25rem solid palette.$error-standard;
|
|
9
|
+
display: block;
|
|
10
|
+
padding: 1rem;
|
|
11
|
+
line-height: 2rem;
|
|
12
|
+
|
|
13
|
+
& > h2:first-child {
|
|
14
|
+
margin-top: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
ul {
|
|
18
|
+
margin-bottom: 0;
|
|
19
|
+
padding: 0;
|
|
20
|
+
list-style-type: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
li {
|
|
24
|
+
@include typography.error-standard;
|
|
25
|
+
|
|
26
|
+
& /* stylelint-disable-line no-duplicate-selectors */ {
|
|
27
|
+
display: block;
|
|
28
|
+
padding: 0;
|
|
29
|
+
margin: 0 0 0.25rem 0;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
a {
|
|
34
|
+
@include typography.error-standard;
|
|
35
|
+
|
|
36
|
+
&:focus {
|
|
37
|
+
outline: 3px solid transparent;
|
|
38
|
+
text-decoration: none;
|
|
39
|
+
outline-offset: 0;
|
|
40
|
+
box-shadow:
|
|
41
|
+
0 -2px palette.$outline,
|
|
42
|
+
0 4px palette.$black;
|
|
43
|
+
color: palette.$standard;
|
|
44
|
+
background-color: palette.$outline;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&:focus {
|
|
49
|
+
outline: 3px solid palette.$outline;
|
|
50
|
+
outline-offset: 0;
|
|
51
|
+
border-color: palette.$black;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
%sprocket-error-summary {
|
|
56
|
+
@include sprocket-error-summary;
|
|
57
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@use "design-system/palette";
|
|
2
|
+
@use "design-system/typography";
|
|
3
|
+
|
|
4
|
+
@mixin sprocket-error {
|
|
5
|
+
border-left: 0.25rem solid palette.$error-standard;
|
|
6
|
+
|
|
7
|
+
input:not([type="checkbox"]):not([type="radio"]),
|
|
8
|
+
select,
|
|
9
|
+
textarea {
|
|
10
|
+
border: 2px solid palette.$error-standard;
|
|
11
|
+
|
|
12
|
+
&:focus {
|
|
13
|
+
border-color: palette.$black;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&.radio,
|
|
18
|
+
&.checkbox {
|
|
19
|
+
padding-left: 4rem;
|
|
20
|
+
|
|
21
|
+
input /* stylelint-disable-line no-descending-specificity */ {
|
|
22
|
+
left: 1.5rem;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
label:before /* stylelint-disable-line no-descending-specificity */ {
|
|
26
|
+
left: 1rem;
|
|
27
|
+
|
|
28
|
+
border: 2px solid palette.$error-standard;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.radio {
|
|
33
|
+
input:checked + label:after {
|
|
34
|
+
left: 1.5rem;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&.checkbox {
|
|
39
|
+
input:checked + label:after {
|
|
40
|
+
left: 1.3125rem; // 21px;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
%sprocket-error {
|
|
46
|
+
@include sprocket-error;
|
|
47
|
+
}
|
package/jsconfig.json
DELETED
package/src/common/index.d.mts
DELETED
package/src/common/index.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
declare module '#sprockets/components/group' {
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
export interface GroupProps {
|
|
5
|
-
onChange: SprocketsTypes.onEventType
|
|
6
|
-
groupRef: object
|
|
7
|
-
children: React.JSX.Element | React.JSX.Element[]
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default class Group extends React.Component<GroupProps> {}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
declare module '@modernpoacher/sprockets/components/group' {
|
|
14
|
-
export { default } from '#sprockets/components/group'
|
|
15
|
-
export * from '#sprockets/components/group'
|
|
16
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Group component
|
|
3
|
-
*
|
|
4
|
-
* @typedef {import('@modernpoacher/sprockets/components/group').GroupProps} GroupProps
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React, { Component } from 'react'
|
|
8
|
-
import PropTypes from 'prop-types'
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
DEFAULT_HANDLE_CHANGE
|
|
12
|
-
} from '#sprockets/common'
|
|
13
|
-
|
|
14
|
-
export default class Group extends Component {
|
|
15
|
-
getClassName () {
|
|
16
|
-
return 'group'
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @param {GroupProps} props
|
|
21
|
-
* @returns {boolean}
|
|
22
|
-
*/
|
|
23
|
-
shouldComponentUpdate (props, state) {
|
|
24
|
-
return (
|
|
25
|
-
(props.onChange !== this.props.onChange) ||
|
|
26
|
-
(props.children !== this.props.children)
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
render () {
|
|
31
|
-
const {
|
|
32
|
-
onChange = DEFAULT_HANDLE_CHANGE,
|
|
33
|
-
groupRef,
|
|
34
|
-
children
|
|
35
|
-
} = this.props
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<fieldset
|
|
39
|
-
onChange={onChange}
|
|
40
|
-
className={this.getClassName()}
|
|
41
|
-
ref={groupRef}>
|
|
42
|
-
{children}
|
|
43
|
-
</fieldset>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
Group.propTypes = {
|
|
49
|
-
onChange: PropTypes.func,
|
|
50
|
-
children: PropTypes.oneOfType([
|
|
51
|
-
PropTypes.node,
|
|
52
|
-
PropTypes.arrayOf(
|
|
53
|
-
PropTypes.node
|
|
54
|
-
)
|
|
55
|
-
]),
|
|
56
|
-
groupRef: PropTypes.shape({
|
|
57
|
-
current: PropTypes.shape().isRequired
|
|
58
|
-
})
|
|
59
|
-
}
|