shinkansen-sprockets 1.2.11 → 1.2.13

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.
Files changed (33) hide show
  1. package/eslint.config.mjs +6 -12
  2. package/index.d.mts +4 -1
  3. package/package.json +10 -8
  4. package/src/components/common/text-content/index.d.cts +2 -0
  5. package/src/components/common/visually-hidden-text/index.d.cts +2 -0
  6. package/src/components/description/index.d.cts +2 -0
  7. package/src/components/error-message/index.d.cts +2 -0
  8. package/src/components/group/index.d.cts +2 -0
  9. package/src/components/title/index.d.cts +2 -0
  10. package/src/index.d.cts +34 -0
  11. package/src/index.d.mts +26 -0
  12. package/src/sprockets/check-answers/group/answer-title.d.cts +1 -0
  13. package/src/sprockets/check-answers/group/answer-title.d.mts +9 -0
  14. package/src/sprockets/check-answers/group/answer-value.d.cts +1 -0
  15. package/src/sprockets/check-answers/group/answer-value.d.mts +9 -0
  16. package/src/sprockets/check-answers/group/change-answer.d.cts +1 -0
  17. package/src/sprockets/check-answers/group/change-answer.d.mts +9 -0
  18. package/src/sprockets/check-answers/group/index.d.cts +2 -0
  19. package/src/sprockets/check-answers/group/index.jsx +3 -3
  20. package/src/sprockets/check-answers/index.d.cts +2 -0
  21. package/src/sprockets/check-answers/index.jsx +2 -2
  22. package/src/sprockets/check-answers/title/index.d.cts +2 -0
  23. package/src/sprockets/error-summary/group/index.d.cts +2 -0
  24. package/src/sprockets/error-summary/index.d.cts +2 -0
  25. package/src/sprockets/error-summary/index.jsx +7 -3
  26. package/src/sprockets/error-summary/title/index.d.cts +2 -0
  27. package/src/sprockets/fieldset/description/index.d.cts +1 -0
  28. package/src/sprockets/fieldset/error-message/index.d.cts +1 -0
  29. package/src/sprockets/fieldset/group/index.d.cts +2 -0
  30. package/src/sprockets/fieldset/index.d.cts +2 -0
  31. package/src/sprockets/fieldset/index.jsx +4 -4
  32. package/src/sprockets/fieldset/title/index.d.cts +2 -0
  33. package/src/sprockets/index.d.cts +2 -0
package/eslint.config.mjs CHANGED
@@ -119,19 +119,16 @@ export default [
119
119
  globals: {
120
120
  ...globals.browser
121
121
  }
122
- },
122
+ }, // @ts-expect-error Storybook
123
123
  plugins: {
124
124
  ...reactPlugins,
125
125
  ...storybookPlugins
126
- },
126
+ }, // @ts-expect-error Storybook
127
127
  rules: {
128
128
  ...reactRules
129
129
  },
130
130
  settings: {
131
- ...reactSettings,
132
- 'import/resolver': {
133
- 'babel-module': {}
134
- }
131
+ ...reactSettings
135
132
  }
136
133
  }),
137
134
  standard({
@@ -149,19 +146,16 @@ export default [
149
146
  ...globals.browser,
150
147
  ...globals.jest
151
148
  }
152
- },
149
+ }, // @ts-expect-error Storybook
153
150
  plugins: {
154
151
  ...reactPlugins,
155
152
  ...storybookPlugins
156
- },
153
+ }, // @ts-expect-error Storybook
157
154
  rules: {
158
155
  ...reactRules
159
156
  },
160
157
  settings: {
161
- ...reactSettings,
162
- 'import/resolver': {
163
- 'babel-module': {}
164
- }
158
+ ...reactSettings
165
159
  }
166
160
  }),
167
161
  /**
package/index.d.mts CHANGED
@@ -136,7 +136,10 @@ declare global {
136
136
  }
137
137
 
138
138
  export namespace Fieldset {
139
- export type FieldsetProps = SprocketProps
139
+ export interface FieldsetProps extends SprocketProps {
140
+ description?: string
141
+ errorMessage?: ErrorDefinitionType[]
142
+ }
140
143
  }
141
144
  }
142
145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shinkansen-sprockets",
3
- "version": "1.2.11",
3
+ "version": "1.2.13",
4
4
  "description": "Shinkansen Sprockets",
5
5
  "keywords": [
6
6
  "Shinkansen",
@@ -73,7 +73,6 @@
73
73
  "core-js": "^3.40.0",
74
74
  "cross-env": "^7.0.3",
75
75
  "eslint": "^9.21.0",
76
- "eslint-import-resolver-babel-module": "^5.3.2",
77
76
  "eslint-plugin-react": "^7.37.4",
78
77
  "eslint-plugin-storybook": "^0.11.3",
79
78
  "globals": "^16.0.0",
@@ -101,13 +100,16 @@
101
100
  },
102
101
  "imports": {
103
102
  "#build/paths": "./build/paths.mjs",
104
- "#sprockets": "./src/index.mjs",
103
+ "#sprockets": {
104
+ "require": "./src/index.cjs",
105
+ "import": "./src/index.mjs"
106
+ },
105
107
  "#sprockets/common": "./src/common/index.mjs",
106
- "#sprockets/components/*": "./src/components/*/index.jsx",
107
- "#sprockets/sprockets": "./src/sprockets/index.jsx",
108
- "#sprockets/sprockets/*": "./src/sprockets/*/index.jsx",
109
- "#sprockets/sprockets/check-answers/group/*": "./src/sprockets/check-answers/group/*.jsx",
110
- "#sprockets/sprockets/error-summary/group/*": "./src/sprockets/error-summary/group/*.jsx",
108
+ "#sprockets/components/*": "./src/components/*/index.cjs",
109
+ "#sprockets/sprockets": "./src/sprockets/index.cjs",
110
+ "#sprockets/sprockets/*": "./src/sprockets/*/index.cjs",
111
+ "#sprockets/sprockets/check-answers/group/*": "./src/sprockets/check-answers/group/*.cjs",
112
+ "#sprockets/sprockets/error-summary/group/*": "./src/sprockets/error-summary/group/*.cjs",
111
113
  "#sprockets/transformers/*": "./src/transformers/*/index.mjs",
112
114
  "#stories/definitions/*": "./stories/definitions/*.json",
113
115
  "#stories/errors": "./stories/errors.mjs",
@@ -0,0 +1,2 @@
1
+ export { default } from '#sprockets/components/common/text-content'
2
+ export * from '#sprockets/components/common/text-content'
@@ -0,0 +1,2 @@
1
+ export { default } from '#sprockets/components/common/visually-hidden-text'
2
+ export * from '#sprockets/components/common/visually-hidden-text'
@@ -0,0 +1,2 @@
1
+ export { default } from '#sprockets/components/description'
2
+ export * from '#sprockets/components/description'
@@ -0,0 +1,2 @@
1
+ export { default } from '#sprockets/components/error-message'
2
+ export * from '#sprockets/components/error-message'
@@ -0,0 +1,2 @@
1
+ export { default } from '#sprockets/components/group'
2
+ export * from '#sprockets/components/group'
@@ -0,0 +1,2 @@
1
+ export { default } from '#sprockets/components/title'
2
+ export * from '#sprockets/components/title'
@@ -0,0 +1,34 @@
1
+ import type CheckAnswersSprocket from '#sprockets/sprockets/check-answers'
2
+
3
+ import type {
4
+ CheckAnswersProps
5
+ } from '#sprockets/sprockets/check-answers'
6
+
7
+ import type ErrorSummarySprocket from '#sprockets/sprockets/error-summary'
8
+
9
+ import type {
10
+ ErrorSummaryProps
11
+ } from '#sprockets/sprockets/error-summary'
12
+
13
+ import type FieldsetSprocket from '#sprockets/sprockets/fieldset'
14
+
15
+ import type {
16
+ FieldsetProps
17
+ } from '#sprockets/sprockets/fieldset'
18
+
19
+ export type AnswerDefinitionType = SprocketsTypes.AnswerDefinitionType
20
+ export type FieldChangeType = SprocketsTypes.FieldChangeType
21
+ export type ErrorDefinitionType = SprocketsTypes.ErrorDefinitionType
22
+ export type FieldErrorType = SprocketsTypes.FieldErrorType
23
+
24
+ export { default as CheckAnswersSprocket } from '#sprockets/sprockets/check-answers'
25
+ export { default as ErrorSummarySprocket } from '#sprockets/sprockets/error-summary'
26
+ export { default as FieldsetSprocket } from '#sprockets/sprockets/fieldset'
27
+
28
+ declare const sprockets: {
29
+ CheckAnswersSprocket: CheckAnswersSprocket<CheckAnswersProps>
30
+ ErrorSummarySprocket: ErrorSummarySprocket<ErrorSummaryProps>
31
+ FieldsetSprocket: FieldsetSprocket<FieldsetProps>
32
+ }
33
+
34
+ export default sprockets
package/src/index.d.mts CHANGED
@@ -1,3 +1,21 @@
1
+ import type CheckAnswersSprocket from '#sprockets/sprockets/check-answers'
2
+
3
+ import type {
4
+ CheckAnswersProps
5
+ } from '#sprockets/sprockets/check-answers'
6
+
7
+ import type ErrorSummarySprocket from '#sprockets/sprockets/error-summary'
8
+
9
+ import type {
10
+ ErrorSummaryProps
11
+ } from '#sprockets/sprockets/error-summary'
12
+
13
+ import type FieldsetSprocket from '#sprockets/sprockets/fieldset'
14
+
15
+ import type {
16
+ FieldsetProps
17
+ } from '#sprockets/sprockets/fieldset'
18
+
1
19
  export type AnswerDefinitionType = SprocketsTypes.AnswerDefinitionType
2
20
  export type FieldChangeType = SprocketsTypes.FieldChangeType
3
21
  export type ErrorDefinitionType = SprocketsTypes.ErrorDefinitionType
@@ -6,3 +24,11 @@ export type FieldErrorType = SprocketsTypes.FieldErrorType
6
24
  export { default as CheckAnswersSprocket } from '#sprockets/sprockets/check-answers'
7
25
  export { default as ErrorSummarySprocket } from '#sprockets/sprockets/error-summary'
8
26
  export { default as FieldsetSprocket } from '#sprockets/sprockets/fieldset'
27
+
28
+ declare const sprockets: {
29
+ CheckAnswersSprocket: CheckAnswersSprocket<CheckAnswersProps>
30
+ ErrorSummarySprocket: ErrorSummarySprocket<ErrorSummaryProps>
31
+ FieldsetSprocket: FieldsetSprocket<FieldsetProps>
32
+ }
33
+
34
+ export default sprockets
@@ -0,0 +1 @@
1
+ export { default } from '#sprockets/sprockets/check-answers/group/answer-title'
@@ -0,0 +1,9 @@
1
+ declare module '#sprockets/sprockets/check-answers/group/answer-title' {
2
+ import type React from 'react'
3
+
4
+ export default function AnswerTitle (props: { answer: { title: string } }): React.JSX.Element
5
+ }
6
+
7
+ declare module 'shinkansen-sprockets/sprockets/check-answers/group/answer-title' {
8
+ export { default } from '#sprockets/sprockets/check-answers/group/answer-title'
9
+ }
@@ -0,0 +1 @@
1
+ export { default } from '#sprockets/sprockets/check-answers/group/answer-value'
@@ -0,0 +1,9 @@
1
+ declare module '#sprockets/sprockets/check-answers/group/answer-value' {
2
+ import type React from 'react'
3
+
4
+ export default function AnswerValue (props: { answer: { value: string | string[] } }): React.JSX.Element
5
+ }
6
+
7
+ declare module 'shinkansen-sprockets/sprockets/check-answers/group/answer-value' {
8
+ export { default } from '#sprockets/sprockets/check-answers/group/answer-value'
9
+ }
@@ -0,0 +1 @@
1
+ export { default } from '#sprockets/sprockets/check-answers/group/answer-value'
@@ -0,0 +1,9 @@
1
+ declare module '#sprockets/sprockets/check-answers/group/change-answer' {
2
+ import type React from 'react'
3
+
4
+ export default function ChangeAnswer (props: { changeAnswer: { href: string; text: string; visuallyHiddenText?: string } }): React.JSX.Element
5
+ }
6
+
7
+ declare module 'shinkansen-sprockets/sprockets/check-answers/group/change-answer' {
8
+ export { default } from '#sprockets/sprockets/check-answers/group/change-answer'
9
+ }
@@ -0,0 +1,2 @@
1
+ export { default } from '#sprockets/sprockets/check-answers/group'
2
+ export * from '#sprockets/sprockets/check-answers/group'
@@ -22,9 +22,9 @@ import {
22
22
  getKey
23
23
  } from '#sprockets/transformers/common'
24
24
 
25
- import AnswerTitle from './answer-title.jsx'
26
- import AnswerValue from './answer-value.jsx'
27
- import ChangeAnswer from './change-answer.jsx'
25
+ import AnswerTitle from '#sprockets/sprockets/check-answers/group/answer-title'
26
+ import AnswerValue from '#sprockets/sprockets/check-answers/group/answer-value'
27
+ import ChangeAnswer from '#sprockets/sprockets/check-answers/group/change-answer'
28
28
 
29
29
  /**
30
30
  * @type {AnswerDefinitionType[]}
@@ -0,0 +1,2 @@
1
+ export { default } from '#sprockets/sprockets/check-answers'
2
+ export * from '#sprockets/sprockets/check-answers'
@@ -13,8 +13,8 @@ import PropTypes from 'prop-types'
13
13
  import classnames from 'classnames'
14
14
 
15
15
  import Sprocket from '#sprockets/sprockets'
16
- import Title from './title/index.jsx'
17
- import Group from './group/index.jsx'
16
+ import Title from '#sprockets/sprockets/check-answers/title'
17
+ import Group from '#sprockets/sprockets/check-answers/group'
18
18
 
19
19
  /**
20
20
  * @type {AnswerDefinitionType[]}
@@ -0,0 +1,2 @@
1
+ export { default } from '#sprockets/sprockets/check-answers/title'
2
+ export * from '#sprockets/sprockets/check-answers/title'
@@ -0,0 +1,2 @@
1
+ export { default } from '#sprockets/sprockets/error-summary/group'
2
+ export * from '#sprockets/sprockets/error-summary/group'
@@ -0,0 +1,2 @@
1
+ export { default } from '#sprockets/sprockets/error-summary'
2
+ export * from '#sprockets/sprockets/error-summary'
@@ -1,4 +1,5 @@
1
1
  /**
2
+ * @typedef {SprocketsTypes.ErrorDefinitionType} ErrorDefinitionType
2
3
  * @typedef {SprocketsTypes.Sprockets.Sprocket.SprocketProps} SprocketProps
3
4
  * @typedef {SprocketsTypes.Sprockets.Sprocket.ErrorSummary.ErrorSummaryProps} ErrorSummaryProps
4
5
  */
@@ -12,9 +13,12 @@ import PropTypes from 'prop-types'
12
13
  import classnames from 'classnames'
13
14
 
14
15
  import Sprocket from '#sprockets/sprockets'
15
- import Title from './title/index.jsx'
16
- import Group from './group/index.jsx'
16
+ import Title from '#sprockets/sprockets/error-summary/title'
17
+ import Group from '#sprockets/sprockets/error-summary/group'
17
18
 
19
+ /**
20
+ * @type {ErrorDefinitionType[]}
21
+ */
18
22
  const DEFAULT_ERROR_SUMMARY = []
19
23
 
20
24
  /**
@@ -74,7 +78,7 @@ export default class ErrorSummarySprocket extends Sprocket {
74
78
  const className = this.getClassName()
75
79
 
76
80
  return (
77
- <div tabIndex='-1' className={className}>
81
+ <div tabIndex={-1} className={className}>
78
82
  {this.renderTitle()}
79
83
  {this.renderGroup()}
80
84
  </div>
@@ -0,0 +1,2 @@
1
+ export { default } from '#sprockets/sprockets/error-summary/title'
2
+ export * from '#sprockets/sprockets/error-summary/title'
@@ -0,0 +1 @@
1
+ export { default } from '#sprockets/sprockets/fieldset/description'
@@ -0,0 +1 @@
1
+ export { default } from '#sprockets/sprockets/fieldset/error-message'
@@ -0,0 +1,2 @@
1
+ export { default } from '#sprockets/sprockets/fieldset/group'
2
+ export * from '#sprockets/sprockets/fieldset/group'
@@ -0,0 +1,2 @@
1
+ export { default } from '#sprockets/sprockets/fieldset'
2
+ export * from '#sprockets/sprockets/fieldset'
@@ -13,10 +13,10 @@ import classnames from 'classnames'
13
13
 
14
14
  import Sprocket from '#sprockets/sprockets'
15
15
 
16
- import Title from './title/index.jsx'
17
- import Description from './description/index.jsx'
18
- import ErrorMessage from './error-message/index.jsx'
19
- import Group from './group/index.jsx'
16
+ import Title from '#sprockets/sprockets/fieldset/title'
17
+ import Description from '#sprockets/sprockets/fieldset/description'
18
+ import ErrorMessage from '#sprockets/sprockets/fieldset/error-message'
19
+ import Group from '#sprockets/sprockets/fieldset/group'
20
20
 
21
21
  /**
22
22
  * @extends {Sprocket<SprocketProps & FieldsetProps>}
@@ -0,0 +1,2 @@
1
+ export { default } from '#sprockets/sprockets/fieldset/title'
2
+ export * from '#sprockets/sprockets/fieldset/title'
@@ -0,0 +1,2 @@
1
+ export { default } from '#sprockets/sprockets'
2
+ export * from '#sprockets/sprockets'