shinkansen-sprockets 1.1.91 → 1.1.93
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/babel.config.cjs +15 -18
- package/package.json +24 -23
- package/src/components/description/index.jsx +1 -25
- package/src/components/group/index.jsx +6 -5
- package/src/index.d.cts +51 -49
- package/src/{components/group/check-answers → sprockets/check-answers/group}/answer-title.cjs +1 -1
- package/src/{components/group/check-answers → sprockets/check-answers/group}/answer-title.jsx +1 -1
- package/src/{components/group/check-answers → sprockets/check-answers/group}/answer-value.cjs +1 -1
- package/src/{components/group/check-answers → sprockets/check-answers/group}/answer-value.jsx +1 -1
- package/src/{components/group/check-answers → sprockets/check-answers/group}/change-answer.cjs +1 -1
- package/src/{components/group/check-answers → sprockets/check-answers/group}/change-answer.jsx +1 -1
- package/src/{components/group/check-answers → sprockets/check-answers/group}/index.cjs +1 -1
- package/src/{components/group/check-answers → sprockets/check-answers/group}/visually-hidden-text.cjs +1 -1
- package/src/{components/group/check-answers → sprockets/check-answers/group}/visually-hidden-text.jsx +1 -1
- package/src/sprockets/check-answers/index.jsx +2 -4
- package/src/{components/group/error-summary → sprockets/check-answers/title}/index.cjs +1 -1
- package/src/sprockets/error-summary/group/index.cjs +17 -0
- package/src/{components/group/error-summary → sprockets/error-summary/group}/index.jsx +3 -2
- package/src/sprockets/error-summary/index.jsx +3 -5
- package/src/sprockets/error-summary/title/index.cjs +17 -0
- package/src/{components/title/check-answers → sprockets/fieldset/description}/index.cjs +1 -1
- package/src/{components/description/fieldset → sprockets/fieldset/error-message}/index.cjs +1 -1
- package/src/{components/title/fieldset → sprockets/fieldset/group}/index.cjs +1 -1
- package/src/sprockets/fieldset/index.jsx +5 -15
- package/src/{components/group/fieldset → sprockets/fieldset/title}/index.cjs +1 -1
- package/src/sprockets/index.jsx +6 -9
- package/src/components/error-message/fieldset/index.cjs +0 -17
- package/src/components/title/error-summary/index.cjs +0 -17
- /package/src/{components/group/check-answers → sprockets/check-answers/group}/index.jsx +0 -0
- /package/src/{components/title/check-answers → sprockets/check-answers/title}/index.jsx +0 -0
- /package/src/{components/title/error-summary → sprockets/error-summary/title}/index.jsx +0 -0
- /package/src/{components/description/fieldset → sprockets/fieldset/description}/index.jsx +0 -0
- /package/src/{components/error-message/fieldset → sprockets/fieldset/error-message}/index.jsx +0 -0
- /package/src/{components/group/fieldset → sprockets/fieldset/group}/index.jsx +0 -0
- /package/src/{components/title/fieldset → sprockets/fieldset/title}/index.jsx +0 -0
package/babel.config.cjs
CHANGED
@@ -54,32 +54,29 @@ const plugins = [
|
|
54
54
|
/**
|
55
55
|
* Storybook
|
56
56
|
*/
|
57
|
+
'shinkansen-sprockets/sprockets/check-answers/group/answer-item': './src/sprockets/group/check-answers/answer-item.cjs',
|
58
|
+
'shinkansen-sprockets/sprockets/check-answers/group/answer-title': './src/sprockets/group/check-answers/answer-title.cjs',
|
59
|
+
'shinkansen-sprockets/sprockets/check-answers/group/answer-value': './src/sprockets/group/check-answers/answer-value.cjs',
|
60
|
+
'shinkansen-sprockets/sprockets/check-answers/group/change-answer': './src/sprockets/group/check-answers/change-answer.cjs',
|
61
|
+
'shinkansen-sprockets/sprockets/check-answers/group/visually-hidden-text': './src/sprockets/group/check-answers/visually-hidden-text.cjs',
|
62
|
+
'shinkansen-sprockets/sprockets/check-answers/group': './src/sprockets/check-answers/group/index.cjs',
|
63
|
+
'shinkansen-sprockets/sprockets/check-answers/title': './src/sprockets/check-answers/title/index.cjs',
|
57
64
|
'shinkansen-sprockets/sprockets/check-answers': './src/sprockets/check-answers/index.cjs',
|
65
|
+
'shinkansen-sprockets/sprockets/error-summary/group/error-item': './src/sprockets/group/error-summary/error-item.cjs',
|
66
|
+
'shinkansen-sprockets/sprockets/error-summary/group': './src/sprockets/error-summary/group/index.cjs',
|
67
|
+
'shinkansen-sprockets/sprockets/error-summary/title': './src/sprockets/error-summary/title/index.cjs',
|
58
68
|
'shinkansen-sprockets/sprockets/error-summary': './src/sprockets/error-summary/index.cjs',
|
69
|
+
'shinkansen-sprockets/sprockets/fieldset/description': './src/sprockets/description/fieldset/index.cjs',
|
70
|
+
'shinkansen-sprockets/sprockets/fieldset/error-message': './src/sprockets/error-message/fieldset/index.cjs',
|
71
|
+
'shinkansen-sprockets/sprockets/fieldset/group': './src/sprockets/group/fieldset/index.cjs',
|
72
|
+
'shinkansen-sprockets/sprockets/fieldset/title': './src/sprockets/title/fieldset/index.cjs',
|
59
73
|
'shinkansen-sprockets/sprockets/fieldset': './src/sprockets/fieldset/index.cjs',
|
60
74
|
'shinkansen-sprockets/sprockets': './src/sprockets/index.cjs',
|
61
75
|
'shinkansen-sprockets/components/common/text-content': './src/components/common/text-content/index.cjs',
|
62
|
-
'shinkansen-sprockets/components/description/fieldset': './src/components/description/fieldset/index.cjs',
|
63
76
|
'shinkansen-sprockets/components/description': './src/components/description/index.cjs',
|
64
|
-
'shinkansen-sprockets/components/error-message/fieldset': './src/components/error-message/fieldset/index.cjs',
|
65
77
|
'shinkansen-sprockets/components/error-message': './src/components/error-message/index.cjs',
|
66
|
-
'shinkansen-sprockets/components/group/check-answers/answer-title': './src/components/group/check-answers/answer-title.cjs',
|
67
|
-
'shinkansen-sprockets/components/group/check-answers/answer-value': './src/components/group/check-answers/answer-value.cjs',
|
68
|
-
'shinkansen-sprockets/components/group/check-answers/change-answer': './src/components/group/check-answers/change-answer.cjs',
|
69
|
-
'shinkansen-sprockets/components/group/check-answers/visually-hidden-text': './src/components/group/check-answers/visually-hidden-text.cjs',
|
70
|
-
'shinkansen-sprockets/components/group/check-answers': './src/components/group/check-answers/index.cjs',
|
71
|
-
'shinkansen-sprockets/components/group/error-summary': './src/components/group/error-summary/index.cjs',
|
72
|
-
'shinkansen-sprockets/components/group/fieldset': './src/components/group/fieldset/index.cjs',
|
73
|
-
'shinkansen-sprockets/components/group': './src/components/group/index.cjs',
|
74
|
-
'shinkansen-sprockets/components/title/check-answers': './src/components/title/check-answers/index.cjs',
|
75
|
-
'shinkansen-sprockets/components/title/error-summary': './src/components/title/error-summary/index.cjs',
|
76
|
-
'shinkansen-sprockets/components/title/fieldset': './src/components/title/fieldset/index.cjs',
|
77
78
|
'shinkansen-sprockets/components/title': './src/components/title/index.cjs',
|
78
|
-
'shinkansen-sprockets/
|
79
|
-
'shinkansen-sprockets/transformers/common': './src/transformers/common/index.mjs',
|
80
|
-
'shinkansen-sprockets/transformers/error-message': './src/transformers/error-message/index.mjs',
|
81
|
-
'shinkansen-sprockets/transformers/error-summary': './src/transformers/error-summary/index.mjs',
|
82
|
-
'#stories/errors': './stories/errors.mjs',
|
79
|
+
'shinkansen-sprockets/components/group': './src/components/group/index.cjs',
|
83
80
|
'#stories': './stories'
|
84
81
|
}
|
85
82
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "shinkansen-sprockets",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.93",
|
4
4
|
"description": "Shinkansen Sprockets",
|
5
5
|
"keywords": [
|
6
6
|
"Shinkansen",
|
@@ -50,23 +50,23 @@
|
|
50
50
|
"fast-deep-equal": "^3.1.3"
|
51
51
|
},
|
52
52
|
"devDependencies": {
|
53
|
-
"@babel/core": "^7.22.
|
54
|
-
"@babel/eslint-parser": "^7.22.
|
53
|
+
"@babel/core": "^7.22.15",
|
54
|
+
"@babel/eslint-parser": "^7.22.15",
|
55
55
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
56
56
|
"@babel/plugin-proposal-export-default-from": "^7.22.5",
|
57
57
|
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
|
58
|
-
"@babel/preset-env": "^7.22.
|
59
|
-
"@babel/preset-react": "^7.22.
|
60
|
-
"@babel/register": "^7.22.
|
58
|
+
"@babel/preset-env": "^7.22.15",
|
59
|
+
"@babel/preset-react": "^7.22.15",
|
60
|
+
"@babel/register": "^7.22.15",
|
61
61
|
"@modernpoacher/design-system": "1.0.71",
|
62
|
-
"@modernpoacher/hooks": "^1.0.
|
63
|
-
"@sequencemedia/gulp": "^1.1.
|
64
|
-
"@sequencemedia/gulp-clean-css": "^1.0.
|
65
|
-
"@sequencemedia/gulp-css-purge": "^1.1.
|
66
|
-
"@sequencemedia/gulp-debug": "^1.0.
|
67
|
-
"@sequencemedia/gulp-postcss": "^1.0.
|
68
|
-
"@sequencemedia/gulp-sass": "^1.0.
|
69
|
-
"@sequencemedia/gulp-sourcemaps": "^1.0.
|
62
|
+
"@modernpoacher/hooks": "^1.0.433",
|
63
|
+
"@sequencemedia/gulp": "^1.1.69",
|
64
|
+
"@sequencemedia/gulp-clean-css": "^1.0.32",
|
65
|
+
"@sequencemedia/gulp-css-purge": "^1.1.25",
|
66
|
+
"@sequencemedia/gulp-debug": "^1.0.36",
|
67
|
+
"@sequencemedia/gulp-postcss": "^1.0.35",
|
68
|
+
"@sequencemedia/gulp-sass": "^1.0.31",
|
69
|
+
"@sequencemedia/gulp-sourcemaps": "^1.0.32",
|
70
70
|
"@storybook/addon-actions": "^7.4.0",
|
71
71
|
"@storybook/addon-essentials": "^7.4.0",
|
72
72
|
"@storybook/addon-links": "^7.4.0",
|
@@ -117,23 +117,24 @@
|
|
117
117
|
"require": "./src/index.cjs",
|
118
118
|
"import": "./src/index.mjs"
|
119
119
|
},
|
120
|
+
"./sprockets/check-answers/group/*": "./src/components/group/check-answers/*.cjs",
|
121
|
+
"./sprockets/check-answers/group": "./src/components/group/check-answers/index.cjs",
|
122
|
+
"./sprockets/check-answers/title": "./src/components/title/check-answers/index.cjs",
|
120
123
|
"./sprockets/check-answers": "./src/sprockets/check-answers/index.cjs",
|
124
|
+
"./sprockets/error-summary/group/*": "./src/components/group/error-summary/*.cjs",
|
125
|
+
"./sprockets/error-summary/group": "./src/components/group/error-summary/index.cjs",
|
126
|
+
"./sprockets/error-summary/title": "./src/components/title/error-summary/index.cjs",
|
121
127
|
"./sprockets/error-summary": "./src/sprockets/error-summary/index.cjs",
|
128
|
+
"./sprockets/fieldset/description": "./src/components/description/fieldset/index.cjs",
|
129
|
+
"./sprockets/fieldset/error-message": "./src/components/error-message/fieldset/index.cjs",
|
130
|
+
"./sprockets/fieldset/group": "./src/components/group/fieldset/index.cjs",
|
131
|
+
"./sprockets/fieldset/title": "./src/components/title/fieldset/index.cjs",
|
122
132
|
"./sprockets/fieldset": "./src/sprockets/fieldset/index.cjs",
|
123
133
|
"./sprockets": "./src/sprockets/index.cjs",
|
124
134
|
"./components/common/text-content": "./src/components/common/text-content/index.cjs",
|
125
|
-
"./components/description/fieldset": "./src/components/description/fieldset/index.cjs",
|
126
135
|
"./components/description": "./src/components/description/index.cjs",
|
127
|
-
"./components/error-message/fieldset": "./src/components/error-message/fieldset/index.cjs",
|
128
136
|
"./components/error-message": "./src/components/error-message/index.cjs",
|
129
|
-
"./components/group/check-answers/*": "./src/components/group/check-answers/*.cjs",
|
130
|
-
"./components/group/check-answers": "./src/components/group/check-answers/index.cjs",
|
131
|
-
"./components/group/error-summary": "./src/components/group/error-summary/index.cjs",
|
132
|
-
"./components/group/fieldset": "./src/components/group/fieldset/index.cjs",
|
133
137
|
"./components/group": "./src/components/group/index.cjs",
|
134
|
-
"./components/title/check-answers": "./src/components/title/check-answers/index.cjs",
|
135
|
-
"./components/title/error-summary": "./src/components/title/error-summary/index.cjs",
|
136
|
-
"./components/title/fieldset": "./src/components/title/fieldset/index.cjs",
|
137
138
|
"./components/title": "./src/components/title/index.cjs",
|
138
139
|
"./transformers/check-answers": "./src/transformers/check-answers/index.mjs",
|
139
140
|
"./transformers/common": "./src/transformers/common/index.mjs",
|
@@ -8,18 +8,6 @@ import PropTypes from 'prop-types'
|
|
8
8
|
import TextContent from 'shinkansen-sprockets/components/common/text-content'
|
9
9
|
|
10
10
|
export default class Description extends Component {
|
11
|
-
hasTextContent () {
|
12
|
-
const { description } = this.props
|
13
|
-
|
14
|
-
return !!description
|
15
|
-
}
|
16
|
-
|
17
|
-
getTextContent () {
|
18
|
-
const { description } = this.props
|
19
|
-
|
20
|
-
return description
|
21
|
-
}
|
22
|
-
|
23
11
|
getClassName () {
|
24
12
|
return 'description'
|
25
13
|
}
|
@@ -30,25 +18,13 @@ export default class Description extends Component {
|
|
30
18
|
)
|
31
19
|
}
|
32
20
|
|
33
|
-
renderTextContent () {
|
34
|
-
if (this.hasTextContent()) {
|
35
|
-
const textContent = this.getTextContent()
|
36
|
-
|
37
|
-
return (
|
38
|
-
<TextContent textContent={textContent} />
|
39
|
-
)
|
40
|
-
}
|
41
|
-
|
42
|
-
return null
|
43
|
-
}
|
44
|
-
|
45
21
|
render () {
|
46
22
|
const { description } = this.props
|
47
23
|
|
48
24
|
if (description) {
|
49
25
|
return (
|
50
26
|
<span className={this.getClassName()}>
|
51
|
-
{
|
27
|
+
<TextContent textContent={description} />
|
52
28
|
</span>
|
53
29
|
)
|
54
30
|
}
|
@@ -8,9 +8,6 @@ import React, { Component } from 'react'
|
|
8
8
|
import PropTypes from 'prop-types'
|
9
9
|
|
10
10
|
export default class Group extends Component {
|
11
|
-
getDOMNode = () => this.domNode
|
12
|
-
setDOMNode = (domNode) => !!(this.domNode = domNode) || delete this.domNode
|
13
|
-
|
14
11
|
getClassName () {
|
15
12
|
return 'group'
|
16
13
|
}
|
@@ -29,6 +26,7 @@ export default class Group extends Component {
|
|
29
26
|
render () {
|
30
27
|
const {
|
31
28
|
onChange,
|
29
|
+
groupRef,
|
32
30
|
children
|
33
31
|
} = this.props
|
34
32
|
|
@@ -36,7 +34,7 @@ export default class Group extends Component {
|
|
36
34
|
<fieldset
|
37
35
|
onChange={onChange}
|
38
36
|
className={this.getClassName()}
|
39
|
-
ref={
|
37
|
+
ref={groupRef}>
|
40
38
|
{children}
|
41
39
|
</fieldset>
|
42
40
|
)
|
@@ -50,5 +48,8 @@ Group.propTypes = {
|
|
50
48
|
PropTypes.arrayOf(
|
51
49
|
PropTypes.node
|
52
50
|
)
|
53
|
-
])
|
51
|
+
]),
|
52
|
+
groupRef: PropTypes.shape({
|
53
|
+
current: PropTypes.shape().isRequired
|
54
|
+
})
|
54
55
|
}
|
package/src/index.d.cts
CHANGED
@@ -34,36 +34,6 @@ declare namespace SprocketsTypes {
|
|
34
34
|
}
|
35
35
|
}
|
36
36
|
|
37
|
-
declare module 'shinkansen-sprockets/sprockets' {
|
38
|
-
import React from 'react'
|
39
|
-
|
40
|
-
export type SprocketProps = {
|
41
|
-
title: string
|
42
|
-
onChange: SprocketsTypes.OnChangeType
|
43
|
-
children: React.JSX.Element | React.JSX.Element[]
|
44
|
-
}
|
45
|
-
|
46
|
-
export default class Sprocket extends React.Component<SprocketProps> {}
|
47
|
-
}
|
48
|
-
|
49
|
-
declare module 'shinkansen-sprockets/sprockets/check-answers' {
|
50
|
-
import Sprocket from 'shinkansen-sprockets/sprockets'
|
51
|
-
|
52
|
-
export default class ErrorSummarySprocket extends Sprocket {}
|
53
|
-
}
|
54
|
-
|
55
|
-
declare module 'shinkansen-sprockets/sprockets/error-summary' {
|
56
|
-
import Sprocket from 'shinkansen-sprockets/sprockets'
|
57
|
-
|
58
|
-
export default class CheckAnswersSprocket extends Sprocket {}
|
59
|
-
}
|
60
|
-
|
61
|
-
declare module 'shinkansen-sprockets/sprockets/fieldset' {
|
62
|
-
import Sprocket from 'shinkansen-sprockets/sprockets'
|
63
|
-
|
64
|
-
export default class FieldsetSprocket extends Sprocket {}
|
65
|
-
}
|
66
|
-
|
67
37
|
declare module 'shinkansen-sprockets/components/common/text-content' {
|
68
38
|
import React from 'react'
|
69
39
|
|
@@ -84,12 +54,6 @@ declare module 'shinkansen-sprockets/components/description' {
|
|
84
54
|
export default class Description extends React.Component<DescriptionProps> {}
|
85
55
|
}
|
86
56
|
|
87
|
-
declare module 'shinkansen-sprockets/components/description/fieldset' {
|
88
|
-
import Description from 'shinkansen-sprockets/components/description'
|
89
|
-
|
90
|
-
export default class FieldsetDescription extends Description {}
|
91
|
-
}
|
92
|
-
|
93
57
|
declare module 'shinkansen-sprockets/components/error-message' {
|
94
58
|
import React from 'react'
|
95
59
|
|
@@ -100,12 +64,6 @@ declare module 'shinkansen-sprockets/components/error-message' {
|
|
100
64
|
export default class ErrorMessage extends React.Component<ErrorMessageProps> {}
|
101
65
|
}
|
102
66
|
|
103
|
-
declare module 'shinkansen-sprockets/components/error-message/fieldset' {
|
104
|
-
import ErrorMessage from 'shinkansen-sprockets/components/error-message'
|
105
|
-
|
106
|
-
export default class FieldsetErrorMessage extends ErrorMessage {}
|
107
|
-
}
|
108
|
-
|
109
67
|
declare module 'shinkansen-sprockets/components/title' {
|
110
68
|
import React from 'react'
|
111
69
|
|
@@ -120,49 +78,93 @@ declare module 'shinkansen-sprockets/components/group' {
|
|
120
78
|
import React from 'react'
|
121
79
|
|
122
80
|
export type GroupProps = {
|
123
|
-
onChange: SprocketsTypes.OnChangeType
|
81
|
+
onChange: SprocketsTypes.OnChangeType,
|
82
|
+
groupRef: object,
|
124
83
|
children: React.JSX.Element | React.JSX.Element[]
|
125
84
|
}
|
126
85
|
|
127
86
|
export default class Group extends React.Component<GroupProps> {}
|
128
87
|
}
|
129
88
|
|
130
|
-
declare module 'shinkansen-sprockets/
|
89
|
+
declare module 'shinkansen-sprockets/sprockets/check-answers/title' {
|
131
90
|
import Title from 'shinkansen-sprockets/components/title'
|
132
91
|
|
133
92
|
export default class CheckAnswersTitle extends Title {}
|
134
93
|
}
|
135
94
|
|
136
|
-
declare module 'shinkansen-sprockets/
|
95
|
+
declare module 'shinkansen-sprockets/sprockets/check-answers/group' {
|
137
96
|
import Group from 'shinkansen-sprockets/components/group'
|
138
97
|
|
139
98
|
export default class CheckAnswersGroup extends Group {}
|
140
99
|
}
|
141
100
|
|
142
|
-
declare module 'shinkansen-sprockets/
|
101
|
+
declare module 'shinkansen-sprockets/sprockets/check-answers' {
|
102
|
+
import Sprocket from 'shinkansen-sprockets/sprockets'
|
103
|
+
|
104
|
+
export default class ErrorSummarySprocket extends Sprocket {}
|
105
|
+
}
|
106
|
+
|
107
|
+
declare module 'shinkansen-sprockets/sprockets/error-summary/title' {
|
143
108
|
import Title from 'shinkansen-sprockets/components/title'
|
144
109
|
|
145
110
|
export default class ErrorSummaryTitle extends Title {}
|
146
111
|
}
|
147
112
|
|
148
|
-
declare module 'shinkansen-sprockets/
|
113
|
+
declare module 'shinkansen-sprockets/sprockets/error-summary/group' {
|
149
114
|
import Group from 'shinkansen-sprockets/components/group'
|
150
115
|
|
151
116
|
export default class ErrorSummaryGroup extends Group {}
|
152
117
|
}
|
153
118
|
|
154
|
-
declare module 'shinkansen-sprockets/
|
119
|
+
declare module 'shinkansen-sprockets/sprockets/error-summary' {
|
120
|
+
import Sprocket from 'shinkansen-sprockets/sprockets'
|
121
|
+
|
122
|
+
export default class CheckAnswersSprocket extends Sprocket {}
|
123
|
+
}
|
124
|
+
|
125
|
+
declare module 'shinkansen-sprockets/sprockets/fieldset/description' {
|
126
|
+
import Description from 'shinkansen-sprockets/components/description'
|
127
|
+
|
128
|
+
export default class FieldsetDescription extends Description {}
|
129
|
+
}
|
130
|
+
|
131
|
+
declare module 'shinkansen-sprockets/sprockets/fieldset/error-message' {
|
132
|
+
import ErrorMessage from 'shinkansen-sprockets/components/error-message'
|
133
|
+
|
134
|
+
export default class FieldsetErrorMessage extends ErrorMessage {}
|
135
|
+
}
|
136
|
+
|
137
|
+
declare module 'shinkansen-sprockets/sprockets/fieldset/title' {
|
155
138
|
import Title from 'shinkansen-sprockets/components/title'
|
156
139
|
|
157
140
|
export default class FieldsetTitle extends Title {}
|
158
141
|
}
|
159
142
|
|
160
|
-
declare module 'shinkansen-sprockets/
|
143
|
+
declare module 'shinkansen-sprockets/sprockets/fieldset/group' {
|
161
144
|
import Group from 'shinkansen-sprockets/components/group'
|
162
145
|
|
163
146
|
export default class FieldsetGroup extends Group {}
|
164
147
|
}
|
165
148
|
|
149
|
+
declare module 'shinkansen-sprockets/sprockets/fieldset' {
|
150
|
+
import Sprocket from 'shinkansen-sprockets/sprockets'
|
151
|
+
|
152
|
+
export default class FieldsetSprocket extends Sprocket {}
|
153
|
+
}
|
154
|
+
|
155
|
+
declare module 'shinkansen-sprockets/sprockets' {
|
156
|
+
import React from 'react'
|
157
|
+
|
158
|
+
export type SprocketProps = {
|
159
|
+
title: string,
|
160
|
+
onChange: SprocketsTypes.OnChangeType,
|
161
|
+
groupRef: object,
|
162
|
+
children: React.JSX.Element | React.JSX.Element[]
|
163
|
+
}
|
164
|
+
|
165
|
+
export default class Sprocket extends React.Component<SprocketProps> {}
|
166
|
+
}
|
167
|
+
|
166
168
|
declare module 'shinkansen-sprockets/transformers/check-answers' {
|
167
169
|
export default function transform (answer: SprocketsTypes.AnswerDefinitionType): SprocketsTypes.FieldChangeType
|
168
170
|
}
|
package/src/{components/group/check-answers → sprockets/check-answers/group}/answer-title.cjs
RENAMED
@@ -6,7 +6,7 @@ require('@babel/register')({
|
|
6
6
|
|
7
7
|
const debug = require('debug')
|
8
8
|
|
9
|
-
const log = debug('shinkansen-sprockets/
|
9
|
+
const log = debug('shinkansen-sprockets/sprockets/check-answers/group/answer-title')
|
10
10
|
|
11
11
|
log('`shinkansen` is awake')
|
12
12
|
|
package/src/{components/group/check-answers → sprockets/check-answers/group}/answer-title.jsx
RENAMED
@@ -2,7 +2,7 @@ import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
3
3
|
import debug from 'debug'
|
4
4
|
|
5
|
-
const log = debug('shinkansen-sprockets/
|
5
|
+
const log = debug('shinkansen-sprockets/sprockets/check-answers/group')
|
6
6
|
|
7
7
|
/**
|
8
8
|
* @param {SprocketsTypes.AnswerDefinitionType}
|
package/src/{components/group/check-answers → sprockets/check-answers/group}/answer-value.cjs
RENAMED
@@ -6,7 +6,7 @@ require('@babel/register')({
|
|
6
6
|
|
7
7
|
const debug = require('debug')
|
8
8
|
|
9
|
-
const log = debug('shinkansen-sprockets/
|
9
|
+
const log = debug('shinkansen-sprockets/sprockets/check-answers/group/answer-value')
|
10
10
|
|
11
11
|
log('`shinkansen` is awake')
|
12
12
|
|
package/src/{components/group/check-answers → sprockets/check-answers/group}/answer-value.jsx
RENAMED
@@ -2,7 +2,7 @@ import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
3
3
|
import debug from 'debug'
|
4
4
|
|
5
|
-
const log = debug('shinkansen-sprockets/
|
5
|
+
const log = debug('shinkansen-sprockets/sprockets/check-answers/group')
|
6
6
|
|
7
7
|
/**
|
8
8
|
* @param {string | string[]}
|
package/src/{components/group/check-answers → sprockets/check-answers/group}/change-answer.cjs
RENAMED
@@ -6,7 +6,7 @@ require('@babel/register')({
|
|
6
6
|
|
7
7
|
const debug = require('debug')
|
8
8
|
|
9
|
-
const log = debug('shinkansen-sprockets/
|
9
|
+
const log = debug('shinkansen-sprockets/sprockets/check-answers/group/change-answer')
|
10
10
|
|
11
11
|
log('`shinkansen` is awake')
|
12
12
|
|
package/src/{components/group/check-answers → sprockets/check-answers/group}/change-answer.jsx
RENAMED
@@ -10,7 +10,7 @@ import TextContent from 'shinkansen-sprockets/components/common/text-content'
|
|
10
10
|
|
11
11
|
import VisuallyHiddenText from './visually-hidden-text.cjs'
|
12
12
|
|
13
|
-
const log = debug('shinkansen-sprockets/
|
13
|
+
const log = debug('shinkansen-sprockets/sprockets/check-answers/group/change-answer')
|
14
14
|
|
15
15
|
/**
|
16
16
|
* @param {SprocketsTypes.AnswerDefinitionType}
|
@@ -6,7 +6,7 @@ require('@babel/register')({
|
|
6
6
|
|
7
7
|
const debug = require('debug')
|
8
8
|
|
9
|
-
const log = debug('shinkansen-sprockets/
|
9
|
+
const log = debug('shinkansen-sprockets/sprockets/check-answers/group/visually-hidden-text')
|
10
10
|
|
11
11
|
log('`shinkansen` is awake')
|
12
12
|
|
@@ -2,7 +2,7 @@ import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
3
3
|
import debug from 'debug'
|
4
4
|
|
5
|
-
const log = debug('shinkansen-sprockets/
|
5
|
+
const log = debug('shinkansen-sprockets/sprockets/check-answers/group')
|
6
6
|
|
7
7
|
export default function VisuallyHiddenText ({ visuallyHiddenText }) {
|
8
8
|
log('VisuallyHiddenText')
|
@@ -10,8 +10,8 @@ import PropTypes from 'prop-types'
|
|
10
10
|
import classnames from 'classnames'
|
11
11
|
|
12
12
|
import Sprocket from 'shinkansen-sprockets/sprockets'
|
13
|
-
import Title from '
|
14
|
-
import Group from '
|
13
|
+
import Title from './title/index.jsx'
|
14
|
+
import Group from './group/index.jsx'
|
15
15
|
|
16
16
|
export default class CheckAnswersSprocket extends Sprocket {
|
17
17
|
getClassName () {
|
@@ -37,7 +37,6 @@ export default class CheckAnswersSprocket extends Sprocket {
|
|
37
37
|
return (
|
38
38
|
<Title
|
39
39
|
title={title}
|
40
|
-
ref={this.setTitle}
|
41
40
|
/>
|
42
41
|
)
|
43
42
|
}
|
@@ -50,7 +49,6 @@ export default class CheckAnswersSprocket extends Sprocket {
|
|
50
49
|
return (
|
51
50
|
<Group
|
52
51
|
checkAnswers={checkAnswers}
|
53
|
-
ref={this.setGroup}
|
54
52
|
/>
|
55
53
|
)
|
56
54
|
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require('@babel/register')({
|
2
|
+
ignore: [
|
3
|
+
/node_modules\/(?!shinkansen|@modernpoacher)/
|
4
|
+
]
|
5
|
+
})
|
6
|
+
|
7
|
+
const debug = require('debug')
|
8
|
+
|
9
|
+
const log = debug('shinkansen-sprockets/sprockets/error-summary/group')
|
10
|
+
|
11
|
+
log('`shinkansen` is awake')
|
12
|
+
|
13
|
+
const {
|
14
|
+
default: component
|
15
|
+
} = require('./index.jsx')
|
16
|
+
|
17
|
+
module.exports = component
|
@@ -26,7 +26,7 @@ import {
|
|
26
26
|
|
27
27
|
import TextContent from 'shinkansen-sprockets/components/common/text-content'
|
28
28
|
|
29
|
-
const log = debug('shinkansen-sprockets/
|
29
|
+
const log = debug('shinkansen-sprockets/sprockets/error-summary/group')
|
30
30
|
|
31
31
|
/* eslint-disable-next-line react/prop-types */
|
32
32
|
function render (error, index) {
|
@@ -90,6 +90,7 @@ export default class ErrorSummaryGroup extends Group {
|
|
90
90
|
|
91
91
|
render () {
|
92
92
|
const {
|
93
|
+
groupRef,
|
93
94
|
errorSummary
|
94
95
|
} = this.props
|
95
96
|
|
@@ -97,7 +98,7 @@ export default class ErrorSummaryGroup extends Group {
|
|
97
98
|
return (
|
98
99
|
<ul
|
99
100
|
className={this.getClassName()}
|
100
|
-
ref={
|
101
|
+
ref={groupRef}>
|
101
102
|
{errorSummary.map(render)}
|
102
103
|
</ul>
|
103
104
|
)
|
@@ -10,8 +10,8 @@ import PropTypes from 'prop-types'
|
|
10
10
|
import classnames from 'classnames'
|
11
11
|
|
12
12
|
import Sprocket from 'shinkansen-sprockets/sprockets'
|
13
|
-
import Title from '
|
14
|
-
import Group from '
|
13
|
+
import Title from './title/index.jsx'
|
14
|
+
import Group from './group/index.jsx'
|
15
15
|
|
16
16
|
export default class ErrorSummarySprocket extends Sprocket {
|
17
17
|
getClassName () {
|
@@ -37,7 +37,6 @@ export default class ErrorSummarySprocket extends Sprocket {
|
|
37
37
|
return (
|
38
38
|
<Title
|
39
39
|
title={title}
|
40
|
-
ref={this.setTitle}
|
41
40
|
/>
|
42
41
|
)
|
43
42
|
}
|
@@ -50,8 +49,7 @@ export default class ErrorSummarySprocket extends Sprocket {
|
|
50
49
|
return (
|
51
50
|
<Group
|
52
51
|
errorSummary={errorSummary}
|
53
|
-
|
54
|
-
</Group>
|
52
|
+
/>
|
55
53
|
)
|
56
54
|
}
|
57
55
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require('@babel/register')({
|
2
|
+
ignore: [
|
3
|
+
/node_modules\/(?!shinkansen|@modernpoacher)/
|
4
|
+
]
|
5
|
+
})
|
6
|
+
|
7
|
+
const debug = require('debug')
|
8
|
+
|
9
|
+
const log = debug('shinkansen-sprockets/sprockets/error-summary/title')
|
10
|
+
|
11
|
+
log('`shinkansen` is awake')
|
12
|
+
|
13
|
+
const {
|
14
|
+
default: component
|
15
|
+
} = require('./index.jsx')
|
16
|
+
|
17
|
+
module.exports = component
|
@@ -10,18 +10,12 @@ import PropTypes from 'prop-types'
|
|
10
10
|
import classnames from 'classnames'
|
11
11
|
|
12
12
|
import Sprocket from 'shinkansen-sprockets/sprockets'
|
13
|
-
import Title from '
|
14
|
-
import Description from '
|
15
|
-
import ErrorMessage from '
|
16
|
-
import Group from '
|
13
|
+
import Title from './title/index.jsx'
|
14
|
+
import Description from './description/index.jsx'
|
15
|
+
import ErrorMessage from './error-message/index.jsx'
|
16
|
+
import Group from './group/index.jsx'
|
17
17
|
|
18
18
|
export default class FieldsetSprocket extends Sprocket {
|
19
|
-
getDescription = () => this.description
|
20
|
-
getErrorMessage = () => this.errorMessage
|
21
|
-
|
22
|
-
setDescription = (description) => !!(this.description = description) || delete this.description
|
23
|
-
setErrorMessage = (errorMessage) => !!(this.errorMessage = errorMessage) || delete this.errorMessage
|
24
|
-
|
25
19
|
getClassName () {
|
26
20
|
const {
|
27
21
|
errorMessage
|
@@ -50,7 +44,6 @@ export default class FieldsetSprocket extends Sprocket {
|
|
50
44
|
return (
|
51
45
|
<Title
|
52
46
|
title={title}
|
53
|
-
ref={this.setTitle}
|
54
47
|
/>
|
55
48
|
)
|
56
49
|
}
|
@@ -63,7 +56,6 @@ export default class FieldsetSprocket extends Sprocket {
|
|
63
56
|
return (
|
64
57
|
<Description
|
65
58
|
description={description}
|
66
|
-
ref={this.setDescription}
|
67
59
|
/>
|
68
60
|
)
|
69
61
|
}
|
@@ -76,7 +68,6 @@ export default class FieldsetSprocket extends Sprocket {
|
|
76
68
|
return (
|
77
69
|
<ErrorMessage
|
78
70
|
errorMessage={errorMessage}
|
79
|
-
ref={this.setErrorMessage}
|
80
71
|
/>
|
81
72
|
)
|
82
73
|
}
|
@@ -89,8 +80,7 @@ export default class FieldsetSprocket extends Sprocket {
|
|
89
80
|
|
90
81
|
return (
|
91
82
|
<Group
|
92
|
-
onChange={onChange}
|
93
|
-
ref={this.setGroup}>
|
83
|
+
onChange={onChange}>
|
94
84
|
{this.renderTitle()}
|
95
85
|
{this.renderDescription()}
|
96
86
|
{this.renderErrorMessage()}
|
package/src/sprockets/index.jsx
CHANGED
@@ -15,12 +15,6 @@ function onChange () {
|
|
15
15
|
}
|
16
16
|
|
17
17
|
export default class Sprocket extends Component {
|
18
|
-
getTitle = () => this.title
|
19
|
-
getGroup = () => this.group
|
20
|
-
|
21
|
-
setTitle = (title) => !!(this.title = title) || delete this.title
|
22
|
-
setGroup = (group) => !!(this.group = group) || delete this.group
|
23
|
-
|
24
18
|
getClassName () {
|
25
19
|
return 'sprocket'
|
26
20
|
}
|
@@ -45,7 +39,6 @@ export default class Sprocket extends Component {
|
|
45
39
|
return (
|
46
40
|
<Title
|
47
41
|
title={title}
|
48
|
-
ref={this.setTitle}
|
49
42
|
/>
|
50
43
|
)
|
51
44
|
}
|
@@ -53,13 +46,14 @@ export default class Sprocket extends Component {
|
|
53
46
|
renderGroup () {
|
54
47
|
const {
|
55
48
|
onChange,
|
49
|
+
groupRef,
|
56
50
|
children
|
57
51
|
} = this.props
|
58
52
|
|
59
53
|
return (
|
60
54
|
<Group
|
61
55
|
onChange={onChange}
|
62
|
-
|
56
|
+
groupRef={groupRef}>
|
63
57
|
{this.renderTitle()}
|
64
58
|
{children}
|
65
59
|
</Group>
|
@@ -85,7 +79,10 @@ Sprocket.propTypes = {
|
|
85
79
|
PropTypes.arrayOf(
|
86
80
|
PropTypes.node
|
87
81
|
)
|
88
|
-
])
|
82
|
+
]),
|
83
|
+
groupRef: PropTypes.shape({
|
84
|
+
current: PropTypes.shape().isRequired
|
85
|
+
})
|
89
86
|
}
|
90
87
|
|
91
88
|
Sprocket.defaultProps = {
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require('@babel/register')({
|
2
|
-
ignore: [
|
3
|
-
/node_modules\/(?!shinkansen|@modernpoacher)/
|
4
|
-
]
|
5
|
-
})
|
6
|
-
|
7
|
-
const debug = require('debug')
|
8
|
-
|
9
|
-
const log = debug('shinkansen-sprockets/components/error-message/fieldset')
|
10
|
-
|
11
|
-
log('`shinkansen` is awake')
|
12
|
-
|
13
|
-
const {
|
14
|
-
default: component
|
15
|
-
} = require('./index.jsx')
|
16
|
-
|
17
|
-
module.exports = component
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require('@babel/register')({
|
2
|
-
ignore: [
|
3
|
-
/node_modules\/(?!shinkansen|@modernpoacher)/
|
4
|
-
]
|
5
|
-
})
|
6
|
-
|
7
|
-
const debug = require('debug')
|
8
|
-
|
9
|
-
const log = debug('shinkansen-sprockets/components/title/error-summary')
|
10
|
-
|
11
|
-
log('`shinkansen` is awake')
|
12
|
-
|
13
|
-
const {
|
14
|
-
default: component
|
15
|
-
} = require('./index.jsx')
|
16
|
-
|
17
|
-
module.exports = component
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/package/src/{components/error-message/fieldset → sprockets/fieldset/error-message}/index.jsx
RENAMED
File without changes
|
File without changes
|
File without changes
|