shinkansen-cogs 1.7.302 → 1.8.1
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 +1 -0
- package/eslint.config.mjs +11 -56
- package/index.d.mts +214 -4
- package/package.json +8 -4
- package/src/cogs/checkbox/description/index.cjs +1 -1
- package/src/cogs/checkbox/description/index.jsx +0 -4
- package/src/cogs/checkbox/error-message/index.cjs +1 -1
- package/src/cogs/checkbox/error-message/index.jsx +0 -4
- package/src/cogs/checkbox/field/index.cjs +1 -1
- package/src/cogs/checkbox/field/index.d.mts +8 -2
- package/src/cogs/checkbox/field/index.jsx +11 -1
- package/src/cogs/checkbox/index.cjs +1 -1
- package/src/cogs/checkbox/index.d.mts +20 -2
- package/src/cogs/checkbox/index.jsx +41 -14
- package/src/cogs/checkbox/title/index.cjs +1 -1
- package/src/cogs/checkbox/title/index.d.mts +5 -1
- package/src/cogs/checkbox/title/index.jsx +8 -4
- package/src/cogs/email/description/index.cjs +1 -1
- package/src/cogs/email/description/index.jsx +0 -4
- package/src/cogs/email/error-message/index.cjs +1 -1
- package/src/cogs/email/error-message/index.jsx +0 -4
- package/src/cogs/email/field/index.cjs +1 -1
- package/src/cogs/email/field/index.d.mts +8 -2
- package/src/cogs/email/field/index.jsx +11 -5
- package/src/cogs/email/index.cjs +1 -1
- package/src/cogs/email/index.d.mts +13 -2
- package/src/cogs/email/index.jsx +17 -8
- package/src/cogs/email/title/index.cjs +1 -1
- package/src/cogs/email/title/index.d.mts +5 -1
- package/src/cogs/email/title/index.jsx +8 -4
- package/src/cogs/index.cjs +1 -0
- package/src/cogs/index.d.mts +31 -13
- package/src/cogs/index.jsx +43 -14
- package/src/cogs/number/description/index.cjs +1 -1
- package/src/cogs/number/description/index.jsx +0 -4
- package/src/cogs/number/error-message/index.cjs +1 -1
- package/src/cogs/number/error-message/index.jsx +0 -4
- package/src/cogs/number/field/index.cjs +1 -1
- package/src/cogs/number/field/index.d.mts +8 -2
- package/src/cogs/number/field/index.jsx +11 -1
- package/src/cogs/number/index.cjs +1 -1
- package/src/cogs/number/index.d.mts +13 -2
- package/src/cogs/number/index.jsx +17 -4
- package/src/cogs/number/title/index.cjs +1 -1
- package/src/cogs/number/title/index.d.mts +5 -1
- package/src/cogs/number/title/index.jsx +8 -4
- package/src/cogs/password/description/index.cjs +1 -1
- package/src/cogs/password/description/index.jsx +0 -4
- package/src/cogs/password/error-message/index.cjs +1 -1
- package/src/cogs/password/error-message/index.jsx +0 -4
- package/src/cogs/password/field/index.cjs +1 -1
- package/src/cogs/password/field/index.d.mts +8 -2
- package/src/cogs/password/field/index.jsx +11 -5
- package/src/cogs/password/index.cjs +1 -1
- package/src/cogs/password/index.d.mts +13 -2
- package/src/cogs/password/index.jsx +17 -8
- package/src/cogs/password/title/index.cjs +1 -1
- package/src/cogs/password/title/index.d.mts +5 -1
- package/src/cogs/password/title/index.jsx +8 -4
- package/src/cogs/radio/description/index.cjs +1 -1
- package/src/cogs/radio/description/index.jsx +0 -4
- package/src/cogs/radio/error-message/index.cjs +1 -1
- package/src/cogs/radio/error-message/index.jsx +0 -4
- package/src/cogs/radio/field/index.cjs +1 -1
- package/src/cogs/radio/field/index.d.mts +8 -2
- package/src/cogs/radio/field/index.jsx +11 -1
- package/src/cogs/radio/index.cjs +1 -1
- package/src/cogs/radio/index.d.mts +20 -2
- package/src/cogs/radio/index.jsx +41 -14
- package/src/cogs/radio/title/index.cjs +1 -1
- package/src/cogs/radio/title/index.d.mts +5 -1
- package/src/cogs/radio/title/index.jsx +8 -4
- package/src/cogs/select/description/index.cjs +1 -1
- package/src/cogs/select/description/index.jsx +0 -4
- package/src/cogs/select/error-message/index.cjs +1 -1
- package/src/cogs/select/error-message/index.jsx +0 -4
- package/src/cogs/select/field/index.cjs +1 -1
- package/src/cogs/select/field/index.d.mts +8 -2
- package/src/cogs/select/field/index.jsx +56 -15
- package/src/cogs/select/index.cjs +1 -1
- package/src/cogs/select/index.d.mts +13 -2
- package/src/cogs/select/index.jsx +39 -12
- package/src/cogs/select/title/index.cjs +1 -1
- package/src/cogs/select/title/index.d.mts +5 -1
- package/src/cogs/select/title/index.jsx +8 -4
- package/src/cogs/text/description/index.cjs +1 -1
- package/src/cogs/text/description/index.jsx +0 -4
- package/src/cogs/text/error-message/index.cjs +1 -1
- package/src/cogs/text/error-message/index.jsx +0 -4
- package/src/cogs/text/field/index.cjs +1 -1
- package/src/cogs/text/field/index.d.mts +8 -2
- package/src/cogs/text/field/index.jsx +11 -5
- package/src/cogs/text/index.cjs +1 -1
- package/src/cogs/text/index.d.mts +13 -2
- package/src/cogs/text/index.jsx +17 -8
- package/src/cogs/text/title/index.cjs +1 -1
- package/src/cogs/text/title/index.d.mts +5 -1
- package/src/cogs/text/title/index.jsx +8 -4
- package/src/cogs/textarea/description/index.cjs +1 -1
- package/src/cogs/textarea/description/index.jsx +0 -4
- package/src/cogs/textarea/error-message/index.cjs +1 -1
- package/src/cogs/textarea/error-message/index.jsx +0 -4
- package/src/cogs/textarea/field/index.cjs +1 -1
- package/src/cogs/textarea/field/index.d.mts +8 -2
- package/src/cogs/textarea/field/index.jsx +11 -5
- package/src/cogs/textarea/index.cjs +1 -1
- package/src/cogs/textarea/index.d.mts +13 -2
- package/src/cogs/textarea/index.jsx +17 -8
- package/src/cogs/textarea/title/index.cjs +1 -1
- package/src/cogs/textarea/title/index.d.mts +5 -1
- package/src/cogs/textarea/title/index.jsx +8 -4
- package/src/common/index.d.mts +10 -2
- package/src/components/common/disabled/index.cjs +1 -1
- package/src/components/common/disabled/index.jsx +7 -5
- package/src/components/common/readonly/index.cjs +1 -1
- package/src/components/common/readonly/index.jsx +7 -5
- package/src/components/common/required/index.cjs +1 -1
- package/src/components/common/required/index.jsx +7 -5
- package/src/components/common/text-content/index.cjs +1 -1
- package/src/components/common/text-content/index.d.mts +3 -4
- package/src/components/common/text-content/index.jsx +6 -5
- package/src/components/description/index.cjs +1 -1
- package/src/components/description/index.d.mts +10 -5
- package/src/components/description/index.jsx +12 -2
- package/src/components/error-message/index.cjs +1 -1
- package/src/components/error-message/index.d.mts +22 -3
- package/src/components/error-message/index.jsx +28 -11
- package/src/components/field/index.cjs +1 -1
- package/src/components/field/index.d.mts +29 -14
- package/src/components/field/index.jsx +57 -17
- package/src/components/title/index.cjs +1 -1
- package/src/components/title/index.d.mts +22 -10
- package/src/components/title/index.jsx +12 -2
- package/src/index.d.mts +3 -0
- package/src/transformers/error-message/index.d.mts +8 -0
- package/src/transformers/error-message/index.mjs +12 -4
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` and `
|
|
63
|
+
* React config for all `jsx` and `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
|
},
|
|
@@ -100,15 +101,15 @@ export default [
|
|
|
100
101
|
}
|
|
101
102
|
}),
|
|
102
103
|
/**
|
|
103
|
-
* Standard config for all `jsx`
|
|
104
|
+
* Standard config for all `jsx`
|
|
104
105
|
*/
|
|
105
106
|
standard({
|
|
106
107
|
files: [
|
|
107
|
-
'src/**/*.
|
|
108
|
+
'src/**/*.jsx',
|
|
108
109
|
'stories/**/*.jsx'
|
|
109
110
|
],
|
|
110
111
|
ignores: [
|
|
111
|
-
'src/**/__tests__/**/*.
|
|
112
|
+
'src/**/__tests__/**/*.jsx',
|
|
112
113
|
'stories/**/__tests__/**/*.jsx'
|
|
113
114
|
],
|
|
114
115
|
languageOptions: {
|
|
@@ -137,7 +138,7 @@ export default [
|
|
|
137
138
|
}),
|
|
138
139
|
standard({
|
|
139
140
|
files: [
|
|
140
|
-
'src/**/__tests__/**/*.
|
|
141
|
+
'src/**/__tests__/**/*.jsx',
|
|
141
142
|
'stories/**/__tests__/**/*.jsx'
|
|
142
143
|
],
|
|
143
144
|
languageOptions: {
|
|
@@ -175,78 +176,32 @@ export default [
|
|
|
175
176
|
ignores: [
|
|
176
177
|
'src'
|
|
177
178
|
],
|
|
178
|
-
languageOptions: {
|
|
179
|
-
globals: {
|
|
180
|
-
...globals.node,
|
|
181
|
-
CogsTypes: 'readonly'
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}),
|
|
185
|
-
typescript({
|
|
186
|
-
files: [
|
|
187
|
-
'src/**/*.{mts,cts}'
|
|
188
|
-
],
|
|
189
|
-
languageOptions: {
|
|
190
|
-
globals: {
|
|
191
|
-
...globals.browser
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}),
|
|
195
|
-
/**
|
|
196
|
-
* TypeScript config for only `tsx` files
|
|
197
|
-
*/
|
|
198
|
-
typescript({
|
|
199
|
-
files: [
|
|
200
|
-
'src/**/*.tsx'
|
|
201
|
-
],
|
|
202
|
-
ignores: [
|
|
203
|
-
'src/**/__tests__/**/*.tsx'
|
|
204
|
-
],
|
|
205
179
|
languageOptions: {
|
|
206
180
|
parser: typescriptParser,
|
|
207
181
|
parserOptions: {
|
|
208
|
-
...reactParserOptions,
|
|
209
182
|
projectService: true,
|
|
210
183
|
project: 'tsconfig.json'
|
|
211
184
|
},
|
|
212
185
|
globals: {
|
|
213
|
-
...globals.
|
|
186
|
+
...globals.node,
|
|
187
|
+
CogsTypes: 'readonly'
|
|
214
188
|
}
|
|
215
|
-
},
|
|
216
|
-
plugins: {
|
|
217
|
-
...reactPlugins
|
|
218
|
-
},
|
|
219
|
-
rules: {
|
|
220
|
-
...reactRules
|
|
221
|
-
},
|
|
222
|
-
settings: {
|
|
223
|
-
...reactSettings
|
|
224
189
|
}
|
|
225
190
|
}),
|
|
226
191
|
typescript({
|
|
227
192
|
files: [
|
|
228
|
-
'src
|
|
193
|
+
'src/**/*.{mts,cts}'
|
|
229
194
|
],
|
|
230
195
|
languageOptions: {
|
|
231
196
|
parser: typescriptParser,
|
|
232
197
|
parserOptions: {
|
|
233
|
-
...reactParserOptions,
|
|
234
198
|
projectService: true,
|
|
235
199
|
project: 'tsconfig.json'
|
|
236
200
|
},
|
|
237
201
|
globals: {
|
|
238
202
|
...globals.browser,
|
|
239
|
-
|
|
203
|
+
CogsTypes: 'readonly'
|
|
240
204
|
}
|
|
241
|
-
},
|
|
242
|
-
plugins: {
|
|
243
|
-
...reactPlugins
|
|
244
|
-
},
|
|
245
|
-
rules: {
|
|
246
|
-
...reactRules
|
|
247
|
-
},
|
|
248
|
-
settings: {
|
|
249
|
-
...reactSettings
|
|
250
205
|
}
|
|
251
206
|
})
|
|
252
207
|
]
|
package/index.d.mts
CHANGED
|
@@ -1,19 +1,229 @@
|
|
|
1
|
+
import type React from 'react'
|
|
2
|
+
|
|
1
3
|
declare global {
|
|
2
4
|
namespace CogsTypes {
|
|
3
|
-
export type OnChangeType = (
|
|
5
|
+
export type OnChangeType = (
|
|
6
|
+
name: string,
|
|
7
|
+
value?: string | string[],
|
|
8
|
+
checked?: boolean
|
|
9
|
+
) => void
|
|
10
|
+
|
|
11
|
+
export type OnClickType = (
|
|
12
|
+
name: string,
|
|
13
|
+
value?: string | string[],
|
|
14
|
+
checked?: boolean
|
|
15
|
+
) => void
|
|
4
16
|
|
|
5
17
|
export interface ErrorDefinitionType {
|
|
6
18
|
type: string
|
|
7
19
|
uri: string
|
|
8
|
-
params:
|
|
9
|
-
expectedType: string
|
|
10
|
-
}
|
|
20
|
+
params: Record<PropertyKey, unknown> | Record<PropertyKey, never>
|
|
11
21
|
}
|
|
12
22
|
|
|
13
23
|
export interface FieldErrorType {
|
|
14
24
|
text: string
|
|
15
25
|
href: string
|
|
16
26
|
}
|
|
27
|
+
|
|
28
|
+
export namespace Components {
|
|
29
|
+
export namespace Common {
|
|
30
|
+
export namespace TextContent {
|
|
31
|
+
export interface TextContentProps {
|
|
32
|
+
textContent?: string
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export namespace Description {
|
|
38
|
+
export interface DescriptionProps {
|
|
39
|
+
description?: string
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export namespace ErrorMessage {
|
|
44
|
+
export interface ErrorMessageProps {
|
|
45
|
+
errorMessage?: ErrorDefinitionType
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface ErrorMessageState {
|
|
49
|
+
errorMessage?: ErrorDefinitionType
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export namespace Field {
|
|
54
|
+
export interface FieldProps extends React.PropsWithChildren {
|
|
55
|
+
id?: string
|
|
56
|
+
name: string
|
|
57
|
+
required?: boolean
|
|
58
|
+
disabled?: boolean
|
|
59
|
+
readOnly?: boolean
|
|
60
|
+
tabIndex?: number
|
|
61
|
+
accessKey?: string
|
|
62
|
+
placeholder?: string
|
|
63
|
+
onChange?: OnChangeType
|
|
64
|
+
fieldRef?: React.RefObject<any> // eslint-disable-line @typescript-eslint/no-explicit-any -- Simplicity
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface ValueProps extends FieldProps {
|
|
68
|
+
value?: string,
|
|
69
|
+
defaultValue?: string
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface CheckProps extends FieldProps {
|
|
73
|
+
value?: string,
|
|
74
|
+
checked?: boolean,
|
|
75
|
+
defaultChecked?: boolean,
|
|
76
|
+
onClick: OnClickType
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export namespace Checkbox {
|
|
80
|
+
export type CheckboxProps = CheckProps
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export namespace Email {
|
|
84
|
+
export type EmailProps = ValueProps
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export namespace Number {
|
|
88
|
+
export type NumberProps = ValueProps
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export namespace Password {
|
|
92
|
+
export type PasswordProps = ValueProps
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export namespace Radio {
|
|
96
|
+
export type RadioProps = CheckProps
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export namespace Select {
|
|
100
|
+
export interface SelectProps extends ValueProps, React.PropsWithChildren {
|
|
101
|
+
multiple?: boolean
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export namespace Text {
|
|
106
|
+
export type TextProps = ValueProps
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export namespace Textarea {
|
|
110
|
+
export type TextareaProps = ValueProps
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export namespace Title {
|
|
115
|
+
export interface TitleProps extends React.PropsWithChildren {
|
|
116
|
+
id: string
|
|
117
|
+
title?: string
|
|
118
|
+
required?: boolean
|
|
119
|
+
disabled?: boolean
|
|
120
|
+
readOnly?: boolean
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export namespace Checkbox {
|
|
124
|
+
export type CheckboxProps = TitleProps
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export namespace Email {
|
|
128
|
+
export type EmailProps = TitleProps
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export namespace Number {
|
|
132
|
+
export type NumberProps = TitleProps
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export namespace Password {
|
|
136
|
+
export type PasswordProps = TitleProps
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export namespace Radio {
|
|
140
|
+
export type RadioProps = TitleProps
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export namespace Select {
|
|
144
|
+
export type SelectProps = TitleProps
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export namespace Text {
|
|
148
|
+
export type TextProps = TitleProps
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export namespace Textarea {
|
|
152
|
+
export type TextareaProps = TitleProps
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export namespace Cogs {
|
|
158
|
+
export namespace Cog {
|
|
159
|
+
export interface CogProps {
|
|
160
|
+
id?: string
|
|
161
|
+
name: string
|
|
162
|
+
title?: string
|
|
163
|
+
description?: string
|
|
164
|
+
errorMessage?: ErrorDefinitionType
|
|
165
|
+
required?: boolean
|
|
166
|
+
disabled?: boolean
|
|
167
|
+
readOnly?: boolean
|
|
168
|
+
tabIndex?: number,
|
|
169
|
+
accessKey?: string,
|
|
170
|
+
placeholder?: string
|
|
171
|
+
onChange?: OnChangeType
|
|
172
|
+
fieldRef?: React.RefObject<any> // eslint-disable-line @typescript-eslint/no-explicit-any -- Simplicity
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface ValueProps extends CogProps {
|
|
176
|
+
value?: string,
|
|
177
|
+
defaultValue?: string
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export interface CheckProps extends CogProps {
|
|
181
|
+
value?: string,
|
|
182
|
+
checked?: boolean,
|
|
183
|
+
defaultChecked?: boolean,
|
|
184
|
+
onClick: OnClickType
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export namespace Checkbox {
|
|
188
|
+
export type CheckboxProps = CheckProps
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export namespace Email {
|
|
192
|
+
export type EmailProps = ValueProps
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export namespace Number {
|
|
196
|
+
export interface NumberProps extends Omit<Omit<ValueProps, 'value'>, 'defaultValue'> {
|
|
197
|
+
value?: string | number
|
|
198
|
+
defaultValue?: string | number
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export namespace Password {
|
|
203
|
+
export type PasswordProps = ValueProps
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export namespace Radio {
|
|
207
|
+
export type RadioProps = CheckProps
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export namespace Select {
|
|
211
|
+
export interface SelectProps extends Omit<Omit<ValueProps, 'value'>, 'defaultValue'>, React.PropsWithChildren {
|
|
212
|
+
multiple?: boolean
|
|
213
|
+
value?: string | string[]
|
|
214
|
+
defaultValue?: string | string[]
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export namespace Text {
|
|
219
|
+
export type TextProps = ValueProps
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export namespace Textarea {
|
|
223
|
+
export type TextareaProps = ValueProps
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
17
227
|
}
|
|
18
228
|
}
|
|
19
229
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinkansen-cogs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "Shinkansen Cogs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Shinkansen",
|
|
@@ -54,14 +54,18 @@
|
|
|
54
54
|
"@babel/preset-react": "^7.26.3",
|
|
55
55
|
"@babel/register": "^7.25.9",
|
|
56
56
|
"@modernpoacher/design-system": "1.1.27",
|
|
57
|
-
"@sequencemedia/eslint-config-standard": "^0.2.
|
|
58
|
-
"@sequencemedia/eslint-config-typescript": "^0.1.
|
|
57
|
+
"@sequencemedia/eslint-config-standard": "^0.2.26",
|
|
58
|
+
"@sequencemedia/eslint-config-typescript": "^0.1.37",
|
|
59
59
|
"@storybook/addon-actions": "7.6.20",
|
|
60
60
|
"@storybook/addon-essentials": "7.6.20",
|
|
61
61
|
"@storybook/addon-links": "7.6.20",
|
|
62
62
|
"@storybook/react": "7.6.20",
|
|
63
63
|
"@storybook/react-webpack5": "7.6.20",
|
|
64
|
+
"@types/babel__register": "^7.17.3",
|
|
65
|
+
"@types/debug": "^4.1.12",
|
|
66
|
+
"@types/jest": "^29.5.14",
|
|
64
67
|
"@types/react": "18.3.13",
|
|
68
|
+
"@types/react-test-renderer": "^19.0.0",
|
|
65
69
|
"@typescript-eslint/eslint-plugin": "^8.24.1",
|
|
66
70
|
"@typescript-eslint/parser": "^8.24.1",
|
|
67
71
|
"autoprefixer": "^10.4.20",
|
|
@@ -77,7 +81,7 @@
|
|
|
77
81
|
"jest": "^29.7.0",
|
|
78
82
|
"mini-css-extract-plugin": "^2.9.2",
|
|
79
83
|
"perfectionist": "^2.4.0",
|
|
80
|
-
"postcss": "^8.5.
|
|
84
|
+
"postcss": "^8.5.3",
|
|
81
85
|
"postcss-discard-comments": "^7.0.3",
|
|
82
86
|
"postcss-discard-empty": "^7.0.0",
|
|
83
87
|
"postcss-import": "^16.1.0",
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
declare module '#cogs/cogs/checkbox/field' {
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
CheckField
|
|
4
|
+
} from '#cogs/components/field'
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
type CheckboxProps = CogsTypes.Components.Field.Checkbox.CheckboxProps
|
|
7
|
+
|
|
8
|
+
export default class CheckboxField<P extends CheckboxProps> extends CheckField<P> {}
|
|
5
9
|
}
|
|
6
10
|
|
|
7
11
|
declare module 'shinkansen-cogs/cogs/checkbox/field' {
|
|
12
|
+
export type CheckboxProps = CogsTypes.Components.Field.Checkbox.CheckboxProps
|
|
13
|
+
|
|
8
14
|
export { default } from '#cogs/cogs/checkbox/field'
|
|
9
15
|
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {CogsTypes.Components.Field.CheckProps} CheckProps
|
|
3
|
+
* @typedef {CogsTypes.Components.Field.Checkbox.CheckboxProps} CheckboxProps
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* CheckboxField component
|
|
3
8
|
*/
|
|
@@ -5,8 +10,13 @@ import React from 'react'
|
|
|
5
10
|
import PropTypes from 'prop-types'
|
|
6
11
|
import classnames from 'classnames'
|
|
7
12
|
|
|
8
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
CheckField
|
|
15
|
+
} from '#cogs/components/field'
|
|
9
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @extends {CheckField<CheckProps & CheckboxProps>}
|
|
19
|
+
*/
|
|
10
20
|
export default class CheckboxField extends CheckField {
|
|
11
21
|
getClassName () {
|
|
12
22
|
return classnames(super.getClassName(), 'checkbox')
|
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
declare module '#cogs/cogs/checkbox' {
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
CheckCog
|
|
4
|
+
} from '#cogs/cogs'
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
type CheckboxProps = CogsTypes.Cogs.Cog.Checkbox.CheckboxProps
|
|
7
|
+
|
|
8
|
+
export default class CheckboxCog<P extends CheckboxProps> extends CheckCog<P> {
|
|
9
|
+
handleChange (
|
|
10
|
+
name: string,
|
|
11
|
+
value?: string | string[],
|
|
12
|
+
checked?: boolean
|
|
13
|
+
): void
|
|
14
|
+
|
|
15
|
+
handleClick (
|
|
16
|
+
name: string,
|
|
17
|
+
value?: string | string[],
|
|
18
|
+
checked?: boolean
|
|
19
|
+
): void
|
|
20
|
+
}
|
|
5
21
|
}
|
|
6
22
|
|
|
7
23
|
declare module 'shinkansen-cogs/cogs/checkbox' {
|
|
24
|
+
export type CheckboxProps = CogsTypes.Cogs.Cog.Checkbox.CheckboxProps
|
|
25
|
+
|
|
8
26
|
export { default } from '#cogs/cogs/checkbox'
|
|
9
27
|
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {CogsTypes.Cogs.Cog.CheckProps} CheckProps
|
|
3
|
+
* @typedef {CogsTypes.Cogs.Cog.Checkbox.CheckboxProps} CheckboxProps
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* CheckboxCog component
|
|
3
8
|
*/
|
|
@@ -5,7 +10,9 @@ import React from 'react'
|
|
|
5
10
|
import PropTypes from 'prop-types'
|
|
6
11
|
import classnames from 'classnames'
|
|
7
12
|
|
|
8
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
CheckCog
|
|
15
|
+
} from '#cogs/cogs'
|
|
9
16
|
|
|
10
17
|
import {
|
|
11
18
|
DEFAULT_HANDLE_CHANGE,
|
|
@@ -17,36 +24,56 @@ import Description from './description/index.jsx'
|
|
|
17
24
|
import ErrorMessage from './error-message/index.jsx'
|
|
18
25
|
import Field from './field/index.jsx'
|
|
19
26
|
|
|
27
|
+
/**
|
|
28
|
+
* @extends {CheckCog<CheckProps & CheckboxProps>}
|
|
29
|
+
*/
|
|
20
30
|
export default class CheckboxCog extends CheckCog {
|
|
21
31
|
getClassName () {
|
|
22
32
|
return classnames(super.getClassName(), 'checkbox')
|
|
23
33
|
}
|
|
24
34
|
|
|
25
|
-
|
|
35
|
+
/**
|
|
36
|
+
* @param {CheckProps} props
|
|
37
|
+
* @returns {boolean}
|
|
38
|
+
*/
|
|
39
|
+
shouldComponentUpdate (props) {
|
|
26
40
|
const {
|
|
27
|
-
|
|
28
|
-
|
|
41
|
+
value,
|
|
42
|
+
...superProps
|
|
43
|
+
} = props
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
super.shouldComponentUpdate(superProps) ||
|
|
47
|
+
(value !== this.props.value)
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @param {string} name
|
|
53
|
+
* @param {string | string[]} [value]
|
|
54
|
+
* @param {boolean} [checked]
|
|
55
|
+
*/
|
|
56
|
+
handleChange = (name, value, checked) => {
|
|
57
|
+
const {
|
|
58
|
+
onChange = DEFAULT_HANDLE_CHANGE
|
|
29
59
|
} = this.props
|
|
30
60
|
|
|
31
61
|
onChange(name, value, checked)
|
|
32
62
|
}
|
|
33
63
|
|
|
34
|
-
|
|
64
|
+
/**
|
|
65
|
+
* @param {string} name
|
|
66
|
+
* @param {string | string[]} [value]
|
|
67
|
+
* @param {boolean} [checked]
|
|
68
|
+
*/
|
|
69
|
+
handleClick = (name, value, checked) => {
|
|
35
70
|
const {
|
|
36
|
-
onClick = DEFAULT_HANDLE_CLICK
|
|
37
|
-
name
|
|
71
|
+
onClick = DEFAULT_HANDLE_CLICK
|
|
38
72
|
} = this.props
|
|
39
73
|
|
|
40
74
|
onClick(name, value, checked)
|
|
41
75
|
}
|
|
42
76
|
|
|
43
|
-
shouldComponentUpdate (props, state) {
|
|
44
|
-
return (
|
|
45
|
-
super.shouldComponentUpdate(props) ||
|
|
46
|
-
(props.value !== this.props.value)
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
77
|
renderTitle () {
|
|
51
78
|
const id = this.getId()
|
|
52
79
|
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
declare module '#cogs/cogs/checkbox/title' {
|
|
2
2
|
import Title from '#cogs/components/title'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type CheckboxProps = CogsTypes.Components.Title.Checkbox.CheckboxProps
|
|
5
|
+
|
|
6
|
+
export default class CheckboxTitle<P extends CheckboxProps> extends Title<P> {}
|
|
5
7
|
}
|
|
6
8
|
|
|
7
9
|
declare module 'shinkansen-cogs/cogs/checkbox/title' {
|
|
10
|
+
export type CheckboxProps = CogsTypes.Components.Title.Checkbox.CheckboxProps
|
|
11
|
+
|
|
8
12
|
export { default } from '#cogs/cogs/checkbox/title'
|
|
9
13
|
}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {CogsTypes.Components.Title.TitleProps} TitleProps
|
|
3
|
+
* @typedef {CogsTypes.Components.Title.Checkbox.CheckboxProps} CheckboxProps
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* CheckboxTitle component
|
|
3
8
|
*/
|
|
4
9
|
import classnames from 'classnames'
|
|
5
10
|
import Title from '#cogs/components/title'
|
|
6
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @extends {Title<TitleProps & CheckboxProps>}
|
|
14
|
+
*/
|
|
7
15
|
export default class CheckboxTitle extends Title {
|
|
8
16
|
getClassName () {
|
|
9
17
|
return classnames(super.getClassName(), 'checkbox')
|
|
10
18
|
}
|
|
11
19
|
}
|
|
12
|
-
|
|
13
|
-
CheckboxTitle.propTypes = {
|
|
14
|
-
...Title.propTypes
|
|
15
|
-
}
|