shinkansen-sprockets 2.1.15 → 2.1.16

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/index.d.mts CHANGED
@@ -38,9 +38,10 @@ declare global {
38
38
  export namespace Super {
39
39
  export namespace Sprockets {
40
40
  export interface SprocketProps extends React.PropsWithChildren {
41
- title?: string
42
- groupRe?: React.RefObject<any> // eslint-disable-line @typescript-eslint/no-explicit-any -- Simplicity
41
+ groupRef?: React.RefObject<any> // eslint-disable-line @typescript-eslint/no-explicit-any -- Simplicity
43
42
  }
43
+
44
+ export type SprocketState = Record<PropertyKey, unknown>
44
45
  }
45
46
 
46
47
  export namespace Components {
@@ -61,11 +62,9 @@ declare global {
61
62
  }
62
63
 
63
64
  export namespace Group {
64
- export interface GroupProps extends React.PropsWithChildren {
65
- groupRef?: React.RefObject<any> // eslint-disable-line @typescript-eslint/no-explicit-any -- Simplicity
66
- }
65
+ export type GroupProps = Sprockets.SprocketProps
67
66
 
68
- export type GroupState = Record<PropertyKey, unknown>
67
+ export type GroupState = Sprockets.SprocketState
69
68
  }
70
69
 
71
70
  export namespace Title {
@@ -115,8 +114,10 @@ declare global {
115
114
  export namespace Sprockets {
116
115
  export type SprocketProps = Super.Sprockets.SprocketProps
117
116
 
117
+ export type SprocketState = Super.Sprockets.SprocketState
118
+
118
119
  export namespace CheckAnswers {
119
- export interface CheckAnswersProps extends Super.Sprockets.SprocketProps {
120
+ export interface CheckAnswersProps extends SprocketProps {
120
121
  checkAnswers?: AnswerDefinitionType[]
121
122
  }
122
123
 
@@ -136,7 +137,7 @@ declare global {
136
137
  }
137
138
 
138
139
  export namespace ErrorSummary {
139
- export interface ErrorSummaryProps extends Super.Sprockets.SprocketProps {
140
+ export interface ErrorSummaryProps extends SprocketProps {
140
141
  errorSummary?: ErrorDefinitionType[]
141
142
  }
142
143
 
@@ -156,13 +157,13 @@ declare global {
156
157
  }
157
158
 
158
159
  export namespace Fieldset {
159
- export interface FieldsetProps extends Super.Sprockets.SprocketProps {
160
- description?: string
161
- errorMessage?: ErrorDefinitionType
162
- }
160
+ export type FieldsetProps = SprocketProps
161
+
162
+ export type FieldsetState = SprocketState
163
163
 
164
164
  export namespace Group {
165
165
  export type FieldsetProps = Super.Components.Group.GroupProps
166
+
166
167
  export type FieldsetState = Super.Components.Group.GroupState
167
168
  }
168
169
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shinkansen-sprockets",
3
- "version": "2.1.15",
3
+ "version": "2.1.16",
4
4
  "description": "Shinkansen Sprockets",
5
5
  "keywords": [
6
6
  "Shinkansen",
@@ -63,7 +63,7 @@
63
63
  "@babel/register": "^7.25.9",
64
64
  "@modernpoacher/design-system": "2.0.2",
65
65
  "@sequencemedia/eslint-config-standard": "^0.2.47",
66
- "@sequencemedia/eslint-config-typescript": "^0.1.68",
66
+ "@sequencemedia/eslint-config-typescript": "^0.1.69",
67
67
  "@storybook/addon-actions": "^8.6.10",
68
68
  "@storybook/addon-essentials": "^8.6.10",
69
69
  "@storybook/addon-links": "^8.6.10",
@@ -108,8 +108,8 @@
108
108
  "prettier": "^3.5.3",
109
109
  "prop-types": "^15.8.1",
110
110
  "react": "^19.0.0",
111
- "react-component-instance": "^0.0.15",
112
- "react-component-snapshot": "^0.0.15",
111
+ "react-component-instance": "^0.0.16",
112
+ "react-component-snapshot": "^0.0.17",
113
113
  "react-dom": "^19.0.0",
114
114
  "react-router": "^7.4.0",
115
115
  "remove-files-webpack-plugin": "^1.5.0",
@@ -10,7 +10,23 @@ const log = debug('shinkansen-sprockets/components')
10
10
 
11
11
  log('`shinkansen` is awake')
12
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')
13
+ const {
14
+ default: Description
15
+ } = require('./description/index.jsx')
16
+
17
+ const {
18
+ default: ErrorMessage
19
+ } = require('./error-message/index.jsx')
20
+
21
+ const {
22
+ default: Group
23
+ } = require('./group/index.jsx')
24
+
25
+ const {
26
+ default: Title
27
+ } = require('./title/index.jsx')
28
+
29
+ module.exports.Description = Description
30
+ module.exports.ErrorMessage = ErrorMessage
31
+ module.exports.Group = Group
32
+ module.exports.Title = Title
@@ -2,7 +2,7 @@ import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
 
4
4
  /**
5
- * @param {{ answer: { title: string } }} answer
5
+ * @param {{ answer: { title: string } }} props
6
6
  * @returns {React.JSX.Element}
7
7
  */
8
8
  export default function AnswerTitle ({ answer: { title } }) {
@@ -42,7 +42,7 @@ function getAnswerValue (value) {
42
42
  }
43
43
 
44
44
  /**
45
- * @param {{ answer: { value: string | string[] } }} answer
45
+ * @param {{ answer: { value: string | string[] } }} props
46
46
  * @returns {React.JSX.Element}
47
47
  */
48
48
  export default function AnswerValue ({ answer: { value } }) {
@@ -53,7 +53,7 @@ LinkText.propTypes = {
53
53
  }
54
54
 
55
55
  /**
56
- * @param {{ changeAnswer: { href: string, text: string, visuallyHiddenText?: string } }} answer
56
+ * @param {{ changeAnswer: { href: string, text: string, visuallyHiddenText?: string } }} props
57
57
  * @returns {React.JSX.Element}
58
58
  */
59
59
  export default function ChangeAnswer ({ changeAnswer: { href, text, visuallyHiddenText } }) {
@@ -38,7 +38,7 @@ const log = debug('shinkansen-sprockets/components/group/check-answers')
38
38
  * @param {number} index
39
39
  * @returns {React.JSX.Element}
40
40
  */
41
- function render ({ params: { answer, changeAnswer: { href, text, ...changeAnswer } } }, index) {
41
+ function render ({ params: { answer, changeAnswer: { href, text, visuallyHiddenText } } }, index) {
42
42
  log('render')
43
43
 
44
44
  return (
@@ -52,7 +52,7 @@ function render ({ params: { answer, changeAnswer: { href, text, ...changeAnswer
52
52
  />
53
53
 
54
54
  <ChangeAnswer
55
- changeAnswer={{ ...changeAnswer, href, text }}
55
+ changeAnswer={{ href, text, visuallyHiddenText }}
56
56
  />
57
57
  </div>
58
58
  )
@@ -48,7 +48,9 @@ function render (error, index) {
48
48
  return (
49
49
  <li key={getKey(href, text, index)} className='error'>
50
50
  <a href={href}>
51
- <TextContent textContent={text} />
51
+ <TextContent
52
+ textContent={text}
53
+ />
52
54
  </a>
53
55
  </li>
54
56
  )
@@ -10,7 +10,23 @@ const log = debug('shinkansen-sprockets/super/components')
10
10
 
11
11
  log('`shinkansen` is awake')
12
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')
13
+ const {
14
+ default: Description
15
+ } = require('./description/index.jsx')
16
+
17
+ const {
18
+ default: ErrorMessage
19
+ } = require('./error-message/index.jsx')
20
+
21
+ const {
22
+ default: Group
23
+ } = require('./group/index.jsx')
24
+
25
+ const {
26
+ default: Title
27
+ } = require('./title/index.jsx')
28
+
29
+ module.exports.Description = Description
30
+ module.exports.ErrorMessage = ErrorMessage
31
+ module.exports.Group = Group
32
+ module.exports.Title = Title
@@ -31,8 +31,7 @@
31
31
  legend {
32
32
  @include typography.heading-m;
33
33
 
34
- // stylelint-disable-next-line no-duplicate-selectors
35
- & {
34
+ & /* stylelint-disable-line no-duplicate-selectors */ {
36
35
  padding: 0;
37
36
  margin-top: 0;
38
37
  }
@@ -47,8 +46,7 @@
47
46
  .description {
48
47
  @include typography.secondary-text;
49
48
 
50
- // stylelint-disable-next-line no-duplicate-selectors
51
- & {
49
+ & /* stylelint-disable-line no-duplicate-selectors */ {
52
50
  display: block;
53
51
  padding: 0;
54
52
  margin: 0 0 0.25rem 0;
@@ -58,8 +56,7 @@
58
56
  .error-message {
59
57
  @include typography.error-standard;
60
58
 
61
- // stylelint-disable-next-line no-duplicate-selectors
62
- & {
59
+ & /* stylelint-disable-line no-duplicate-selectors */ {
63
60
  display: block;
64
61
  padding: 0;
65
62
  margin: 0 0 0.25rem 0;
@@ -27,8 +27,7 @@
27
27
  .answer-title {
28
28
  @include typography.heading-s;
29
29
 
30
- // stylelint-disable-next-line no-duplicate-selectors
31
- & {
30
+ & /* stylelint-disable-line no-duplicate-selectors */ {
32
31
  width: 30%;
33
32
  padding-right: 1rem;
34
33
  }
@@ -23,8 +23,7 @@
23
23
  li {
24
24
  @include typography.error-standard;
25
25
 
26
- // stylelint-disable-next-line no-duplicate-selectors
27
- & {
26
+ & /* stylelint-disable-line no-duplicate-selectors */ {
28
27
  display: block;
29
28
  padding: 0;
30
29
  margin: 0 0 0.25rem 0;
@@ -18,13 +18,11 @@
18
18
  &.checkbox {
19
19
  padding-left: 4rem;
20
20
 
21
- // stylelint-disable-next-line no-descending-specificity
22
- input {
21
+ input /* stylelint-disable-line no-descending-specificity */ {
23
22
  left: 1.5rem;
24
23
  }
25
24
 
26
- // stylelint-disable-next-line no-descending-specificity
27
- label:before {
25
+ label:before /* stylelint-disable-line no-descending-specificity */ {
28
26
  left: 1rem;
29
27
 
30
28
  border: 2px solid palette.$error-standard;
@@ -1,20 +0,0 @@
1
- # Publish to NPM
2
-
3
- For CircleCI or the shell
4
-
5
- If you need an _authentication token_ to publish then you should resolve that before executing this script
6
-
7
- ```bash
8
- echo ".publish/publish.sh" >> .npmignore
9
- git clone https://github.com/modernpoacher/publish.git .publish
10
- .publish/publish.sh
11
- ```
12
-
13
- A Gist with the same content as `publish.sh` may need an additional step
14
-
15
- ```bash
16
- echo ".publish/publish.sh" >> .npmignore
17
- git clone https://gist.github.com/efd85e2b8da1ee830dd637f134994a9d.git .publish
18
- chmod +x .publish/publish.sh
19
- .publish/publish.sh
20
- ```