shinkansen-pinion 1.1.299 → 1.1.302

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shinkansen-pinion",
3
- "version": "1.1.299",
3
+ "version": "1.1.302",
4
4
  "description": "Shinkansen Pinion",
5
5
  "keywords": [
6
6
  "Shinkansen",
@@ -12,7 +12,7 @@
12
12
  ],
13
13
  "main": "./src/index.cjs",
14
14
  "type": "module",
15
- "types": "./src/index.d.cts",
15
+ "types": "./src/index.d.mts",
16
16
  "author": {
17
17
  "name": "Jonathan Perry for Modern Poacher Limited",
18
18
  "email": "modernpoacher@modernpoacher.com",
@@ -103,10 +103,10 @@
103
103
  "react-test-renderer": "^18.2.0",
104
104
  "regenerator-runtime": "^0.14.1",
105
105
  "sass": "^1.71.1",
106
- "shinkansen-cogs": "1.7.80",
107
- "shinkansen-rails": "1.0.139",
108
- "shinkansen-signals": "1.1.118",
109
- "shinkansen-sprockets": "1.1.243",
106
+ "shinkansen-cogs": "1.7.82",
107
+ "shinkansen-rails": "1.0.141",
108
+ "shinkansen-signals": "1.1.120",
109
+ "shinkansen-sprockets": "1.1.244",
110
110
  "sinon": "^17.0.1",
111
111
  "storybook": "^7.6.17",
112
112
  "vinyl-paths": "^5.0.0"
@@ -0,0 +1,6 @@
1
+ declare module 'shinkansen-pinion/components/check-answers' {
2
+ import type React from 'react'
3
+ import type { SprocketProps } from 'shinkansen-sprockets/sprockets'
4
+
5
+ export default function CheckAnswersSprocket (props: SprocketProps): React.JSX.Element
6
+ }
@@ -0,0 +1,6 @@
1
+ declare module 'shinkansen-pinion/components/error-summary' {
2
+ import type React from 'react'
3
+ import type { SprocketProps } from 'shinkansen-sprockets/sprockets'
4
+
5
+ export default function ErrorSummarySprocket (props: SprocketProps): React.JSX.Element
6
+ }
@@ -0,0 +1,6 @@
1
+ declare module 'shinkansen-pinion/components/fieldset' {
2
+ import type React from 'react'
3
+ import type { SprocketProps } from 'shinkansen-sprockets/sprockets'
4
+
5
+ export default function FieldsetSprocket (props: SprocketProps): React.JSX.Element
6
+ }
@@ -0,0 +1,35 @@
1
+ declare namespace PinionTypes {
2
+ export interface FieldError {
3
+ type: string
4
+ params: Record<string, unknown>
5
+ uri: string
6
+ }
7
+
8
+ export interface MetaType {
9
+ items: string[]
10
+ selectedItems: number[]
11
+ uri: string
12
+ }
13
+
14
+ export type MetaComponentType = MetaType & { component: Record<string, unknown> }
15
+
16
+ export interface ElementsType {
17
+ title: string
18
+ description: string
19
+ }
20
+
21
+ export interface EnumType { id: string, name?: string, isRequired?: boolean }
22
+ export interface AnyOfType { id: string, name?: string, isRequired?: boolean }
23
+ export interface OneOfType { id: string, name?: string, isRequired?: boolean }
24
+ export interface FieldType { id: string, name?: string, isRequired?: boolean }
25
+ export type ElementsEnumType = ElementsType & { enum: EnumType }
26
+ export type ElementsAnyOfType = ElementsType & { anyOf: AnyOfType }
27
+ export type ElementsOneOfType = ElementsType & { oneOf: OneOfType }
28
+ export type ElementsFieldType = ElementsType & { field: FieldType }
29
+
30
+ export type OnChangeType = () => void
31
+ }
32
+
33
+ declare module 'shinkansen-pinion' {
34
+ export { default as Pinion } from 'shinkansen-pinion/pinion'
35
+ }
@@ -0,0 +1,42 @@
1
+ declare module 'shinkansen-pinion/pinion' {
2
+ import type React from 'react'
3
+
4
+ interface PinionType {
5
+ meta: PinionTypes.MetaType
6
+ elements: PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType
7
+ }
8
+ interface ParamsType { components: Record<string, unknown>, errors: PinionTypes.FieldError[] }
9
+
10
+ export interface FieldProps {
11
+ meta: PinionTypes.MetaType
12
+ elements: PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType
13
+ params: ParamsType
14
+ onChange: PinionTypes.OnChangeType
15
+ }
16
+
17
+ export interface GroupProps {
18
+ meta: PinionTypes.MetaType
19
+ elements: PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType
20
+ params: ParamsType
21
+ onChange: PinionTypes.OnChangeType
22
+ }
23
+
24
+ export interface PinionProps {
25
+ pinion: PinionType
26
+ params: ParamsType
27
+ onChange: PinionTypes.OnChangeType
28
+ }
29
+
30
+ export function renderToRadiosForEnum (meta: PinionTypes.MetaType, elements: PinionTypes.ElementsEnumType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
31
+ export function renderToRadiosForAnyOf (meta: PinionTypes.MetaType, elements: PinionTypes.ElementsAnyOfType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
32
+ export function renderToRadiosForOneOf (meta: PinionTypes.MetaType, elements: PinionTypes.ElementsOneOfType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
33
+ export function renderToSelectForEnum (meta: PinionTypes.MetaType, elements: PinionTypes.ElementsEnumType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
34
+ export function renderToSelectForAnyOf (meta: PinionTypes.MetaType, elements: PinionTypes.ElementsAnyOfType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
35
+ export function renderToSelectForOneOf (meta: PinionTypes.MetaType, elements: PinionTypes.ElementsOneOfType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
36
+ export function renderToField (meta: PinionTypes.MetaType, elements: PinionTypes.ElementsFieldType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
37
+ export function Field (props: FieldProps): React.JSX.Element
38
+ export function Group (props: GroupProps): React.JSX.Element
39
+ export function renderField (pinion: PinionType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element | null
40
+ export function renderGroup (pinion: PinionType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element | null
41
+ export default function Pinion (props: PinionProps): React.JSX.Element
42
+ }
@@ -0,0 +1,31 @@
1
+ declare module 'shinkansen-pinion/transformers/common/has-component' {
2
+ export default function hasComponent (meta: PinionTypes.MetaType | PinionTypes.MetaComponentType): boolean
3
+ }
4
+
5
+ declare module 'shinkansen-pinion/transformers/common/get-component' {
6
+ export default function getComponent (meta: PinionTypes.MetaType | PinionTypes.MetaComponentType): PinionTypes.MetaComponentType | undefined
7
+ }
8
+
9
+ declare module 'shinkansen-pinion/transformers/common/has-enum' {
10
+ export default function hasEnum (elements: (PinionTypes.ElementsType | PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType)): boolean
11
+ }
12
+
13
+ declare module 'shinkansen-pinion/transformers/common/get-enum' {
14
+ export default function getEnum (elements: (PinionTypes.ElementsType | PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType)): PinionTypes.ElementsEnumType | undefined
15
+ }
16
+
17
+ declare module 'shinkansen-pinion/transformers/common/has-any-of' {
18
+ export default function hasAnyOf (elements: (PinionTypes.ElementsType | PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType)): boolean
19
+ }
20
+
21
+ declare module 'shinkansen-pinion/transformers/common/get-any-of' {
22
+ export default function getAnyOf (elements: (PinionTypes.ElementsType | PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType)): PinionTypes.ElementsAnyOfType | undefined
23
+ }
24
+
25
+ declare module 'shinkansen-pinion/transformers/common/has-one-of' {
26
+ export default function hasOneOf (elements: (PinionTypes.ElementsType | PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType)): boolean
27
+ }
28
+
29
+ declare module 'shinkansen-pinion/transformers/common/get-one-of' {
30
+ export default function getOneOf (elements: (PinionTypes.ElementsType | PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType)): PinionTypes.ElementsOneOfType | undefined
31
+ }
@@ -0,0 +1,4 @@
1
+ declare module 'shinkansen-pinion/transformers/error-message' {
2
+ export function hasError (errors: PinionTypes.FieldError[], uri: string | null): boolean
3
+ export function getError (errors: PinionTypes.FieldError[], uri: string | null): PinionTypes.FieldError | null
4
+ }
package/src/index.d.cts DELETED
@@ -1,136 +0,0 @@
1
- declare namespace PinionTypes {
2
- export interface FieldError {
3
- type: string
4
- params: Record<string, unknown>
5
- uri: string
6
- }
7
-
8
- export interface MetaType {
9
- items: string[]
10
- selectedItems: number[]
11
- uri: string
12
- }
13
-
14
- export type MetaComponentType = MetaType & { component: Record<string, unknown> }
15
-
16
- export interface ElementsType {
17
- title: string
18
- description: string
19
- }
20
-
21
- export interface EnumType { id: string, name?: string, isRequired?: boolean }
22
- export interface AnyOfType { id: string, name?: string, isRequired?: boolean }
23
- export interface OneOfType { id: string, name?: string, isRequired?: boolean }
24
- export interface FieldType { id: string, name?: string, isRequired?: boolean }
25
- export type ElementsEnumType = ElementsType & { enum: EnumType }
26
- export type ElementsAnyOfType = ElementsType & { anyOf: AnyOfType }
27
- export type ElementsOneOfType = ElementsType & { oneOf: OneOfType }
28
- export type ElementsFieldType = ElementsType & { field: FieldType }
29
-
30
- export type OnChangeType = () => void
31
- }
32
-
33
- declare module 'shinkansen-pinion/components/check-answers' {
34
- import type React from 'react'
35
- import type { SprocketProps } from 'shinkansen-sprockets/sprockets'
36
-
37
- export default function CheckAnswersSprocket (props: SprocketProps): React.JSX.Element
38
- }
39
-
40
- declare module 'shinkansen-pinion/components/error-summary' {
41
- import type React from 'react'
42
- import type { SprocketProps } from 'shinkansen-sprockets/sprockets'
43
-
44
- export default function ErrorSummarySprocket (props: SprocketProps): React.JSX.Element
45
- }
46
-
47
- declare module 'shinkansen-pinion/components/fieldset' {
48
- import type React from 'react'
49
- import type { SprocketProps } from 'shinkansen-sprockets/sprockets'
50
-
51
- export default function FieldsetSprocket (props: SprocketProps): React.JSX.Element
52
- }
53
-
54
- declare module 'shinkansen-pinion/transformers/common/has-component' {
55
- export default function hasComponent (meta: PinionTypes.MetaType | PinionTypes.MetaComponentType): boolean
56
- }
57
-
58
- declare module 'shinkansen-pinion/transformers/common/get-component' {
59
- export default function getComponent (meta: PinionTypes.MetaType | PinionTypes.MetaComponentType): PinionTypes.MetaComponentType | undefined
60
- }
61
-
62
- declare module 'shinkansen-pinion/transformers/common/has-enum' {
63
- export default function hasEnum (elements: (PinionTypes.ElementsType | PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType)): boolean
64
- }
65
-
66
- declare module 'shinkansen-pinion/transformers/common/get-enum' {
67
- export default function getEnum (elements: (PinionTypes.ElementsType | PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType)): PinionTypes.ElementsEnumType | undefined
68
- }
69
-
70
- declare module 'shinkansen-pinion/transformers/common/has-any-of' {
71
- export default function hasAnyOf (elements: (PinionTypes.ElementsType | PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType)): boolean
72
- }
73
-
74
- declare module 'shinkansen-pinion/transformers/common/get-any-of' {
75
- export default function getAnyOf (elements: (PinionTypes.ElementsType | PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType)): PinionTypes.ElementsAnyOfType | undefined
76
- }
77
-
78
- declare module 'shinkansen-pinion/transformers/common/has-one-of' {
79
- export default function hasOneOf (elements: (PinionTypes.ElementsType | PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType)): boolean
80
- }
81
-
82
- declare module 'shinkansen-pinion/transformers/common/get-one-of' {
83
- export default function getOneOf (elements: (PinionTypes.ElementsType | PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType)): PinionTypes.ElementsOneOfType | undefined
84
- }
85
-
86
- declare module 'shinkansen-pinion/transformers/error-message' {
87
- export function hasError (errors: PinionTypes.FieldError[], uri: string | null): boolean
88
- export function getError (errors: PinionTypes.FieldError[], uri: string | null): PinionTypes.FieldError | null
89
- }
90
-
91
- declare module 'shinkansen-pinion/pinion' {
92
- import type React from 'react'
93
-
94
- interface PinionType {
95
- meta: PinionTypes.MetaType
96
- elements: PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType
97
- }
98
- interface ParamsType { components: Record<string, unknown>, errors: PinionTypes.FieldError[] }
99
-
100
- export interface FieldProps {
101
- meta: PinionTypes.MetaType
102
- elements: PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType
103
- params: ParamsType
104
- onChange: PinionTypes.OnChangeType
105
- }
106
-
107
- export interface GroupProps {
108
- meta: PinionTypes.MetaType
109
- elements: PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType
110
- params: ParamsType
111
- onChange: PinionTypes.OnChangeType
112
- }
113
-
114
- export interface PinionProps {
115
- pinion: PinionType
116
- params: ParamsType
117
- onChange: PinionTypes.OnChangeType
118
- }
119
-
120
- export function renderToRadiosForEnum (meta: PinionTypes.MetaType, elements: PinionTypes.ElementsEnumType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
121
- export function renderToRadiosForAnyOf (meta: PinionTypes.MetaType, elements: PinionTypes.ElementsAnyOfType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
122
- export function renderToRadiosForOneOf (meta: PinionTypes.MetaType, elements: PinionTypes.ElementsOneOfType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
123
- export function renderToSelectForEnum (meta: PinionTypes.MetaType, elements: PinionTypes.ElementsEnumType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
124
- export function renderToSelectForAnyOf (meta: PinionTypes.MetaType, elements: PinionTypes.ElementsAnyOfType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
125
- export function renderToSelectForOneOf (meta: PinionTypes.MetaType, elements: PinionTypes.ElementsOneOfType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
126
- export function renderToField (meta: PinionTypes.MetaType, elements: PinionTypes.ElementsFieldType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
127
- export function Field (props: FieldProps): React.JSX.Element
128
- export function Group (props: GroupProps): React.JSX.Element
129
- export function renderField (pinion: PinionType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element | null
130
- export function renderGroup (pinion: PinionType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element | null
131
- export default function Pinion (props: PinionProps): React.JSX.Element
132
- }
133
-
134
- declare module 'shinkansen-pinion' {
135
- export { default as Pinion } from 'shinkansen-pinion/pinion'
136
- }