shinkansen-pinion 1.1.552 → 1.2.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 +3 -1
- package/eslint.config.mjs +12 -60
- package/index.d.mts +179 -34
- package/package.json +16 -6
- package/src/common/elements/has-any-of.mjs +23 -0
- package/src/common/elements/has-enum.mjs +23 -0
- package/src/common/elements/has-field.mjs +27 -0
- package/src/common/elements/has-one-of.mjs +23 -0
- package/src/common/index.d.mts +0 -2
- package/src/common/index.mjs +0 -4
- package/src/common/meta/get-schema.mjs +21 -0
- package/src/common/meta/has-any-of.mjs +23 -0
- package/src/common/meta/has-enum.mjs +23 -0
- package/src/common/meta/has-field.mjs +27 -0
- package/src/common/meta/has-one-of.mjs +23 -0
- package/src/pinion/index.d.mts +1 -0
- package/src/pinion/index.jsx +406 -201
- package/src/transformers/check-answers/get-answer-title.d.mts +1 -0
- package/src/transformers/check-answers/get-answer-title.mjs +2 -2
- package/src/transformers/check-answers/get-answer-value-for-type-array.d.mts +3 -0
- package/src/transformers/check-answers/get-answer-value-for-type-object.d.mts +3 -0
- package/src/transformers/check-answers/get-answer-value.d.mts +1 -0
- package/src/transformers/check-answers/get-answer-value.mjs +2 -2
- package/src/transformers/check-answers/get-any-of-selected-item-value.d.mts +4 -0
- package/src/transformers/check-answers/get-any-of-selected-items-value.d.mts +4 -0
- package/src/transformers/check-answers/get-change-answer.d.mts +1 -0
- package/src/transformers/check-answers/get-enum-selected-item-value.d.mts +4 -0
- package/src/transformers/check-answers/get-enum-selected-items-value.d.mts +4 -0
- package/src/transformers/check-answers/get-one-of-selected-item-value.d.mts +4 -0
- package/src/transformers/check-answers/get-one-of-selected-items-value.d.mts +4 -0
- package/src/transformers/check-answers/get-visually-hidden-text.d.mts +1 -0
- package/src/transformers/check-answers/index.d.mts +39 -261
- package/src/transformers/check-answers/index.mjs +60 -18
- package/src/transformers/check-answers/to-answer-value.d.mts +1 -0
- package/src/transformers/check-answers/transform-answer-title.d.mts +7 -0
- package/src/transformers/check-answers/transform-answer-value.d.mts +7 -0
- package/src/transformers/check-answers/transform-answer-value.mjs +2 -2
- package/src/transformers/check-answers/transform-any-of-value.d.mts +1 -0
- package/src/transformers/check-answers/transform-any-of-value.mjs +2 -2
- package/src/transformers/check-answers/transform-enum-value.d.mts +1 -0
- package/src/transformers/check-answers/transform-enum-value.mjs +2 -2
- package/src/transformers/check-answers/transform-field-value.d.mts +1 -0
- package/src/transformers/check-answers/transform-one-of-value.d.mts +1 -0
- package/src/transformers/check-answers/transform-one-of-value.mjs +2 -2
- package/src/transformers/check-answers/transform-type-array-answers.d.mts +1 -0
- package/src/transformers/check-answers/transform-type-array-answers.mjs +3 -3
- package/src/transformers/check-answers/transform-type-boolean-answer.d.mts +1 -0
- package/src/transformers/check-answers/transform-type-boolean-answer.mjs +3 -3
- package/src/transformers/check-answers/transform-type-null-answer.d.mts +1 -0
- package/src/transformers/check-answers/transform-type-null-answer.mjs +3 -3
- package/src/transformers/check-answers/transform-type-number-answer.d.mts +1 -0
- package/src/transformers/check-answers/transform-type-number-answer.mjs +3 -3
- package/src/transformers/check-answers/transform-type-object-answers.d.mts +1 -0
- package/src/transformers/check-answers/transform-type-object-answers.mjs +3 -3
- package/src/transformers/check-answers/transform-type-string-answer.d.mts +1 -0
- package/src/transformers/check-answers/transform-type-string-answer.mjs +3 -3
- package/src/transformers/common/get-any-of.d.mts +4 -0
- package/src/transformers/common/get-any-of.mjs +8 -6
- package/src/transformers/common/get-component.d.mts +4 -0
- package/src/transformers/common/get-component.mjs +8 -6
- package/src/transformers/common/get-description.d.mts +3 -0
- package/src/transformers/common/get-description.mjs +8 -6
- package/src/transformers/common/get-elements-title.d.mts +1 -0
- package/src/transformers/common/get-elements-title.mjs +5 -1
- package/src/transformers/common/get-enum.d.mts +4 -0
- package/src/transformers/common/get-enum.mjs +8 -6
- package/src/transformers/common/get-field.d.mts +4 -0
- package/src/transformers/common/get-field.mjs +8 -6
- package/src/transformers/common/get-group.d.mts +3 -0
- package/src/transformers/common/get-group.mjs +5 -0
- package/src/transformers/common/get-one-of.d.mts +4 -0
- package/src/transformers/common/get-one-of.mjs +8 -6
- package/src/transformers/common/get-required.d.mts +1 -0
- package/src/transformers/common/get-required.mjs +2 -10
- package/src/transformers/common/get-title.d.mts +3 -0
- package/src/transformers/common/get-title.mjs +8 -6
- package/src/transformers/common/get-type.d.mts +3 -0
- package/src/transformers/common/get-type.mjs +8 -6
- package/src/transformers/common/get-value.d.mts +3 -0
- package/src/transformers/common/get-value.mjs +2 -2
- package/src/transformers/common/has-any-of.d.mts +7 -0
- package/src/transformers/common/has-any-of.mjs +10 -6
- package/src/transformers/common/has-component.d.mts +3 -0
- package/src/transformers/common/has-component.mjs +10 -6
- package/src/transformers/common/has-description.d.mts +3 -0
- package/src/transformers/common/has-description.mjs +2 -2
- package/src/transformers/common/has-elements-title.d.mts +1 -0
- package/src/transformers/common/has-elements-title.mjs +5 -1
- package/src/transformers/common/has-enum.d.mts +7 -0
- package/src/transformers/common/has-enum.mjs +10 -6
- package/src/transformers/common/has-field.d.mts +3 -0
- package/src/transformers/common/has-field.mjs +10 -6
- package/src/transformers/common/has-one-of.d.mts +7 -0
- package/src/transformers/common/has-one-of.mjs +10 -6
- package/src/transformers/common/has-required.d.mts +7 -0
- package/src/transformers/common/has-required.mjs +2 -10
- package/src/transformers/common/has-title.d.mts +3 -0
- package/src/transformers/common/has-title.mjs +3 -3
- package/src/transformers/common/has-type.d.mts +3 -0
- package/src/transformers/common/has-type.mjs +10 -6
- package/src/transformers/common/has-value.d.mts +3 -0
- package/src/transformers/common/has-value.mjs +2 -2
- package/src/transformers/common/index.d.mts +24 -188
- package/src/transformers/error-message/index.d.mts +3 -7
- package/src/transformers/error-message/index.mjs +8 -8
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`
|
|
63
|
+
* React config for all `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
|
},
|
|
@@ -111,15 +112,15 @@ export default [
|
|
|
111
112
|
}
|
|
112
113
|
}),
|
|
113
114
|
/**
|
|
114
|
-
* Standard config for all `jsx`
|
|
115
|
+
* Standard config for all `jsx` files
|
|
115
116
|
*/
|
|
116
117
|
standard({
|
|
117
118
|
files: [
|
|
118
|
-
'src/**/*.
|
|
119
|
+
'src/**/*.jsx',
|
|
119
120
|
'stories/**/*.jsx'
|
|
120
121
|
],
|
|
121
122
|
ignores: [
|
|
122
|
-
'src/**/__tests__/**/*.
|
|
123
|
+
'src/**/__tests__/**/*.jsx',
|
|
123
124
|
'stories/**/__tests__/**/*.jsx'
|
|
124
125
|
],
|
|
125
126
|
languageOptions: {
|
|
@@ -148,7 +149,7 @@ export default [
|
|
|
148
149
|
}),
|
|
149
150
|
standard({
|
|
150
151
|
files: [
|
|
151
|
-
'src/**/__tests__/**/*.
|
|
152
|
+
'src/**/__tests__/**/*.jsx',
|
|
152
153
|
'stories/**/__tests__/**/*.jsx'
|
|
153
154
|
],
|
|
154
155
|
languageOptions: {
|
|
@@ -184,83 +185,34 @@ export default [
|
|
|
184
185
|
'**/*.{mts,cts}'
|
|
185
186
|
],
|
|
186
187
|
ignores: [
|
|
187
|
-
'src'
|
|
188
|
-
'stories',
|
|
189
|
-
'test'
|
|
190
|
-
],
|
|
191
|
-
languageOptions: {
|
|
192
|
-
globals: {
|
|
193
|
-
...globals.node
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}),
|
|
197
|
-
typescript({
|
|
198
|
-
files: [
|
|
199
|
-
'src/**/*.{mts,cts}',
|
|
200
|
-
'test/**/*.{mts,cts}'
|
|
201
|
-
],
|
|
202
|
-
languageOptions: {
|
|
203
|
-
globals: {
|
|
204
|
-
...globals.browser,
|
|
205
|
-
PinionTypes: 'readonly'
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}),
|
|
209
|
-
/**
|
|
210
|
-
* TypeScript config for only `tsx` files
|
|
211
|
-
*/
|
|
212
|
-
typescript({
|
|
213
|
-
files: [
|
|
214
|
-
'src/**/*.tsx'
|
|
215
|
-
],
|
|
216
|
-
ignores: [
|
|
217
|
-
'src/**/__tests__/**/*.tsx'
|
|
188
|
+
'src'
|
|
218
189
|
],
|
|
219
190
|
languageOptions: {
|
|
220
191
|
parser: typescriptParser,
|
|
221
192
|
parserOptions: {
|
|
222
|
-
...reactParserOptions,
|
|
223
193
|
projectService: true,
|
|
224
194
|
project: 'tsconfig.json'
|
|
225
195
|
},
|
|
226
196
|
globals: {
|
|
227
|
-
...globals.
|
|
197
|
+
...globals.node,
|
|
198
|
+
PinionTypes: 'readonly'
|
|
228
199
|
}
|
|
229
|
-
},
|
|
230
|
-
plugins: {
|
|
231
|
-
...reactPlugins
|
|
232
|
-
},
|
|
233
|
-
rules: {
|
|
234
|
-
...reactRules
|
|
235
|
-
},
|
|
236
|
-
settings: {
|
|
237
|
-
...reactSettings
|
|
238
200
|
}
|
|
239
201
|
}),
|
|
240
202
|
typescript({
|
|
241
203
|
files: [
|
|
242
|
-
'src
|
|
204
|
+
'src/**/*.{mts,cts}'
|
|
243
205
|
],
|
|
244
206
|
languageOptions: {
|
|
245
207
|
parser: typescriptParser,
|
|
246
208
|
parserOptions: {
|
|
247
|
-
...reactParserOptions,
|
|
248
209
|
projectService: true,
|
|
249
210
|
project: 'tsconfig.json'
|
|
250
211
|
},
|
|
251
212
|
globals: {
|
|
252
213
|
...globals.browser,
|
|
253
|
-
|
|
214
|
+
PinionTypes: 'readonly'
|
|
254
215
|
}
|
|
255
|
-
},
|
|
256
|
-
plugins: {
|
|
257
|
-
...reactPlugins
|
|
258
|
-
},
|
|
259
|
-
rules: {
|
|
260
|
-
...reactRules
|
|
261
|
-
},
|
|
262
|
-
settings: {
|
|
263
|
-
...reactSettings
|
|
264
216
|
}
|
|
265
217
|
})
|
|
266
218
|
]
|
package/index.d.mts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import type { CheckboxProps } from 'shinkansen-cogs/cogs/checkbox'
|
|
2
|
+
import type { EmailProps } from 'shinkansen-cogs/cogs/email'
|
|
3
|
+
import type { NumberProps } from 'shinkansen-cogs/cogs/number'
|
|
4
|
+
import type { PasswordProps } from 'shinkansen-cogs/cogs/password'
|
|
5
|
+
import type { RadioProps } from 'shinkansen-cogs/cogs/radio'
|
|
6
|
+
import type { SelectProps } from 'shinkansen-cogs/cogs/select'
|
|
7
|
+
import type { TextProps } from 'shinkansen-cogs/cogs/text'
|
|
8
|
+
import type { TextareaProps } from 'shinkansen-cogs/cogs/textarea'
|
|
9
|
+
import type { CheckAnswersProps } from 'shinkansen-sprockets/sprockets/check-answers'
|
|
10
|
+
import type { ErrorSummaryProps } from 'shinkansen-sprockets/sprockets/error-summary'
|
|
11
|
+
import type { FieldsetProps } from 'shinkansen-sprockets/sprockets/fieldset'
|
|
12
|
+
|
|
1
13
|
declare global {
|
|
2
14
|
namespace PinionTypes {
|
|
3
15
|
export type ObjectLiteralType = Record<PropertyKey, never>
|
|
@@ -5,6 +17,30 @@ declare global {
|
|
|
5
17
|
export type ArrayLiteralType = never[]
|
|
6
18
|
export type ArrayType = unknown[]
|
|
7
19
|
|
|
20
|
+
export interface EnumType {
|
|
21
|
+
id: string
|
|
22
|
+
name?: string
|
|
23
|
+
isRequired?: boolean
|
|
24
|
+
items?: string[] | number[] | boolean[] | null[]
|
|
25
|
+
selectedItems?: number[]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface AnyOfType {
|
|
29
|
+
id: string
|
|
30
|
+
name?: string
|
|
31
|
+
isRequired?: boolean
|
|
32
|
+
items?: string[]
|
|
33
|
+
selectedItems?: number[]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface OneOfType {
|
|
37
|
+
id: string
|
|
38
|
+
name?: string
|
|
39
|
+
isRequired?: boolean
|
|
40
|
+
items?: string[]
|
|
41
|
+
selectedItems?: number[]
|
|
42
|
+
}
|
|
43
|
+
|
|
8
44
|
export interface FieldError {
|
|
9
45
|
type: string
|
|
10
46
|
params: ObjectType
|
|
@@ -12,59 +48,65 @@ declare global {
|
|
|
12
48
|
}
|
|
13
49
|
|
|
14
50
|
export interface MetaType {
|
|
51
|
+
type: string,
|
|
15
52
|
uri: string
|
|
16
53
|
isRequired?: boolean
|
|
17
|
-
|
|
18
|
-
|
|
54
|
+
schema?: ObjectLiteralType | ObjectType
|
|
55
|
+
items?: unknown[]
|
|
56
|
+
selectedItems?: number[]
|
|
19
57
|
}
|
|
20
58
|
|
|
21
|
-
export
|
|
59
|
+
export interface MetaEnumType extends Omit<MetaType, 'items'> {
|
|
60
|
+
items?: string[]
|
|
61
|
+
selectedItems?: number[]
|
|
62
|
+
}
|
|
22
63
|
|
|
23
|
-
export interface
|
|
24
|
-
|
|
25
|
-
|
|
64
|
+
export interface MetaAnyOfType extends Omit<MetaType, 'items'> {
|
|
65
|
+
items?: PinionType[] // eslint-disable-line no-use-before-define -- Standard type
|
|
66
|
+
selectedItems?: number[]
|
|
26
67
|
}
|
|
27
68
|
|
|
28
|
-
export interface
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
isRequired?: boolean
|
|
32
|
-
items?: string[] | ArrayLiteralType
|
|
33
|
-
selectedItems?: number[] | ArrayLiteralType
|
|
69
|
+
export interface MetaOneOfType extends Omit<MetaType, 'items'> {
|
|
70
|
+
items?: PinionType[] // eslint-disable-line no-use-before-define -- Standard type
|
|
71
|
+
selectedItems?: number[]
|
|
34
72
|
}
|
|
35
73
|
|
|
36
|
-
export
|
|
74
|
+
export type MetaFieldType = MetaType
|
|
75
|
+
|
|
76
|
+
export interface FieldType {
|
|
37
77
|
id: string
|
|
38
78
|
name?: string
|
|
39
79
|
isRequired?: boolean
|
|
40
|
-
items?: string[]
|
|
41
|
-
selectedItems?: number[]
|
|
80
|
+
items?: string[]
|
|
81
|
+
selectedItems?: number[],
|
|
82
|
+
value?: string | number | boolean | null | ObjectType | ArrayType
|
|
83
|
+
defaultValue?: string | number | boolean | null | ObjectType | ArrayType
|
|
42
84
|
}
|
|
43
85
|
|
|
44
|
-
export interface
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
selectedItems?: number[] | ArrayLiteralType
|
|
86
|
+
export interface ElementsType {
|
|
87
|
+
title: string
|
|
88
|
+
description?: string,
|
|
89
|
+
field?: FieldType,
|
|
90
|
+
fields?: PinionType[] // eslint-disable-line no-use-before-define -- Standard type
|
|
50
91
|
}
|
|
51
92
|
|
|
52
|
-
export interface
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
93
|
+
export interface ElementsEnumType extends ElementsType {
|
|
94
|
+
enum: EnumType
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface ElementsAnyOfType extends ElementsType {
|
|
98
|
+
anyOf: AnyOfType
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface ElementsOneOfType extends ElementsType {
|
|
102
|
+
oneOf: OneOfType
|
|
58
103
|
}
|
|
59
104
|
|
|
60
|
-
export type
|
|
61
|
-
export type ElementsAnyOfType = ElementsType & { anyOf: AnyOfType }
|
|
62
|
-
export type ElementsOneOfType = ElementsType & { oneOf: OneOfType }
|
|
63
|
-
export type ElementsFieldType = ElementsType & { field: FieldType }
|
|
105
|
+
export type ElementsFieldType = ElementsType
|
|
64
106
|
|
|
65
107
|
export interface AnswerType {
|
|
66
|
-
meta: MetaType |
|
|
67
|
-
elements: ElementsType | ElementsEnumType | ElementsAnyOfType | ElementsOneOfType
|
|
108
|
+
meta: MetaType | MetaEnumType | MetaAnyOfType | MetaOneOfType
|
|
109
|
+
elements: ElementsType | ElementsEnumType | ElementsAnyOfType | ElementsOneOfType
|
|
68
110
|
}
|
|
69
111
|
|
|
70
112
|
export type ResourceType = Record<PropertyKey, unknown>
|
|
@@ -72,7 +114,7 @@ declare global {
|
|
|
72
114
|
interface AnswerChangeAnswerType {
|
|
73
115
|
href: string
|
|
74
116
|
text: string
|
|
75
|
-
visuallyHiddenText
|
|
117
|
+
visuallyHiddenText?: string
|
|
76
118
|
}
|
|
77
119
|
|
|
78
120
|
export interface TypeStringAnswerType {
|
|
@@ -142,6 +184,109 @@ declare global {
|
|
|
142
184
|
}
|
|
143
185
|
|
|
144
186
|
export type OnChangeType = () => void
|
|
187
|
+
|
|
188
|
+
export interface PinionType {
|
|
189
|
+
meta: MetaType | MetaEnumType | MetaAnyOfType | MetaOneOfType
|
|
190
|
+
elements: ElementsType | ElementsEnumType | ElementsAnyOfType | ElementsOneOfType
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export interface ParamsType { components: Record<PropertyKey, unknown>, errors: FieldError[] }
|
|
194
|
+
|
|
195
|
+
export interface PinionProps {
|
|
196
|
+
pinion: PinionType
|
|
197
|
+
params: ParamsType
|
|
198
|
+
onChange: OnChangeType
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface FieldProps {
|
|
202
|
+
meta: MetaEnumType | MetaAnyOfType | MetaOneOfType | MetaFieldType
|
|
203
|
+
elements: ElementsEnumType | ElementsAnyOfType | ElementsOneOfType | ElementsFieldType
|
|
204
|
+
params: ParamsType
|
|
205
|
+
onChange: OnChangeType
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface GroupProps {
|
|
209
|
+
meta: MetaEnumType | MetaAnyOfType | MetaOneOfType | MetaFieldType
|
|
210
|
+
elements: ElementsEnumType | ElementsAnyOfType | ElementsOneOfType | ElementsFieldType
|
|
211
|
+
params: ParamsType
|
|
212
|
+
onChange: OnChangeType
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export namespace Components {
|
|
216
|
+
export namespace Cogs {
|
|
217
|
+
export namespace Cog {
|
|
218
|
+
export namespace Checkbox {
|
|
219
|
+
export type {
|
|
220
|
+
CheckboxProps
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export namespace Email {
|
|
225
|
+
export type {
|
|
226
|
+
EmailProps
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export namespace Number {
|
|
231
|
+
export type {
|
|
232
|
+
NumberProps
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export namespace Password {
|
|
237
|
+
export type {
|
|
238
|
+
PasswordProps
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export namespace Radio {
|
|
243
|
+
export type {
|
|
244
|
+
RadioProps
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export namespace Select {
|
|
249
|
+
export type {
|
|
250
|
+
SelectProps
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export namespace Text {
|
|
255
|
+
export type {
|
|
256
|
+
TextProps
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export namespace Textarea {
|
|
261
|
+
export type {
|
|
262
|
+
TextareaProps
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export namespace Sprockets {
|
|
269
|
+
export namespace Sprocket {
|
|
270
|
+
export namespace CheckAnswers {
|
|
271
|
+
export type {
|
|
272
|
+
CheckAnswersProps
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export namespace ErrorSummary {
|
|
277
|
+
export type {
|
|
278
|
+
ErrorSummaryProps
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export namespace Fieldset {
|
|
283
|
+
export type {
|
|
284
|
+
FieldsetProps
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
145
290
|
}
|
|
146
291
|
}
|
|
147
292
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinkansen-pinion",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Shinkansen Pinion",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Shinkansen",
|
|
@@ -45,11 +45,13 @@
|
|
|
45
45
|
"transform": "cross-env DEBUG=shinkansen-pinion* ./transform.sh"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"debug": "^4.4.0"
|
|
48
|
+
"debug": "^4.4.0",
|
|
49
|
+
"react-router-dom": "^7.2.0"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@babel/core": "^7.26.9",
|
|
52
53
|
"@babel/eslint-parser": "^7.26.8",
|
|
54
|
+
"@babel/plugin-syntax-import-attributes": "^7.26.0",
|
|
53
55
|
"@babel/preset-env": "^7.26.9",
|
|
54
56
|
"@babel/preset-react": "^7.26.3",
|
|
55
57
|
"@babel/register": "^7.25.9",
|
|
@@ -61,7 +63,13 @@
|
|
|
61
63
|
"@storybook/addon-links": "7.6.20",
|
|
62
64
|
"@storybook/react": "7.6.20",
|
|
63
65
|
"@storybook/react-webpack5": "7.6.20",
|
|
66
|
+
"@types/babel__register": "^7.17.3",
|
|
67
|
+
"@types/chai": "^5.0.1",
|
|
68
|
+
"@types/debug": "^4.1.12",
|
|
69
|
+
"@types/jest": "^29.5.14",
|
|
70
|
+
"@types/mocha": "^10.0.10",
|
|
64
71
|
"@types/react": "18.3.13",
|
|
72
|
+
"@types/react-test-renderer": "^19.0.0",
|
|
65
73
|
"@typescript-eslint/eslint-plugin": "^8.24.1",
|
|
66
74
|
"@typescript-eslint/parser": "^8.24.1",
|
|
67
75
|
"autoprefixer": "^10.4.20",
|
|
@@ -95,25 +103,26 @@
|
|
|
95
103
|
"remove-files-webpack-plugin": "^1.5.0",
|
|
96
104
|
"sass": "^1.85.0",
|
|
97
105
|
"sass-loader": "^16.0.5",
|
|
98
|
-
"shinkansen-cogs": "1.
|
|
106
|
+
"shinkansen-cogs": "1.8.0",
|
|
99
107
|
"shinkansen-rails": "1.0.280",
|
|
100
108
|
"shinkansen-signals": "1.1.210",
|
|
101
|
-
"shinkansen-sprockets": "1.
|
|
109
|
+
"shinkansen-sprockets": "1.2.0",
|
|
102
110
|
"sinon": "^19.0.2",
|
|
103
111
|
"storybook": "7.6.20",
|
|
104
112
|
"webpack": "^5.98.0",
|
|
105
113
|
"webpack-cli": "^6.0.1"
|
|
106
114
|
},
|
|
107
115
|
"peerDependencies": {
|
|
108
|
-
"shinkansen-cogs": "1.
|
|
116
|
+
"shinkansen-cogs": "1.8.x",
|
|
109
117
|
"shinkansen-rails": "1.0.x",
|
|
110
118
|
"shinkansen-signals": "1.1.x",
|
|
111
|
-
"shinkansen-sprockets": "1.
|
|
119
|
+
"shinkansen-sprockets": "1.2.x"
|
|
112
120
|
},
|
|
113
121
|
"imports": {
|
|
114
122
|
"#build/paths": "./build/paths.mjs",
|
|
115
123
|
"#pinion": "./src/index.mjs",
|
|
116
124
|
"#pinion/common": "./src/common/index.mjs",
|
|
125
|
+
"#pinion/common/*": "./src/common/*.mjs",
|
|
117
126
|
"#pinion/components": "./src/components/index.mjs",
|
|
118
127
|
"#pinion/components/*": "./src/components/*/index.mjs",
|
|
119
128
|
"#pinion/pinion": "./src/pinion/index.jsx",
|
|
@@ -136,6 +145,7 @@
|
|
|
136
145
|
"import": "./src/index.mjs"
|
|
137
146
|
},
|
|
138
147
|
"./common": "./src/common/index.mjs",
|
|
148
|
+
"./common/*": "./src/common/*.mjs",
|
|
139
149
|
"./components": {
|
|
140
150
|
"require": "./src/components/index.cjs",
|
|
141
151
|
"import": "./src/components/index.mjs"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {PinionTypes.ObjectType} ObjectType
|
|
3
|
+
*
|
|
4
|
+
* @typedef {PinionTypes.ElementsType} ElementsType
|
|
5
|
+
* @typedef {PinionTypes.ElementsEnumType} ElementsEnumType
|
|
6
|
+
* @typedef {PinionTypes.ElementsAnyOfType} ElementsAnyOfType
|
|
7
|
+
* @typedef {PinionTypes.ElementsOneOfType} ElementsOneOfType
|
|
8
|
+
* @typedef {PinionTypes.ElementsFieldType} ElementsFieldType
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @overload
|
|
13
|
+
* @param {ElementsEnumType | ElementsAnyOfType | ElementsOneOfType | ElementsFieldType} elements
|
|
14
|
+
* @returns {elements is ElementsAnyOfType}
|
|
15
|
+
*
|
|
16
|
+
* @param {ElementsType} elements
|
|
17
|
+
* @returns {boolean}
|
|
18
|
+
*/
|
|
19
|
+
export default function hasAnyOf (elements) {
|
|
20
|
+
return (
|
|
21
|
+
'anyOf' in elements
|
|
22
|
+
)
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {PinionTypes.ObjectType} ObjectType
|
|
3
|
+
*
|
|
4
|
+
* @typedef {PinionTypes.ElementsType} ElementsType
|
|
5
|
+
* @typedef {PinionTypes.ElementsEnumType} ElementsEnumType
|
|
6
|
+
* @typedef {PinionTypes.ElementsAnyOfType} ElementsAnyOfType
|
|
7
|
+
* @typedef {PinionTypes.ElementsOneOfType} ElementsOneOfType
|
|
8
|
+
* @typedef {PinionTypes.ElementsFieldType} ElementsFieldType
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @overload
|
|
13
|
+
* @param {ElementsEnumType | ElementsAnyOfType | ElementsOneOfType | ElementsFieldType} elements
|
|
14
|
+
* @returns {elements is ElementsEnumType}
|
|
15
|
+
*
|
|
16
|
+
* @param {ElementsType} elements
|
|
17
|
+
* @returns {boolean}
|
|
18
|
+
*/
|
|
19
|
+
export default function hasEnum (elements) {
|
|
20
|
+
return (
|
|
21
|
+
'enum' in elements
|
|
22
|
+
)
|
|
23
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {PinionTypes.ElementsType} ElementsType
|
|
3
|
+
* @typedef {PinionTypes.ElementsEnumType} ElementsEnumType
|
|
4
|
+
* @typedef {PinionTypes.ElementsAnyOfType} ElementsAnyOfType
|
|
5
|
+
* @typedef {PinionTypes.ElementsOneOfType} ElementsOneOfType
|
|
6
|
+
* @typedef {PinionTypes.ElementsFieldType} ElementsFieldType
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import hasEnum from './has-enum.mjs'
|
|
10
|
+
import hasAnyOf from './has-any-of.mjs'
|
|
11
|
+
import hasOneOf from './has-one-of.mjs'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @overload
|
|
15
|
+
* @param {ElementsEnumType | ElementsAnyOfType | ElementsOneOfType | ElementsFieldType} elements
|
|
16
|
+
* @returns {elements is ElementsFieldType}
|
|
17
|
+
*
|
|
18
|
+
* @param {ElementsType} elements
|
|
19
|
+
* @returns {boolean}
|
|
20
|
+
*/
|
|
21
|
+
export default function hasField (elements) {
|
|
22
|
+
return !(
|
|
23
|
+
hasEnum(elements) ||
|
|
24
|
+
hasAnyOf(elements) ||
|
|
25
|
+
hasOneOf(elements)
|
|
26
|
+
)
|
|
27
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {PinionTypes.ObjectType} ObjectType
|
|
3
|
+
*
|
|
4
|
+
* @typedef {PinionTypes.ElementsType} ElementsType
|
|
5
|
+
* @typedef {PinionTypes.ElementsEnumType} ElementsEnumType
|
|
6
|
+
* @typedef {PinionTypes.ElementsAnyOfType} ElementsAnyOfType
|
|
7
|
+
* @typedef {PinionTypes.ElementsOneOfType} ElementsOneOfType
|
|
8
|
+
* @typedef {PinionTypes.ElementsFieldType} ElementsFieldType
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @overload
|
|
13
|
+
* @param {ElementsEnumType | ElementsAnyOfType | ElementsOneOfType | ElementsFieldType} elements
|
|
14
|
+
* @returns {elements is ElementsOneOfType}
|
|
15
|
+
*
|
|
16
|
+
* @param {ElementsType} elements
|
|
17
|
+
* @returns {boolean}
|
|
18
|
+
*/
|
|
19
|
+
export default function hasOneOf (elements) {
|
|
20
|
+
return (
|
|
21
|
+
'oneOf' in elements
|
|
22
|
+
)
|
|
23
|
+
}
|
package/src/common/index.d.mts
CHANGED
package/src/common/index.mjs
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {PinionTypes.ObjectType} ObjectType
|
|
3
|
+
*
|
|
4
|
+
* @typedef {PinionTypes.MetaType} MetaType
|
|
5
|
+
* @typedef {PinionTypes.MetaEnumType} MetaEnumType
|
|
6
|
+
* @typedef {PinionTypes.MetaAnyOfType} MetaAnyOfType
|
|
7
|
+
* @typedef {PinionTypes.MetaOneOfType} MetaOneOfType
|
|
8
|
+
* @typedef {PinionTypes.MetaFieldType} MetaFieldType
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @overload
|
|
13
|
+
* @param {MetaEnumType | MetaAnyOfType | MetaOneOfType | MetaFieldType} meta
|
|
14
|
+
* @returns {ObjectType}
|
|
15
|
+
*
|
|
16
|
+
* @param {MetaType} meta
|
|
17
|
+
* @returns {ObjectType}
|
|
18
|
+
*/
|
|
19
|
+
export default function getSchema ({ schema = {} }) {
|
|
20
|
+
return schema
|
|
21
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {PinionTypes.MetaType} MetaType
|
|
3
|
+
* @typedef {PinionTypes.MetaEnumType} MetaEnumType
|
|
4
|
+
* @typedef {PinionTypes.MetaAnyOfType} MetaAnyOfType
|
|
5
|
+
* @typedef {PinionTypes.MetaOneOfType} MetaOneOfType
|
|
6
|
+
* @typedef {PinionTypes.MetaFieldType} MetaFieldType
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import getSchema from './get-schema.mjs'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @overload
|
|
13
|
+
* @param {MetaEnumType | MetaAnyOfType | MetaOneOfType | MetaFieldType} meta
|
|
14
|
+
* @returns {meta is MetaAnyOfType}
|
|
15
|
+
*
|
|
16
|
+
* @param {MetaType} meta
|
|
17
|
+
* @returns {boolean}
|
|
18
|
+
*/
|
|
19
|
+
export default function hasAnyOf (meta) {
|
|
20
|
+
return (
|
|
21
|
+
'anyOf' in getSchema(meta)
|
|
22
|
+
)
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {PinionTypes.MetaType} MetaType
|
|
3
|
+
* @typedef {PinionTypes.MetaEnumType} MetaEnumType
|
|
4
|
+
* @typedef {PinionTypes.MetaAnyOfType} MetaAnyOfType
|
|
5
|
+
* @typedef {PinionTypes.MetaOneOfType} MetaOneOfType
|
|
6
|
+
* @typedef {PinionTypes.MetaFieldType} MetaFieldType
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import getSchema from './get-schema.mjs'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @overload
|
|
13
|
+
* @param {MetaEnumType | MetaAnyOfType | MetaOneOfType | MetaFieldType} meta
|
|
14
|
+
* @returns {meta is MetaEnumType}
|
|
15
|
+
*
|
|
16
|
+
* @param {MetaType} meta
|
|
17
|
+
* @returns {boolean}
|
|
18
|
+
*/
|
|
19
|
+
export default function hasEnum (meta) {
|
|
20
|
+
return (
|
|
21
|
+
'enum' in getSchema(meta)
|
|
22
|
+
)
|
|
23
|
+
}
|