shinkansen-pinion 1.0.65 → 1.0.66

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.d.cts +143 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shinkansen-pinion",
3
- "version": "1.0.65",
3
+ "version": "1.0.66",
4
4
  "description": "Shinkansen Pinion",
5
5
  "keywords": [
6
6
  "Shinkansen",
@@ -0,0 +1,143 @@
1
+ declare namespace PinionTypes {
2
+ export type FieldError = {
3
+ type: string
4
+ params: {}
5
+ uri: string
6
+ }
7
+
8
+ export type MetaType = {
9
+ items: string[],
10
+ selectedItems: number[],
11
+ uri: string
12
+ }
13
+
14
+ export type MetaComponentType = MetaType & { component: {} }
15
+
16
+ export type ElementsType = {
17
+ title: string,
18
+ description: string
19
+ }
20
+
21
+ export type EnumType = { id: string, name?: string, isRequired?: boolean }
22
+ export type AnyOfType = { id: string, name?: string, isRequired?: boolean }
23
+ export type OneOfType = { id: string, name?: string, isRequired?: boolean }
24
+ export type 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 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/common/text-content' {
41
+ import React from 'react'
42
+
43
+ export type TextContentProps = {
44
+ textContent: string
45
+ }
46
+
47
+ export default function TextContent(props: TextContentProps): React.JSX.Element
48
+ }
49
+
50
+ declare module 'shinkansen-pinion/components/common' {
51
+ export * as TextContent from 'shinkansen-pinion/components/common/text-content'
52
+ }
53
+
54
+ declare module 'shinkansen-pinion/components/error-summary' {
55
+ import React from 'react'
56
+ import type { SprocketProps } from 'shinkansen-sprockets/sprockets'
57
+
58
+ export default function ErrorSummarySprocket(props: SprocketProps): React.JSX.Element
59
+ }
60
+
61
+ declare module 'shinkansen-pinion/transformers/common/has-component' {
62
+ export default function hasComponent (meta: PinionTypes.MetaType | PinionTypes.MetaComponentType): boolean
63
+ }
64
+
65
+ declare module 'shinkansen-pinion/transformers/common/get-component' {
66
+ export default function getComponent (meta: PinionTypes.MetaType | PinionTypes.MetaComponentType): PinionTypes.MetaComponentType | void
67
+ }
68
+
69
+ declare module 'shinkansen-pinion/transformers/common/has-enum' {
70
+ export default function hasEnum (elements: (PinionTypes.ElementsType | PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType)): boolean
71
+ }
72
+
73
+ declare module 'shinkansen-pinion/transformers/common/get-enum' {
74
+ export default function getEnum (elements: (PinionTypes.ElementsType | PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType)): PinionTypes.ElementsEnumType | void
75
+ }
76
+
77
+ declare module 'shinkansen-pinion/transformers/common/has-any-of' {
78
+ export default function hasAnyOf (elements: (PinionTypes.ElementsType | PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType)): boolean
79
+ }
80
+
81
+ declare module 'shinkansen-pinion/transformers/common/get-any-of' {
82
+ export default function getAnyOf (elements: (PinionTypes.ElementsType | PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType)): PinionTypes.ElementsAnyOfType | void
83
+ }
84
+
85
+ declare module 'shinkansen-pinion/transformers/common/has-one-of' {
86
+ export default function hasOneOf (elements: (PinionTypes.ElementsType | PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType)): boolean
87
+ }
88
+
89
+ declare module 'shinkansen-pinion/transformers/common/get-one-of' {
90
+ export default function getOneOf (elements: (PinionTypes.ElementsType | PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType)): PinionTypes.ElementsOneOfType | void
91
+ }
92
+
93
+ declare module 'shinkansen-pinion/transformers/error-message' {
94
+ export function hasError (errors: PinionTypes.FieldError[], uri: string | null): boolean
95
+ export function getError (errors: PinionTypes.FieldError[], uri: string | null): PinionTypes.FieldError | null
96
+ }
97
+
98
+ declare module 'shinkansen-pinion/pinion' {
99
+ import React from 'react'
100
+
101
+ type PinionType = {
102
+ meta: PinionTypes.MetaType,
103
+ elements: PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType
104
+ }
105
+ type ParamsType = {components: {}, errors: PinionTypes.FieldError[]}
106
+
107
+ export type FieldProps = {
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 type GroupProps = {
115
+ meta: PinionTypes.MetaType,
116
+ elements: PinionTypes.ElementsEnumType | PinionTypes.ElementsAnyOfType | PinionTypes.ElementsOneOfType | PinionTypes.ElementsFieldType
117
+ params: ParamsType
118
+ onChange: PinionTypes.OnChangeType
119
+ }
120
+
121
+ export type PinionProps = {
122
+ pinion: PinionType
123
+ params: ParamsType
124
+ onChange: PinionTypes.OnChangeType
125
+ }
126
+
127
+ export function renderToRadiosForEnum(meta: PinionTypes.MetaType, elements: PinionTypes.ElementsEnumType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
128
+ export function renderToRadiosForAnyOf(meta: PinionTypes.MetaType, elements: PinionTypes.ElementsAnyOfType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
129
+ export function renderToRadiosForOneOf(meta: PinionTypes.MetaType, elements: PinionTypes.ElementsOneOfType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
130
+ export function renderToSelectForEnum(meta: PinionTypes.MetaType, elements: PinionTypes.ElementsEnumType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
131
+ export function renderToSelectForAnyOf(meta: PinionTypes.MetaType, elements: PinionTypes.ElementsAnyOfType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
132
+ export function renderToSelectForOneOf(meta: PinionTypes.MetaType, elements: PinionTypes.ElementsOneOfType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
133
+ export function renderToField(meta: PinionTypes.MetaType, elements: PinionTypes.ElementsFieldType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element
134
+ export function Field(props: FieldProps): React.JSX.Element
135
+ export function Group(props: GroupProps): React.JSX.Element
136
+ export function renderField (pinion: PinionType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element | null
137
+ export function renderGroup (pinion: PinionType, params: ParamsType, onChange: PinionTypes.OnChangeType): React.JSX.Element | null
138
+ export default function Pinion(props: PinionProps): React.JSX.Element
139
+ }
140
+
141
+ declare module 'shinkansen-pinion' {
142
+ export { default as Pinion } from 'shinkansen-pinion/pinion'
143
+ }