shinkansen-sprockets 1.1.463 → 1.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/babel.config.cjs +1 -0
- package/eslint.config.mjs +11 -56
- package/index.d.mts +122 -13
- package/package.json +9 -4
- package/src/common/index.d.mts +1 -3
- package/src/common/index.mjs +1 -7
- package/src/components/common/text-content/index.cjs +1 -1
- package/src/components/common/text-content/index.d.mts +3 -4
- package/src/components/common/text-content/index.jsx +7 -6
- package/src/components/common/visually-hidden-text/index.cjs +1 -1
- package/src/components/common/visually-hidden-text/index.d.mts +3 -4
- package/src/components/common/visually-hidden-text/index.jsx +7 -6
- package/src/components/description/index.cjs +1 -1
- package/src/components/description/index.d.mts +10 -5
- package/src/components/description/index.jsx +12 -3
- package/src/components/error-message/index.cjs +1 -1
- package/src/components/error-message/index.d.mts +20 -5
- package/src/components/error-message/index.jsx +30 -15
- package/src/components/group/index.cjs +1 -1
- package/src/components/group/index.d.mts +12 -7
- package/src/components/group/index.jsx +8 -15
- package/src/components/title/index.cjs +1 -1
- package/src/components/title/index.d.mts +16 -5
- package/src/components/title/index.jsx +18 -4
- package/src/index.d.mts +8 -0
- package/src/sprockets/check-answers/group/answer-title.cjs +1 -0
- package/src/sprockets/check-answers/group/answer-title.jsx +2 -2
- package/src/sprockets/check-answers/group/answer-value.cjs +1 -0
- package/src/sprockets/check-answers/group/answer-value.jsx +29 -12
- package/src/sprockets/check-answers/group/change-answer.cjs +1 -0
- package/src/sprockets/check-answers/group/change-answer.jsx +17 -7
- package/src/sprockets/check-answers/group/index.cjs +1 -1
- package/src/sprockets/check-answers/group/index.d.mts +7 -1
- package/src/sprockets/check-answers/group/index.jsx +43 -28
- package/src/sprockets/check-answers/index.cjs +1 -1
- package/src/sprockets/check-answers/index.d.mts +5 -1
- package/src/sprockets/check-answers/index.jsx +25 -9
- package/src/sprockets/check-answers/title/index.cjs +1 -1
- package/src/sprockets/check-answers/title/index.d.mts +5 -1
- package/src/sprockets/check-answers/title/index.jsx +8 -5
- package/src/sprockets/error-summary/group/index.cjs +1 -1
- package/src/sprockets/error-summary/group/index.d.mts +7 -1
- package/src/sprockets/error-summary/group/index.jsx +31 -23
- package/src/sprockets/error-summary/index.cjs +1 -1
- package/src/sprockets/error-summary/index.d.mts +5 -1
- package/src/sprockets/error-summary/index.jsx +19 -9
- package/src/sprockets/error-summary/title/index.cjs +1 -1
- package/src/sprockets/error-summary/title/index.d.mts +5 -1
- package/src/sprockets/error-summary/title/index.jsx +8 -5
- package/src/sprockets/fieldset/description/index.cjs +1 -1
- package/src/sprockets/fieldset/description/index.jsx +0 -5
- package/src/sprockets/fieldset/error-message/index.cjs +1 -1
- package/src/sprockets/fieldset/error-message/index.jsx +0 -5
- package/src/sprockets/fieldset/group/index.cjs +1 -1
- package/src/sprockets/fieldset/group/index.d.mts +7 -1
- package/src/sprockets/fieldset/group/index.jsx +10 -5
- package/src/sprockets/fieldset/index.cjs +1 -1
- package/src/sprockets/fieldset/index.d.mts +11 -1
- package/src/sprockets/fieldset/index.jsx +22 -17
- package/src/sprockets/fieldset/title/index.cjs +1 -1
- package/src/sprockets/fieldset/title/index.d.mts +5 -1
- package/src/sprockets/fieldset/title/index.jsx +8 -4
- package/src/sprockets/index.cjs +1 -4
- package/src/sprockets/index.d.mts +14 -8
- package/src/sprockets/index.jsx +9 -16
- package/src/transformers/check-answers/index.d.mts +8 -0
- package/src/transformers/check-answers/index.mjs +2 -2
- package/src/transformers/common/index.mjs +4 -4
- package/src/transformers/error-message/index.d.mts +8 -0
- package/src/transformers/error-message/index.mjs +12 -4
- package/src/transformers/error-summary/index.d.mts +8 -0
- package/src/transformers/error-summary/index.mjs +10 -6
package/babel.config.cjs
CHANGED
package/eslint.config.mjs
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
import globals from 'globals'
|
2
|
+
// @ts-ignore
|
2
3
|
import standard from '@sequencemedia/eslint-config-standard/configs/recommended/merge'
|
4
|
+
// @ts-ignore
|
3
5
|
import typescript from '@sequencemedia/eslint-config-typescript/configs/recommended/merge'
|
4
6
|
import babelParser from '@babel/eslint-parser'
|
5
7
|
import typescriptParser from '@typescript-eslint/parser'
|
@@ -58,12 +60,11 @@ export default [
|
|
58
60
|
]
|
59
61
|
},
|
60
62
|
/**
|
61
|
-
* React config for all `jsx` and `
|
63
|
+
* React config for all `jsx` and `jsx` files
|
62
64
|
*/
|
63
65
|
{
|
64
66
|
...reactPlugin.configs.flat.recommended,
|
65
67
|
settings: {
|
66
|
-
...reactPlugin.configs.flat.recommended.settings,
|
67
68
|
...reactSettings
|
68
69
|
}
|
69
70
|
},
|
@@ -100,15 +101,15 @@ export default [
|
|
100
101
|
}
|
101
102
|
}),
|
102
103
|
/**
|
103
|
-
* Standard config for all `jsx`
|
104
|
+
* Standard config for all `jsx`
|
104
105
|
*/
|
105
106
|
standard({
|
106
107
|
files: [
|
107
|
-
'src/**/*.
|
108
|
+
'src/**/*.jsx',
|
108
109
|
'stories/**/*.jsx'
|
109
110
|
],
|
110
111
|
ignores: [
|
111
|
-
'src/**/__tests__/**/*.
|
112
|
+
'src/**/__tests__/**/*.jsx',
|
112
113
|
'stories/**/__tests__/**/*.jsx'
|
113
114
|
],
|
114
115
|
languageOptions: {
|
@@ -137,7 +138,7 @@ export default [
|
|
137
138
|
}),
|
138
139
|
standard({
|
139
140
|
files: [
|
140
|
-
'src/**/__tests__/**/*.
|
141
|
+
'src/**/__tests__/**/*.jsx',
|
141
142
|
'stories/**/__tests__/**/*.jsx'
|
142
143
|
],
|
143
144
|
languageOptions: {
|
@@ -175,78 +176,32 @@ export default [
|
|
175
176
|
ignores: [
|
176
177
|
'src'
|
177
178
|
],
|
178
|
-
languageOptions: {
|
179
|
-
globals: {
|
180
|
-
...globals.node,
|
181
|
-
SprocketsTypes: 'readonly'
|
182
|
-
}
|
183
|
-
}
|
184
|
-
}),
|
185
|
-
typescript({
|
186
|
-
files: [
|
187
|
-
'src/**/*.{mts,cts}'
|
188
|
-
],
|
189
|
-
languageOptions: {
|
190
|
-
globals: {
|
191
|
-
...globals.browser
|
192
|
-
}
|
193
|
-
}
|
194
|
-
}),
|
195
|
-
/**
|
196
|
-
* TypeScript config for only `tsx` files
|
197
|
-
*/
|
198
|
-
typescript({
|
199
|
-
files: [
|
200
|
-
'src/**/*.tsx'
|
201
|
-
],
|
202
|
-
ignores: [
|
203
|
-
'src/**/__tests__/**/*.tsx'
|
204
|
-
],
|
205
179
|
languageOptions: {
|
206
180
|
parser: typescriptParser,
|
207
181
|
parserOptions: {
|
208
|
-
...reactParserOptions,
|
209
182
|
projectService: true,
|
210
183
|
project: 'tsconfig.json'
|
211
184
|
},
|
212
185
|
globals: {
|
213
|
-
...globals.
|
186
|
+
...globals.node,
|
187
|
+
SprocketsTypes: 'readonly'
|
214
188
|
}
|
215
|
-
},
|
216
|
-
plugins: {
|
217
|
-
...reactPlugins
|
218
|
-
},
|
219
|
-
rules: {
|
220
|
-
...reactRules
|
221
|
-
},
|
222
|
-
settings: {
|
223
|
-
...reactSettings
|
224
189
|
}
|
225
190
|
}),
|
226
191
|
typescript({
|
227
192
|
files: [
|
228
|
-
'src
|
193
|
+
'src/**/*.{mts,cts}'
|
229
194
|
],
|
230
195
|
languageOptions: {
|
231
196
|
parser: typescriptParser,
|
232
197
|
parserOptions: {
|
233
|
-
...reactParserOptions,
|
234
198
|
projectService: true,
|
235
199
|
project: 'tsconfig.json'
|
236
200
|
},
|
237
201
|
globals: {
|
238
202
|
...globals.browser,
|
239
|
-
|
203
|
+
SprocketsTypes: 'readonly'
|
240
204
|
}
|
241
|
-
},
|
242
|
-
plugins: {
|
243
|
-
...reactPlugins
|
244
|
-
},
|
245
|
-
rules: {
|
246
|
-
...reactRules
|
247
|
-
},
|
248
|
-
settings: {
|
249
|
-
...reactSettings
|
250
205
|
}
|
251
206
|
})
|
252
207
|
]
|
package/index.d.mts
CHANGED
@@ -1,25 +1,26 @@
|
|
1
|
+
import type React from 'react'
|
2
|
+
|
1
3
|
declare global {
|
2
4
|
namespace SprocketsTypes {
|
3
|
-
export type OnChangeType = () => void
|
4
|
-
|
5
5
|
export interface AnswerDefinitionType {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
type: string,
|
7
|
+
params: {
|
8
|
+
answer: {
|
9
|
+
title: string
|
10
|
+
value: string | string[]
|
11
|
+
}
|
12
|
+
changeAnswer: {
|
13
|
+
text: string
|
14
|
+
href: string
|
15
|
+
visuallyHiddenText?: string
|
16
|
+
}
|
14
17
|
}
|
15
18
|
}
|
16
19
|
|
17
20
|
export interface ErrorDefinitionType {
|
18
21
|
type: string
|
19
22
|
uri: string
|
20
|
-
params:
|
21
|
-
expectedType: string
|
22
|
-
}
|
23
|
+
params: Record<PropertyKey, unknown> | Record<PropertyKey, never>
|
23
24
|
}
|
24
25
|
|
25
26
|
export interface FieldChangeType {
|
@@ -31,6 +32,114 @@ declare global {
|
|
31
32
|
text: string
|
32
33
|
href: string
|
33
34
|
}
|
35
|
+
|
36
|
+
export namespace Components {
|
37
|
+
export namespace Common {
|
38
|
+
export namespace TextContent {
|
39
|
+
export interface TextContentProps {
|
40
|
+
textContent?: string
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
export namespace VisuallyHiddenText {
|
45
|
+
export interface VisuallyHiddenTextProps {
|
46
|
+
visuallyHiddenText?: string
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
export namespace Description {
|
52
|
+
export interface DescriptionProps {
|
53
|
+
description?: string
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
export namespace ErrorMessage {
|
58
|
+
export interface ErrorMessageProps {
|
59
|
+
errorMessage?: ErrorDefinitionType[]
|
60
|
+
}
|
61
|
+
|
62
|
+
export interface ErrorMessageState {
|
63
|
+
errorMessage?: ErrorDefinitionType[]
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
export namespace Group {
|
68
|
+
export interface GroupProps extends React.PropsWithChildren {
|
69
|
+
groupRef?: React.RefObject<any> // eslint-disable-line @typescript-eslint/no-explicit-any -- Simplicity
|
70
|
+
}
|
71
|
+
|
72
|
+
export type GroupState = Record<PropertyKey, unknown>
|
73
|
+
|
74
|
+
export namespace CheckAnswers {
|
75
|
+
export interface CheckAnswersProps extends GroupProps {
|
76
|
+
checkAnswers?: AnswerDefinitionType[]
|
77
|
+
}
|
78
|
+
|
79
|
+
export interface CheckAnswersState extends GroupState {
|
80
|
+
checkAnswers?: AnswerDefinitionType[]
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
export namespace ErrorSummary {
|
85
|
+
export interface ErrorSummaryProps extends GroupProps {
|
86
|
+
errorSummary?: ErrorDefinitionType[]
|
87
|
+
}
|
88
|
+
|
89
|
+
export interface ErrorSummaryState extends GroupState {
|
90
|
+
errorSummary?: ErrorDefinitionType[]
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
export namespace Fieldset {
|
95
|
+
export type FieldsetProps = GroupProps
|
96
|
+
export type FieldsetState = GroupState
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
export namespace Title {
|
101
|
+
export interface TitleProps {
|
102
|
+
title?: string
|
103
|
+
}
|
104
|
+
|
105
|
+
export namespace CheckAnswers {
|
106
|
+
export type CheckAnswersProps = TitleProps
|
107
|
+
}
|
108
|
+
|
109
|
+
export namespace ErrorSummary {
|
110
|
+
export type ErrorSummaryProps = TitleProps
|
111
|
+
}
|
112
|
+
|
113
|
+
export namespace Fieldset {
|
114
|
+
export type FieldsetProps = TitleProps
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
export namespace Sprockets {
|
120
|
+
export namespace Sprocket {
|
121
|
+
export interface SprocketProps extends React.PropsWithChildren {
|
122
|
+
title?: string
|
123
|
+
groupRe?: React.RefObject<any> // eslint-disable-line @typescript-eslint/no-explicit-any -- Simplicity
|
124
|
+
}
|
125
|
+
|
126
|
+
export namespace CheckAnswers {
|
127
|
+
export interface CheckAnswersProps extends SprocketProps {
|
128
|
+
checkAnswers?: AnswerDefinitionType[]
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
export namespace ErrorSummary {
|
133
|
+
export interface ErrorSummaryProps extends SprocketProps {
|
134
|
+
errorSummary?: ErrorDefinitionType[]
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
export namespace Fieldset {
|
139
|
+
export type FieldsetProps = SprocketProps
|
140
|
+
}
|
141
|
+
}
|
142
|
+
}
|
34
143
|
}
|
35
144
|
}
|
36
145
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "shinkansen-sprockets",
|
3
|
-
"version": "1.1
|
3
|
+
"version": "1.2.1",
|
4
4
|
"description": "Shinkansen Sprockets",
|
5
5
|
"keywords": [
|
6
6
|
"Shinkansen",
|
@@ -54,14 +54,18 @@
|
|
54
54
|
"@babel/preset-react": "^7.26.3",
|
55
55
|
"@babel/register": "^7.25.9",
|
56
56
|
"@modernpoacher/design-system": "1.1.27",
|
57
|
-
"@sequencemedia/eslint-config-standard": "^0.2.
|
58
|
-
"@sequencemedia/eslint-config-typescript": "^0.1.
|
57
|
+
"@sequencemedia/eslint-config-standard": "^0.2.26",
|
58
|
+
"@sequencemedia/eslint-config-typescript": "^0.1.37",
|
59
59
|
"@storybook/addon-actions": "7.6.20",
|
60
60
|
"@storybook/addon-essentials": "7.6.20",
|
61
61
|
"@storybook/addon-links": "7.6.20",
|
62
62
|
"@storybook/react": "7.6.20",
|
63
63
|
"@storybook/react-webpack5": "7.6.20",
|
64
|
+
"@types/babel__register": "^7.17.3",
|
65
|
+
"@types/debug": "^4.1.12",
|
66
|
+
"@types/jest": "^29.5.14",
|
64
67
|
"@types/react": "18.3.13",
|
68
|
+
"@types/react-test-renderer": "^19.0.0",
|
65
69
|
"@typescript-eslint/eslint-plugin": "^8.24.1",
|
66
70
|
"@typescript-eslint/parser": "^8.24.1",
|
67
71
|
"autoprefixer": "^10.4.20",
|
@@ -77,7 +81,7 @@
|
|
77
81
|
"jest": "^29.7.0",
|
78
82
|
"mini-css-extract-plugin": "^2.9.2",
|
79
83
|
"perfectionist": "^2.4.0",
|
80
|
-
"postcss": "^8.5.
|
84
|
+
"postcss": "^8.5.3",
|
81
85
|
"postcss-discard-comments": "^7.0.3",
|
82
86
|
"postcss-discard-empty": "^7.0.0",
|
83
87
|
"postcss-import": "^16.1.0",
|
@@ -87,6 +91,7 @@
|
|
87
91
|
"react": "18.3.1",
|
88
92
|
"react-dom": "18.3.1",
|
89
93
|
"react-router": "^7.2.0",
|
94
|
+
"react-router-dom": "^7.2.0",
|
90
95
|
"react-test-renderer": "18.3.1",
|
91
96
|
"remove-files-webpack-plugin": "^1.5.0",
|
92
97
|
"sass": "^1.85.0",
|
package/src/common/index.d.mts
CHANGED
package/src/common/index.mjs
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
declare module '#sprockets/components/common/text-content' {
|
2
2
|
import type React from 'react'
|
3
3
|
|
4
|
-
|
5
|
-
textContent: string
|
6
|
-
}
|
4
|
+
type TextContentProps = SprocketsTypes.Components.Common.TextContent.TextContentProps
|
7
5
|
|
8
6
|
export default function TextContent (props: TextContentProps): React.JSX.Element | null
|
9
7
|
}
|
10
8
|
|
11
9
|
declare module 'shinkansen-sprockets/components/common/text-content' {
|
10
|
+
export type TextContentProps = SprocketsTypes.Components.Common.TextContent.TextContentProps
|
11
|
+
|
12
12
|
export { default } from '#sprockets/components/common/text-content'
|
13
|
-
export * from '#sprockets/components/common/text-content'
|
14
13
|
}
|
@@ -1,15 +1,16 @@
|
|
1
1
|
/**
|
2
|
-
* TextContent
|
3
|
-
*
|
4
|
-
* @typedef {import('shinkansen-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
|
}
|
@@ -1,14 +1,13 @@
|
|
1
1
|
declare module '#sprockets/components/common/visually-hidden-text' {
|
2
2
|
import type React from 'react'
|
3
3
|
|
4
|
-
|
5
|
-
visuallyHiddenText: string
|
6
|
-
}
|
4
|
+
type VisuallyHiddenTextProps = SprocketsTypes.Components.Common.VisuallyHiddenText.VisuallyHiddenTextProps
|
7
5
|
|
8
6
|
export default function VisuallyHiddenText (props: VisuallyHiddenTextProps): React.JSX.Element | null
|
9
7
|
}
|
10
8
|
|
11
9
|
declare module 'shinkansen-sprockets/components/common/visually-hidden-text' {
|
10
|
+
export type VisuallyHiddenTextProps = SprocketsTypes.Components.Common.VisuallyHiddenText.VisuallyHiddenTextProps
|
11
|
+
|
12
12
|
export { default } from '#sprockets/components/common/visually-hidden-text'
|
13
|
-
export * from '#sprockets/components/common/visually-hidden-text'
|
14
13
|
}
|
@@ -1,15 +1,16 @@
|
|
1
1
|
/**
|
2
|
-
* VisuallyHiddenText
|
3
|
-
*
|
4
|
-
* @typedef {import('shinkansen-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
|
}
|
@@ -1,14 +1,19 @@
|
|
1
1
|
declare module '#sprockets/components/description' {
|
2
2
|
import React from 'react'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
type DescriptionProps = SprocketsTypes.Components.Description.DescriptionProps
|
5
|
+
|
6
|
+
export default class Description extends React.Component<DescriptionProps> {
|
7
|
+
static propTypes: object
|
8
|
+
|
9
|
+
getClassName (): string
|
7
10
|
|
8
|
-
|
11
|
+
shouldComponentUpdate (props: DescriptionProps): boolean
|
12
|
+
}
|
9
13
|
}
|
10
14
|
|
11
15
|
declare module 'shinkansen-sprockets/components/description' {
|
16
|
+
export type DescriptionProps = SprocketsTypes.Components.Description.DescriptionProps
|
17
|
+
|
12
18
|
export { default } from '#sprockets/components/description'
|
13
|
-
export * from '#sprockets/components/description'
|
14
19
|
}
|
@@ -1,7 +1,10 @@
|
|
1
1
|
/**
|
2
|
-
* Description
|
2
|
+
* @typedef {SprocketsTypes.Components.Description.DescriptionProps} DescriptionProps
|
3
3
|
*/
|
4
4
|
|
5
|
+
/**
|
6
|
+
* Description component
|
7
|
+
*/
|
5
8
|
import React, { Component } from 'react'
|
6
9
|
import PropTypes from 'prop-types'
|
7
10
|
|
@@ -12,14 +15,20 @@ export default class Description extends Component {
|
|
12
15
|
return 'description'
|
13
16
|
}
|
14
17
|
|
15
|
-
|
18
|
+
/**
|
19
|
+
* @param {DescriptionProps} props
|
20
|
+
* @returns {boolean}
|
21
|
+
*/
|
22
|
+
shouldComponentUpdate (props) {
|
16
23
|
return (
|
17
24
|
(props.description !== this.props.description)
|
18
25
|
)
|
19
26
|
}
|
20
27
|
|
21
28
|
render () {
|
22
|
-
const {
|
29
|
+
const {
|
30
|
+
description
|
31
|
+
} = this.props
|
23
32
|
|
24
33
|
if (description) {
|
25
34
|
return (
|
@@ -1,14 +1,29 @@
|
|
1
1
|
declare module '#sprockets/components/error-message' {
|
2
2
|
import React from 'react'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
type ErrorMessageProps = SprocketsTypes.Components.ErrorMessage.ErrorMessageProps
|
5
|
+
type ErrorMessageState = SprocketsTypes.Components.ErrorMessage.ErrorMessageState
|
6
|
+
|
7
|
+
export default class ErrorMessage extends React.Component<ErrorMessageProps, ErrorMessageState> {
|
8
|
+
static propTypes: object
|
9
|
+
|
10
|
+
hasTextContent (): boolean
|
11
|
+
|
12
|
+
getTextContent (): string
|
13
|
+
|
14
|
+
getClassName (): string
|
7
15
|
|
8
|
-
|
16
|
+
static getDerivedStateFromProps (props: ErrorMessageProps, state: ErrorMessageState): ErrorMessageState
|
17
|
+
|
18
|
+
shouldComponentUpdate (props: ErrorMessageProps, state: ErrorMessageState): boolean
|
19
|
+
|
20
|
+
renderTextContent (): React.JSX.Element | null
|
21
|
+
}
|
9
22
|
}
|
10
23
|
|
11
24
|
declare module 'shinkansen-sprockets/components/error-message' {
|
25
|
+
export type ErrorMessageProps = SprocketsTypes.Components.ErrorMessage.ErrorMessageProps
|
26
|
+
export type ErrorMessageState = SprocketsTypes.Components.ErrorMessage.ErrorMessageState
|
27
|
+
|
12
28
|
export { default } from '#sprockets/components/error-message'
|
13
|
-
export * from '#sprockets/components/error-message'
|
14
29
|
}
|