shinkansen-sprockets 1.1.308 → 1.1.310

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 CHANGED
@@ -47,6 +47,7 @@ const plugins = [
47
47
  /**
48
48
  * Storybook
49
49
  */
50
+ 'shinkansen-sprockets/common': './src/common/index.mjs',
50
51
  'shinkansen-sprockets/sprockets/check-answers/group/answer-item': './src/sprockets/check-answers/group/answer-item.jsx',
51
52
  'shinkansen-sprockets/sprockets/check-answers/group/answer-title': './src/sprockets/check-answers/group/answer-title.jsx',
52
53
  'shinkansen-sprockets/sprockets/check-answers/group/answer-value': './src/sprockets/check-answers/group/answer-value.jsx',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shinkansen-sprockets",
3
- "version": "1.1.308",
3
+ "version": "1.1.310",
4
4
  "description": "Shinkansen Sprockets",
5
5
  "keywords": [
6
6
  "Shinkansen",
@@ -58,18 +58,18 @@
58
58
  "@babel/register": "^7.24.6",
59
59
  "@modernpoacher/design-system": "1.0.164",
60
60
  "@modernpoacher/hooks": "^1.0.479",
61
- "@sequencemedia/gulp": "^1.1.193",
61
+ "@sequencemedia/gulp": "^1.1.194",
62
62
  "@sequencemedia/gulp-clean-css": "^1.0.105",
63
63
  "@sequencemedia/gulp-css-purge": "^1.1.106",
64
64
  "@sequencemedia/gulp-debug": "^1.0.108",
65
65
  "@sequencemedia/gulp-postcss": "^1.0.119",
66
66
  "@sequencemedia/gulp-sass": "^1.0.104",
67
67
  "@sequencemedia/gulp-sourcemaps": "^1.0.109",
68
- "@storybook/addon-actions": "^8.1.11",
69
- "@storybook/addon-essentials": "^8.1.11",
70
- "@storybook/addon-links": "^8.1.11",
71
- "@storybook/react": "^8.1.11",
72
- "@storybook/react-webpack5": "^8.1.11",
68
+ "@storybook/addon-actions": "7.6.20",
69
+ "@storybook/addon-essentials": "7.6.20",
70
+ "@storybook/addon-links": "7.6.20",
71
+ "@storybook/react": "7.6.20",
72
+ "@storybook/react-webpack5": "7.6.20",
73
73
  "@types/react": "^18.3.3",
74
74
  "@typescript-eslint/eslint-plugin": "^7.14.1",
75
75
  "@typescript-eslint/parser": "^7.14.1",
@@ -100,7 +100,7 @@
100
100
  "react-test-renderer": "^18.3.1",
101
101
  "regenerator-runtime": "^0.14.1",
102
102
  "sass": "^1.77.6",
103
- "storybook": "^8.1.11",
103
+ "storybook": "7.6.20",
104
104
  "vinyl-paths": "^5.0.0"
105
105
  },
106
106
  "imports": {
@@ -115,6 +115,7 @@
115
115
  "require": "./src/index.cjs",
116
116
  "import": "./src/index.mjs"
117
117
  },
118
+ "./common": "./src/common/index.mjs",
118
119
  "./components/common/text-content": "./src/components/common/text-content/index.cjs",
119
120
  "./components/common/visually-hidden-text": "./src/components/common/visually-hidden-text/index.cjs",
120
121
  "./components/description": "./src/components/description/index.cjs",
@@ -0,0 +1,7 @@
1
+ export function DEFAULT_HANDLE_CHANGE () {
2
+ /* */
3
+ }
4
+
5
+ export function DEFAULT_HANDLE_CLICK () {
6
+ /* */
7
+ }
@@ -11,7 +11,9 @@ import transform from 'shinkansen-sprockets/transformers/error-message'
11
11
  import TextContent from 'shinkansen-sprockets/components/common/text-content'
12
12
 
13
13
  export default class ErrorMessage extends Component {
14
- state = {}
14
+ state = {
15
+ errorMessage: {}
16
+ }
15
17
 
16
18
  hasTextContent () {
17
19
  const { errorMessage } = this.props
@@ -7,6 +7,10 @@
7
7
  import React, { Component } from 'react'
8
8
  import PropTypes from 'prop-types'
9
9
 
10
+ import {
11
+ DEFAULT_HANDLE_CHANGE
12
+ } from 'shinkansen-sprockets/common'
13
+
10
14
  export default class Group extends Component {
11
15
  getClassName () {
12
16
  return 'group'
@@ -25,7 +29,7 @@ export default class Group extends Component {
25
29
 
26
30
  render () {
27
31
  const {
28
- onChange,
32
+ onChange = DEFAULT_HANDLE_CHANGE,
29
33
  groupRef,
30
34
  children
31
35
  } = this.props
@@ -48,7 +48,9 @@ export default class CheckAnswersGroup extends Group {
48
48
  /**
49
49
  * @type {GroupState}
50
50
  */
51
- state = {}
51
+ state = {
52
+ checkAnswers: []
53
+ }
52
54
 
53
55
  getClassName () {
54
56
  return classnames(super.getClassName(), 'check-answers')
@@ -22,9 +22,9 @@ export default class CheckAnswersSprocket extends Sprocket {
22
22
  * @param {SprocketProps} props
23
23
  * @returns {boolean}
24
24
  */
25
- shouldComponentUpdate (props) {
25
+ shouldComponentUpdate (props, state) {
26
26
  return (
27
- super.shouldComponentUpdate(props) ||
27
+ super.shouldComponentUpdate(props, state) ||
28
28
  (props.checkAnswers !== this.props.checkAnswers)
29
29
  )
30
30
  }
@@ -50,7 +50,9 @@ export default class ErrorSummaryGroup extends Group {
50
50
  /**
51
51
  * @type {GroupState}
52
52
  */
53
- state = {}
53
+ state = {
54
+ errorSummary: {}
55
+ }
54
56
 
55
57
  getClassName () {
56
58
  return classnames(super.getClassName(), 'error-summary')
@@ -22,9 +22,9 @@ export default class ErrorSummarySprocket extends Sprocket {
22
22
  * @param {SprocketProps} props
23
23
  * @returns {boolean}
24
24
  */
25
- shouldComponentUpdate (props) {
25
+ shouldComponentUpdate (props, state) {
26
26
  return (
27
- super.shouldComponentUpdate(props) ||
27
+ super.shouldComponentUpdate(props, state) ||
28
28
  (props.errorSummary !== this.props.errorSummary)
29
29
  )
30
30
  }
@@ -10,6 +10,11 @@ import PropTypes from 'prop-types'
10
10
  import classnames from 'classnames'
11
11
 
12
12
  import Sprocket from 'shinkansen-sprockets/sprockets'
13
+
14
+ import {
15
+ DEFAULT_HANDLE_CHANGE
16
+ } from 'shinkansen-sprockets/common'
17
+
13
18
  import Title from './title/index.jsx'
14
19
  import Description from './description/index.jsx'
15
20
  import ErrorMessage from './error-message/index.jsx'
@@ -28,9 +33,9 @@ export default class FieldsetSprocket extends Sprocket {
28
33
  * @param {SprocketProps} props
29
34
  * @returns {boolean}
30
35
  */
31
- shouldComponentUpdate (props) {
36
+ shouldComponentUpdate (props, state) {
32
37
  return (
33
- super.shouldComponentUpdate(props) ||
38
+ super.shouldComponentUpdate(props, state) ||
34
39
  (props.description !== this.props.description) ||
35
40
  (props.errorMessage !== this.props.errorMessage)
36
41
  )
@@ -74,7 +79,7 @@ export default class FieldsetSprocket extends Sprocket {
74
79
 
75
80
  renderGroup () {
76
81
  const {
77
- onChange,
82
+ onChange = DEFAULT_HANDLE_CHANGE,
78
83
  children
79
84
  } = this.props
80
85
 
@@ -7,13 +7,13 @@
7
7
  import React, { Component } from 'react'
8
8
  import PropTypes from 'prop-types'
9
9
 
10
+ import {
11
+ DEFAULT_HANDLE_CHANGE
12
+ } from 'shinkansen-sprockets/common'
13
+
10
14
  import Title from 'shinkansen-sprockets/components/title'
11
15
  import Group from 'shinkansen-sprockets/components/group'
12
16
 
13
- function onChange () {
14
- /* */
15
- }
16
-
17
17
  export default class Sprocket extends Component {
18
18
  getClassName () {
19
19
  return 'sprocket'
@@ -45,7 +45,7 @@ export default class Sprocket extends Component {
45
45
 
46
46
  renderGroup () {
47
47
  const {
48
- onChange,
48
+ onChange = DEFAULT_HANDLE_CHANGE,
49
49
  groupRef,
50
50
  children
51
51
  } = this.props
@@ -86,5 +86,5 @@ Sprocket.propTypes = {
86
86
  }
87
87
 
88
88
  Sprocket.defaultProps = {
89
- onChange
89
+ onChange: DEFAULT_HANDLE_CHANGE
90
90
  }