shinkansen-sprockets 1.2.21 → 1.3.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/babel.config.cjs +2 -1
- package/eslint.config.mjs +16 -3
- package/index.d.mts +84 -59
- package/package.json +26 -4
- package/src/components/common/text-content/index.cjs +5 -2
- package/src/components/common/text-content/index.jsx +1 -1
- package/src/components/common/visually-hidden-text/index.cjs +5 -2
- package/src/components/common/visually-hidden-text/index.jsx +1 -1
- package/src/components/description/index.cjs +5 -2
- package/src/components/description/index.d.mts +2 -11
- package/src/components/description/index.jsx +2 -44
- package/src/components/error-message/index.cjs +5 -2
- package/src/components/error-message/index.d.mts +2 -20
- package/src/components/error-message/index.jsx +2 -118
- package/src/components/group/index.cjs +5 -2
- package/src/components/group/index.d.mts +2 -12
- package/src/components/group/index.jsx +2 -49
- package/src/components/index.cjs +1 -1
- package/src/components/index.d.cts +4 -4
- package/src/components/index.d.mts +4 -4
- package/src/components/index.mjs +4 -4
- package/src/components/title/index.cjs +5 -2
- package/src/components/title/index.d.mts +2 -17
- package/src/components/title/index.jsx +2 -70
- package/src/sprockets/check-answers/group/change-answer.jsx +4 -4
- package/src/sprockets/check-answers/group/index.cjs +5 -2
- package/src/sprockets/check-answers/group/index.d.mts +3 -3
- package/src/sprockets/check-answers/group/index.jsx +9 -9
- package/src/sprockets/check-answers/index.cjs +5 -2
- package/src/sprockets/check-answers/index.d.mts +1 -1
- package/src/sprockets/check-answers/index.jsx +3 -3
- package/src/sprockets/check-answers/title/index.cjs +5 -2
- package/src/sprockets/check-answers/title/index.d.mts +2 -2
- package/src/sprockets/check-answers/title/index.jsx +5 -4
- package/src/sprockets/error-summary/group/index.cjs +5 -2
- package/src/sprockets/error-summary/group/index.d.mts +3 -3
- package/src/sprockets/error-summary/group/index.jsx +9 -9
- package/src/sprockets/error-summary/index.cjs +5 -2
- package/src/sprockets/error-summary/index.d.mts +1 -1
- package/src/sprockets/error-summary/index.jsx +3 -3
- package/src/sprockets/error-summary/title/index.cjs +5 -2
- package/src/sprockets/error-summary/title/index.d.mts +2 -2
- package/src/sprockets/error-summary/title/index.jsx +5 -4
- package/src/sprockets/fieldset/description/index.cjs +5 -2
- package/src/sprockets/fieldset/description/index.d.mts +1 -1
- package/src/sprockets/fieldset/description/index.jsx +2 -2
- package/src/sprockets/fieldset/error-message/index.cjs +5 -2
- package/src/sprockets/fieldset/error-message/index.d.mts +1 -1
- package/src/sprockets/fieldset/error-message/index.jsx +2 -2
- package/src/sprockets/fieldset/group/index.cjs +5 -2
- package/src/sprockets/fieldset/group/index.d.mts +3 -3
- package/src/sprockets/fieldset/group/index.jsx +6 -6
- package/src/sprockets/fieldset/index.cjs +5 -2
- package/src/sprockets/fieldset/index.d.mts +1 -1
- package/src/sprockets/fieldset/index.jsx +3 -3
- package/src/sprockets/fieldset/title/index.cjs +5 -2
- package/src/sprockets/fieldset/title/index.d.mts +2 -2
- package/src/sprockets/fieldset/title/index.jsx +5 -4
- package/src/sprockets/index.cjs +5 -2
- package/src/sprockets/index.d.mts +2 -15
- package/src/sprockets/index.jsx +2 -76
- package/src/super/components/description/index.cjs +20 -0
- package/src/super/components/description/index.d.cts +2 -0
- package/src/super/components/description/index.d.mts +18 -0
- package/src/super/components/description/index.jsx +47 -0
- package/src/super/components/error-message/index.cjs +20 -0
- package/src/super/components/error-message/index.d.cts +2 -0
- package/src/super/components/error-message/index.d.mts +27 -0
- package/src/super/components/error-message/index.jsx +121 -0
- package/src/super/components/group/index.cjs +20 -0
- package/src/super/components/group/index.d.cts +2 -0
- package/src/super/components/group/index.d.mts +19 -0
- package/src/super/components/group/index.jsx +52 -0
- package/src/super/components/index.cjs +16 -0
- package/src/super/components/index.d.cts +4 -0
- package/src/super/components/index.d.mts +4 -0
- package/src/super/components/index.mjs +10 -0
- package/src/super/components/title/index.cjs +20 -0
- package/src/super/components/title/index.d.cts +2 -0
- package/src/super/components/title/index.d.mts +24 -0
- package/src/super/components/title/index.jsx +73 -0
- package/src/super/sprockets/index.cjs +20 -0
- package/src/super/sprockets/index.d.cts +2 -0
- package/src/super/sprockets/index.d.mts +22 -0
- package/src/super/sprockets/index.jsx +79 -0
- package/src/common/index.d.mts +0 -1
- package/src/common/index.mjs +0 -1
@@ -1,15 +1,15 @@
|
|
1
1
|
/**
|
2
|
-
* @typedef {SprocketsTypes.Components.Group.GroupProps} GroupProps
|
3
|
-
* @typedef {SprocketsTypes.Components.Group.GroupState} GroupState
|
4
|
-
* @typedef {SprocketsTypes.
|
5
|
-
* @typedef {SprocketsTypes.
|
2
|
+
* @typedef {SprocketsTypes.Super.Components.Group.GroupProps} GroupProps
|
3
|
+
* @typedef {SprocketsTypes.Super.Components.Group.GroupState} GroupState
|
4
|
+
* @typedef {SprocketsTypes.Sprockets.Fieldset.Group.FieldsetProps} FieldsetProps
|
5
|
+
* @typedef {SprocketsTypes.Sprockets.Fieldset.Group.FieldsetState} FieldsetState
|
6
6
|
*/
|
7
7
|
|
8
8
|
/**
|
9
|
-
*
|
9
|
+
* FieldsetGroup component
|
10
10
|
*/
|
11
11
|
import classnames from 'classnames'
|
12
|
-
import Group from '#sprockets/components/group'
|
12
|
+
import Group from '#sprockets/super/components/group'
|
13
13
|
|
14
14
|
/**
|
15
15
|
* @extends {Group<GroupProps & FieldsetProps, GroupState & FieldsetState>}
|
@@ -11,7 +11,10 @@ const log = debug('shinkansen-sprockets/sprockets/fieldset')
|
|
11
11
|
log('`shinkansen` is awake')
|
12
12
|
|
13
13
|
const {
|
14
|
-
default:
|
14
|
+
default: Fieldset // @ts-expect-error
|
15
15
|
} = require('./index.jsx')
|
16
16
|
|
17
|
-
|
17
|
+
/**
|
18
|
+
* Exports only default
|
19
|
+
*/
|
20
|
+
module.exports = Fieldset
|
@@ -3,7 +3,7 @@ declare module '#sprockets/sprockets/fieldset' {
|
|
3
3
|
|
4
4
|
import Sprocket from '#sprockets/sprockets'
|
5
5
|
|
6
|
-
export type FieldsetProps = SprocketsTypes.Sprockets.
|
6
|
+
export type FieldsetProps = SprocketsTypes.Sprockets.Fieldset.FieldsetProps
|
7
7
|
|
8
8
|
export default class FieldsetSprocket<P extends FieldsetProps> extends Sprocket<P> {
|
9
9
|
renderDescription (): React.JSX.Element | null
|
@@ -1,10 +1,10 @@
|
|
1
1
|
/**
|
2
|
-
* @typedef {SprocketsTypes.Sprockets.
|
3
|
-
* @typedef {SprocketsTypes.Sprockets.
|
2
|
+
* @typedef {SprocketsTypes.Sprockets.SprocketProps} SprocketProps
|
3
|
+
* @typedef {SprocketsTypes.Sprockets.Fieldset.FieldsetProps} FieldsetProps
|
4
4
|
*/
|
5
5
|
|
6
6
|
/**
|
7
|
-
*
|
7
|
+
* FieldsetSprocket component
|
8
8
|
*/
|
9
9
|
import React from 'react'
|
10
10
|
import PropTypes from 'prop-types'
|
@@ -11,7 +11,10 @@ const log = debug('shinkansen-sprockets/sprockets/fieldset/title')
|
|
11
11
|
log('`shinkansen` is awake')
|
12
12
|
|
13
13
|
const {
|
14
|
-
default:
|
14
|
+
default: Title // @ts-expect-error
|
15
15
|
} = require('./index.jsx')
|
16
16
|
|
17
|
-
|
17
|
+
/**
|
18
|
+
* Exports only default
|
19
|
+
*/
|
20
|
+
module.exports = Title
|
@@ -1,7 +1,7 @@
|
|
1
1
|
declare module '#sprockets/sprockets/fieldset/title' {
|
2
|
-
import Title from '#sprockets/components/title'
|
2
|
+
import Title from '#sprockets/super/components/title'
|
3
3
|
|
4
|
-
export type FieldsetProps = SprocketsTypes.
|
4
|
+
export type FieldsetProps = SprocketsTypes.Sprockets.Fieldset.Title.FieldsetProps
|
5
5
|
|
6
6
|
export default class FieldsetTitle<P extends FieldsetProps> extends Title<P> {}
|
7
7
|
}
|
@@ -1,13 +1,14 @@
|
|
1
1
|
/**
|
2
|
-
* @typedef {SprocketsTypes.Components.Title.TitleProps} TitleProps
|
3
|
-
* @typedef {SprocketsTypes.
|
2
|
+
* @typedef {SprocketsTypes.Super.Components.Title.TitleProps} TitleProps
|
3
|
+
* @typedef {SprocketsTypes.Sprockets.Fieldset.Title.FieldsetProps} FieldsetProps
|
4
4
|
*/
|
5
5
|
|
6
6
|
/**
|
7
|
-
*
|
7
|
+
* FieldsetTitle component
|
8
8
|
*/
|
9
9
|
import classnames from 'classnames'
|
10
|
-
|
10
|
+
|
11
|
+
import Title from '#sprockets/super/components/title'
|
11
12
|
|
12
13
|
/**
|
13
14
|
* @extends {Title<TitleProps & FieldsetProps>}
|
package/src/sprockets/index.cjs
CHANGED
@@ -11,7 +11,10 @@ const log = debug('shinkansen-sprockets/sprockets')
|
|
11
11
|
log('`shinkansen` is awake')
|
12
12
|
|
13
13
|
const {
|
14
|
-
default:
|
14
|
+
default: Sprocket // @ts-expect-error
|
15
15
|
} = require('./index.jsx')
|
16
16
|
|
17
|
-
|
17
|
+
/**
|
18
|
+
* Exports only default
|
19
|
+
*/
|
20
|
+
module.exports = Sprocket
|
@@ -1,19 +1,6 @@
|
|
1
1
|
declare module '#sprockets/sprockets' {
|
2
|
-
|
3
|
-
|
4
|
-
export type SprocketProps = SprocketsTypes.Sprockets.Sprocket.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
|
-
}
|
2
|
+
export { default } from '#sprockets/super/sprockets'
|
3
|
+
export * from '#sprockets/super/sprockets'
|
17
4
|
}
|
18
5
|
|
19
6
|
declare module 'shinkansen-sprockets/sprockets' {
|
package/src/sprockets/index.jsx
CHANGED
@@ -1,79 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
*
|
2
|
+
* Sprocket component
|
3
3
|
*/
|
4
4
|
|
5
|
-
|
6
|
-
* Sprocket component
|
7
|
-
*/
|
8
|
-
import React, { Component } from 'react'
|
9
|
-
import PropTypes from 'prop-types'
|
10
|
-
|
11
|
-
import Title from '#sprockets/components/title'
|
12
|
-
import Group from '#sprockets/components/group'
|
13
|
-
|
14
|
-
export default class Sprocket extends Component {
|
15
|
-
getClassName () {
|
16
|
-
return 'sprocket'
|
17
|
-
}
|
18
|
-
|
19
|
-
/**
|
20
|
-
* @param {SprocketProps} props
|
21
|
-
* @returns {boolean}
|
22
|
-
*/
|
23
|
-
shouldComponentUpdate (props) {
|
24
|
-
return (
|
25
|
-
(props.children !== this.props.children) ||
|
26
|
-
(props.title !== this.props.title)
|
27
|
-
)
|
28
|
-
}
|
29
|
-
|
30
|
-
renderTitle () {
|
31
|
-
const {
|
32
|
-
title
|
33
|
-
} = this.props
|
34
|
-
|
35
|
-
return (
|
36
|
-
<Title
|
37
|
-
title={title}
|
38
|
-
/>
|
39
|
-
)
|
40
|
-
}
|
41
|
-
|
42
|
-
renderGroup () {
|
43
|
-
const {
|
44
|
-
groupRef,
|
45
|
-
children
|
46
|
-
} = this.props
|
47
|
-
|
48
|
-
return (
|
49
|
-
<Group
|
50
|
-
groupRef={groupRef}>
|
51
|
-
{this.renderTitle()}
|
52
|
-
{children}
|
53
|
-
</Group>
|
54
|
-
)
|
55
|
-
}
|
56
|
-
|
57
|
-
render () {
|
58
|
-
const className = this.getClassName()
|
59
|
-
|
60
|
-
return (
|
61
|
-
<div className={className}>
|
62
|
-
{this.renderGroup()}
|
63
|
-
</div>
|
64
|
-
)
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
Sprocket.propTypes = {
|
69
|
-
title: PropTypes.string,
|
70
|
-
children: PropTypes.oneOfType([
|
71
|
-
PropTypes.node,
|
72
|
-
PropTypes.arrayOf(
|
73
|
-
PropTypes.node
|
74
|
-
)
|
75
|
-
]),
|
76
|
-
groupRef: PropTypes.shape({
|
77
|
-
current: PropTypes.shape({}).isRequired
|
78
|
-
})
|
79
|
-
}
|
5
|
+
export { default } from '#sprockets/super/sprockets'
|
@@ -0,0 +1,20 @@
|
|
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/description')
|
10
|
+
|
11
|
+
log('`shinkansen` is awake')
|
12
|
+
|
13
|
+
const {
|
14
|
+
default: Description // @ts-expect-error
|
15
|
+
} = require('./index.jsx')
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Exports only default
|
19
|
+
*/
|
20
|
+
module.exports = Description
|
@@ -0,0 +1,18 @@
|
|
1
|
+
declare module '#sprockets/super/components/description' {
|
2
|
+
import React from 'react'
|
3
|
+
|
4
|
+
export type DescriptionProps = SprocketsTypes.Super.Components.Description.DescriptionProps
|
5
|
+
|
6
|
+
export default class Description extends React.Component<DescriptionProps> {
|
7
|
+
static propTypes: object
|
8
|
+
|
9
|
+
getClassName (): string
|
10
|
+
|
11
|
+
shouldComponentUpdate (props: DescriptionProps): boolean
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
declare module 'shinkansen-sprockets/super/components/description' {
|
16
|
+
export { default } from '#sprockets/super/components/description'
|
17
|
+
export * from '#sprockets/super/components/description'
|
18
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
/**
|
2
|
+
* @typedef {SprocketsTypes.Super.Components.Description.DescriptionProps} DescriptionProps
|
3
|
+
*/
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Description 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
|
+
export default class Description extends Component {
|
14
|
+
getClassName () {
|
15
|
+
return 'description'
|
16
|
+
}
|
17
|
+
|
18
|
+
/**
|
19
|
+
* @param {DescriptionProps} props
|
20
|
+
* @returns {boolean}
|
21
|
+
*/
|
22
|
+
shouldComponentUpdate (props) {
|
23
|
+
return (
|
24
|
+
(props.description !== this.props.description)
|
25
|
+
)
|
26
|
+
}
|
27
|
+
|
28
|
+
render () {
|
29
|
+
const {
|
30
|
+
description
|
31
|
+
} = this.props
|
32
|
+
|
33
|
+
if (description) {
|
34
|
+
return (
|
35
|
+
<span className={this.getClassName()}>
|
36
|
+
<TextContent textContent={description} />
|
37
|
+
</span>
|
38
|
+
)
|
39
|
+
}
|
40
|
+
|
41
|
+
return null
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
Description.propTypes = {
|
46
|
+
description: PropTypes.string
|
47
|
+
}
|
@@ -0,0 +1,20 @@
|
|
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/super/components/error-message')
|
10
|
+
|
11
|
+
log('`shinkansen` is awake')
|
12
|
+
|
13
|
+
const {
|
14
|
+
default: ErrorMessage // @ts-expect-error
|
15
|
+
} = require('./index.jsx')
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Exports only default
|
19
|
+
*/
|
20
|
+
module.exports = ErrorMessage
|
@@ -0,0 +1,27 @@
|
|
1
|
+
declare module '#sprockets/super/components/error-message' {
|
2
|
+
import React from 'react'
|
3
|
+
|
4
|
+
export type ErrorMessageProps = SprocketsTypes.Super.Components.ErrorMessage.ErrorMessageProps
|
5
|
+
export type ErrorMessageState = SprocketsTypes.Super.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
|
15
|
+
|
16
|
+
static getDerivedStateFromProps (props: ErrorMessageProps, state: ErrorMessageState): ErrorMessageState
|
17
|
+
|
18
|
+
shouldComponentUpdate (props: ErrorMessageProps, state: ErrorMessageState): boolean
|
19
|
+
|
20
|
+
renderTextContent (): React.JSX.Element | null
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
declare module 'shinkansen-sprockets/super/components/error-message' {
|
25
|
+
export { default } from '#sprockets/super/components/error-message'
|
26
|
+
export * from '#sprockets/super/components/error-message'
|
27
|
+
}
|
@@ -0,0 +1,121 @@
|
|
1
|
+
/**
|
2
|
+
* @typedef {SprocketsTypes.ErrorDefinitionType} ErrorDefinitionType
|
3
|
+
* @typedef {SprocketsTypes.Super.Components.ErrorMessage.ErrorMessageProps} ErrorMessageProps
|
4
|
+
* @typedef {SprocketsTypes.Super.Components.ErrorMessage.ErrorMessageState} ErrorMessageState
|
5
|
+
*/
|
6
|
+
|
7
|
+
/**
|
8
|
+
* ErrorMessage component
|
9
|
+
*/
|
10
|
+
import React, { Component } from 'react'
|
11
|
+
import PropTypes from 'prop-types'
|
12
|
+
import equal from 'fast-deep-equal'
|
13
|
+
|
14
|
+
import transform from '#sprockets/transformers/error-message'
|
15
|
+
|
16
|
+
import TextContent from '#sprockets/components/common/text-content'
|
17
|
+
|
18
|
+
export default class ErrorMessage extends Component {
|
19
|
+
/**
|
20
|
+
* @type {ErrorMessageState}
|
21
|
+
*/
|
22
|
+
state = {}
|
23
|
+
|
24
|
+
hasTextContent () {
|
25
|
+
const {
|
26
|
+
errorMessage
|
27
|
+
} = this.props
|
28
|
+
|
29
|
+
const {
|
30
|
+
text
|
31
|
+
} = transform(errorMessage)
|
32
|
+
|
33
|
+
return !!text
|
34
|
+
}
|
35
|
+
|
36
|
+
getTextContent () {
|
37
|
+
const {
|
38
|
+
errorMessage
|
39
|
+
} = this.props
|
40
|
+
|
41
|
+
const {
|
42
|
+
text
|
43
|
+
} = transform(errorMessage)
|
44
|
+
|
45
|
+
return text
|
46
|
+
}
|
47
|
+
|
48
|
+
getClassName () {
|
49
|
+
return 'error-message'
|
50
|
+
}
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Merge latest `props` to `state`
|
54
|
+
*
|
55
|
+
* @param {ErrorMessageProps} props Latest props
|
56
|
+
* @param {ErrorMessageState} state Current state
|
57
|
+
* @returns {ErrorMessageState}
|
58
|
+
*/
|
59
|
+
static getDerivedStateFromProps ({ errorMessage }, { errorMessage: E }) {
|
60
|
+
return {
|
61
|
+
errorMessage: equal(errorMessage, E) ? E : errorMessage
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Compare current and latest `state` for changes to `errorMessage`
|
67
|
+
*
|
68
|
+
* @param {ErrorMessageProps} props Latest props
|
69
|
+
* @param {ErrorMessageState} state Latest state
|
70
|
+
* @returns {boolean}
|
71
|
+
*/
|
72
|
+
shouldComponentUpdate (props, state) {
|
73
|
+
const {
|
74
|
+
errorMessage: e
|
75
|
+
} = state
|
76
|
+
|
77
|
+
const {
|
78
|
+
errorMessage: E
|
79
|
+
} = this.state
|
80
|
+
|
81
|
+
return !equal(E, e)
|
82
|
+
}
|
83
|
+
|
84
|
+
renderTextContent () {
|
85
|
+
if (this.hasTextContent()) {
|
86
|
+
const textContent = this.getTextContent()
|
87
|
+
|
88
|
+
return (
|
89
|
+
<TextContent
|
90
|
+
textContent={textContent}
|
91
|
+
/>
|
92
|
+
)
|
93
|
+
}
|
94
|
+
|
95
|
+
return null
|
96
|
+
}
|
97
|
+
|
98
|
+
render () {
|
99
|
+
const {
|
100
|
+
errorMessage
|
101
|
+
} = this.props
|
102
|
+
|
103
|
+
if (errorMessage) {
|
104
|
+
return (
|
105
|
+
<span className={this.getClassName()}>
|
106
|
+
{this.renderTextContent()}
|
107
|
+
</span>
|
108
|
+
)
|
109
|
+
}
|
110
|
+
|
111
|
+
return null
|
112
|
+
}
|
113
|
+
}
|
114
|
+
|
115
|
+
ErrorMessage.propTypes = {
|
116
|
+
errorMessage: PropTypes.shape({
|
117
|
+
type: PropTypes.string.isRequired,
|
118
|
+
params: PropTypes.shape({}).isRequired,
|
119
|
+
uri: PropTypes.string.isRequired
|
120
|
+
})
|
121
|
+
}
|
@@ -0,0 +1,20 @@
|
|
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/super/components/group')
|
10
|
+
|
11
|
+
log('`shinkansen` is awake')
|
12
|
+
|
13
|
+
const {
|
14
|
+
default: Group // @ts-expect-error
|
15
|
+
} = require('./index.jsx')
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Exports only default
|
19
|
+
*/
|
20
|
+
module.exports = Group
|
@@ -0,0 +1,19 @@
|
|
1
|
+
declare module '#sprockets/super/components/group' {
|
2
|
+
import React from 'react'
|
3
|
+
|
4
|
+
export type GroupProps = SprocketsTypes.Super.Components.Group.GroupProps
|
5
|
+
export type GroupState = SprocketsTypes.Super.Components.Group.GroupState
|
6
|
+
|
7
|
+
export default class Group<P extends GroupProps, S extends GroupState> extends React.Component<P, S> {
|
8
|
+
static propTypes: object
|
9
|
+
|
10
|
+
getClassName (): string
|
11
|
+
|
12
|
+
shouldComponentUpdate (props: GroupProps, state: GroupState): boolean
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
declare module 'shinkansen-sprockets/super/components/group' {
|
17
|
+
export { default } from '#sprockets/super/components/group'
|
18
|
+
export * from '#sprockets/super/components/group'
|
19
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
/**
|
2
|
+
* @typedef {SprocketsTypes.Super.Components.Group.GroupProps} GroupProps
|
3
|
+
*/
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Group component
|
7
|
+
*/
|
8
|
+
import React, { Component } from 'react'
|
9
|
+
import PropTypes from 'prop-types'
|
10
|
+
|
11
|
+
export default class Group extends Component {
|
12
|
+
getClassName () {
|
13
|
+
return 'group'
|
14
|
+
}
|
15
|
+
|
16
|
+
/**
|
17
|
+
* @param {GroupProps} props
|
18
|
+
* @returns {boolean}
|
19
|
+
*/
|
20
|
+
shouldComponentUpdate (props) {
|
21
|
+
return (
|
22
|
+
(props.children !== this.props.children)
|
23
|
+
)
|
24
|
+
}
|
25
|
+
|
26
|
+
render () {
|
27
|
+
const {
|
28
|
+
groupRef,
|
29
|
+
children
|
30
|
+
} = this.props
|
31
|
+
|
32
|
+
return (
|
33
|
+
<fieldset
|
34
|
+
className={this.getClassName()}
|
35
|
+
ref={groupRef}>
|
36
|
+
{children}
|
37
|
+
</fieldset>
|
38
|
+
)
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
Group.propTypes = {
|
43
|
+
children: PropTypes.oneOfType([
|
44
|
+
PropTypes.node,
|
45
|
+
PropTypes.arrayOf(
|
46
|
+
PropTypes.node
|
47
|
+
)
|
48
|
+
]),
|
49
|
+
groupRef: PropTypes.shape({
|
50
|
+
current: PropTypes.shape({}).isRequired
|
51
|
+
})
|
52
|
+
}
|
@@ -0,0 +1,16 @@
|
|
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/super/components')
|
10
|
+
|
11
|
+
log('`shinkansen` is awake')
|
12
|
+
|
13
|
+
module.exports.Description = require('./description/index.cjs')
|
14
|
+
module.exports.ErrorMessage = require('./error-message/index.cjs')
|
15
|
+
module.exports.Group = require('./group/index.cjs')
|
16
|
+
module.exports.Title = require('./title/index.cjs')
|
@@ -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('shinkansen-sprockets/super/components')
|
4
|
+
|
5
|
+
log('`shinkansen` 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\/(?!shinkansen|@modernpoacher)/
|
4
|
+
]
|
5
|
+
})
|
6
|
+
|
7
|
+
const debug = require('debug')
|
8
|
+
|
9
|
+
const log = debug('shinkansen-sprockets/super/components/title')
|
10
|
+
|
11
|
+
log('`shinkansen` is awake')
|
12
|
+
|
13
|
+
const {
|
14
|
+
default: Title // @ts-expect-error
|
15
|
+
} = require('./index.jsx')
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Exports only default
|
19
|
+
*/
|
20
|
+
module.exports = Title
|