shinkansen-cogs 1.7.301 → 1.8.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 +1 -0
- package/eslint.config.mjs +11 -56
- package/index.d.mts +214 -4
- package/package.json +6 -2
- 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
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {CogsTypes.Cogs.Cog.ValueProps} ValueProps
|
|
3
|
+
* @typedef {CogsTypes.Cogs.Cog.Select.SelectProps} SelectProps
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* SelectCog 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
|
+
ValueCog
|
|
15
|
+
} from '#cogs/cogs'
|
|
9
16
|
|
|
10
17
|
import {
|
|
11
18
|
DEFAULT_HANDLE_CHANGE
|
|
@@ -16,23 +23,43 @@ import Description from './description/index.jsx'
|
|
|
16
23
|
import ErrorMessage from './error-message/index.jsx'
|
|
17
24
|
import Field from './field/index.jsx'
|
|
18
25
|
|
|
26
|
+
/**
|
|
27
|
+
* @extends {ValueCog<ValueProps & SelectProps>}
|
|
28
|
+
*/
|
|
19
29
|
export default class SelectCog extends ValueCog {
|
|
20
|
-
shouldComponentUpdate (props, state) {
|
|
21
|
-
return (
|
|
22
|
-
super.shouldComponentUpdate(props) ||
|
|
23
|
-
(props.multiple !== this.props.multiple) ||
|
|
24
|
-
(props.children !== this.props.children)
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
30
|
getClassName () {
|
|
29
31
|
return classnames(super.getClassName(), 'select')
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
/**
|
|
35
|
+
* @param {SelectProps} props
|
|
36
|
+
* @returns {boolean}
|
|
37
|
+
*/
|
|
38
|
+
shouldComponentUpdate (props) {
|
|
39
|
+
const {
|
|
40
|
+
value,
|
|
41
|
+
defaultValue,
|
|
42
|
+
multiple,
|
|
43
|
+
children,
|
|
44
|
+
...superProps
|
|
45
|
+
} = props
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
super.shouldComponentUpdate(superProps) ||
|
|
49
|
+
(value !== this.props.value) ||
|
|
50
|
+
(defaultValue !== this.props.defaultValue) ||
|
|
51
|
+
(multiple !== this.props.multiple) ||
|
|
52
|
+
(children !== this.props.children)
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @param {string} name
|
|
58
|
+
* @param {string | string[]} [value]
|
|
59
|
+
*/
|
|
60
|
+
handleChange = (name, value) => {
|
|
33
61
|
const {
|
|
34
|
-
onChange = DEFAULT_HANDLE_CHANGE
|
|
35
|
-
name
|
|
62
|
+
onChange = DEFAULT_HANDLE_CHANGE
|
|
36
63
|
} = this.props
|
|
37
64
|
|
|
38
65
|
onChange(name, value)
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
declare module '#cogs/cogs/select/title' {
|
|
2
2
|
import Title from '#cogs/components/title'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type SelectProps = CogsTypes.Components.Title.Select.SelectProps
|
|
5
|
+
|
|
6
|
+
export default class SelectTitle<P extends SelectProps> extends Title<P> {}
|
|
5
7
|
}
|
|
6
8
|
|
|
7
9
|
declare module 'shinkansen-cogs/cogs/select/title' {
|
|
10
|
+
export type SelectProps = CogsTypes.Components.Title.Select.SelectProps
|
|
11
|
+
|
|
8
12
|
export { default } from '#cogs/cogs/select/title'
|
|
9
13
|
}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {CogsTypes.Components.Title.TitleProps} TitleProps
|
|
3
|
+
* @typedef {CogsTypes.Components.Title.Select.SelectProps} SelectProps
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* SelectTitle component
|
|
3
8
|
*/
|
|
4
9
|
import classnames from 'classnames'
|
|
5
10
|
import Title from '#cogs/components/title'
|
|
6
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @extends {Title<TitleProps & SelectProps>}
|
|
14
|
+
*/
|
|
7
15
|
export default class SelectTitle extends Title {
|
|
8
16
|
getClassName () {
|
|
9
17
|
return classnames(super.getClassName(), 'select')
|
|
10
18
|
}
|
|
11
19
|
}
|
|
12
|
-
|
|
13
|
-
SelectTitle.propTypes = {
|
|
14
|
-
...Title.propTypes
|
|
15
|
-
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
declare module '#cogs/cogs/text/field' {
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
ValueField
|
|
4
|
+
} from '#cogs/components/field'
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
type TextProps = CogsTypes.Components.Field.Text.TextProps
|
|
7
|
+
|
|
8
|
+
export default class TextField<P extends TextProps> extends ValueField<P> {}
|
|
5
9
|
}
|
|
6
10
|
|
|
7
11
|
declare module 'shinkansen-cogs/cogs/text/field' {
|
|
12
|
+
export type TextProps = CogsTypes.Components.Field.Text.TextProps
|
|
13
|
+
|
|
8
14
|
export { default } from '#cogs/cogs/text/field'
|
|
9
15
|
}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {CogsTypes.Components.Field.ValueProps} ValueProps
|
|
3
|
+
* @typedef {CogsTypes.Components.Field.Text.TextProps} TextProps
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* TextField component
|
|
3
8
|
*/
|
|
4
9
|
import React from 'react'
|
|
5
10
|
import classnames from 'classnames'
|
|
6
11
|
|
|
7
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
ValueField
|
|
14
|
+
} from '#cogs/components/field'
|
|
8
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @extends {ValueField<ValueProps & TextProps>}
|
|
18
|
+
*/
|
|
9
19
|
export default class TextField extends ValueField {
|
|
10
20
|
getClassName () {
|
|
11
21
|
return classnames(super.getClassName(), 'text')
|
|
@@ -48,7 +58,3 @@ export default class TextField extends ValueField {
|
|
|
48
58
|
)
|
|
49
59
|
}
|
|
50
60
|
}
|
|
51
|
-
|
|
52
|
-
TextField.propTypes = {
|
|
53
|
-
...ValueField.propTypes
|
|
54
|
-
}
|
package/src/cogs/text/index.cjs
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
declare module '#cogs/cogs/text' {
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
ValueCog
|
|
4
|
+
} from '#cogs/cogs'
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
type TextProps = CogsTypes.Cogs.Cog.Text.TextProps
|
|
7
|
+
|
|
8
|
+
export default class TextCog<P extends TextProps> extends ValueCog<P> {
|
|
9
|
+
handleChange (
|
|
10
|
+
name: string,
|
|
11
|
+
value?: string | string[]
|
|
12
|
+
): void
|
|
13
|
+
}
|
|
5
14
|
}
|
|
6
15
|
|
|
7
16
|
declare module 'shinkansen-cogs/cogs/text' {
|
|
17
|
+
export type TextProps = CogsTypes.Cogs.Cog.Text.TextProps
|
|
18
|
+
|
|
8
19
|
export { default } from '#cogs/cogs/text'
|
|
9
20
|
}
|
package/src/cogs/text/index.jsx
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {CogsTypes.Cogs.Cog.ValueProps} ValueProps
|
|
3
|
+
* @typedef {CogsTypes.Cogs.Cog.Text.TextProps} TextProps
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* TextCog component
|
|
3
8
|
*/
|
|
4
9
|
import React from 'react'
|
|
5
10
|
import classnames from 'classnames'
|
|
6
11
|
|
|
7
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
ValueCog
|
|
14
|
+
} from '#cogs/cogs'
|
|
8
15
|
|
|
9
16
|
import {
|
|
10
17
|
DEFAULT_HANDLE_CHANGE
|
|
@@ -15,15 +22,21 @@ import Description from './description/index.jsx'
|
|
|
15
22
|
import ErrorMessage from './error-message/index.jsx'
|
|
16
23
|
import Field from './field/index.jsx'
|
|
17
24
|
|
|
25
|
+
/**
|
|
26
|
+
* @extends {ValueCog<ValueProps & TextProps>}
|
|
27
|
+
*/
|
|
18
28
|
export default class TextCog extends ValueCog {
|
|
19
29
|
getClassName () {
|
|
20
30
|
return classnames(super.getClassName(), 'text')
|
|
21
31
|
}
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
/**
|
|
34
|
+
* @param {string} name
|
|
35
|
+
* @param {string | string[]} [value]
|
|
36
|
+
*/
|
|
37
|
+
handleChange = (name, value) => {
|
|
24
38
|
const {
|
|
25
|
-
onChange = DEFAULT_HANDLE_CHANGE
|
|
26
|
-
name
|
|
39
|
+
onChange = DEFAULT_HANDLE_CHANGE
|
|
27
40
|
} = this.props
|
|
28
41
|
|
|
29
42
|
onChange(name, value)
|
|
@@ -108,7 +121,3 @@ export default class TextCog extends ValueCog {
|
|
|
108
121
|
)
|
|
109
122
|
}
|
|
110
123
|
}
|
|
111
|
-
|
|
112
|
-
TextCog.propTypes = {
|
|
113
|
-
...ValueCog.propTypes
|
|
114
|
-
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
declare module '#cogs/cogs/text/title' {
|
|
2
2
|
import Title from '#cogs/components/title'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type TextProps = CogsTypes.Components.Title.Text.TextProps
|
|
5
|
+
|
|
6
|
+
export default class TextTitle<P extends TextProps> extends Title<P> {}
|
|
5
7
|
}
|
|
6
8
|
|
|
7
9
|
declare module 'shinkansen-cogs/cogs/text/title' {
|
|
10
|
+
export type TextProps = CogsTypes.Components.Title.Text.TextProps
|
|
11
|
+
|
|
8
12
|
export { default } from '#cogs/cogs/text/title'
|
|
9
13
|
}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {CogsTypes.Components.Title.TitleProps} TitleProps
|
|
3
|
+
* @typedef {CogsTypes.Components.Title.Text.TextProps} TextProps
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* TextTitle component
|
|
3
8
|
*/
|
|
4
9
|
import classnames from 'classnames'
|
|
5
10
|
import Title from '#cogs/components/title'
|
|
6
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @extends {Title<TitleProps & TextProps>}
|
|
14
|
+
*/
|
|
7
15
|
export default class TextTitle extends Title {
|
|
8
16
|
getClassName () {
|
|
9
17
|
return classnames(super.getClassName(), 'text')
|
|
10
18
|
}
|
|
11
19
|
}
|
|
12
|
-
|
|
13
|
-
TextTitle.propTypes = {
|
|
14
|
-
...Title.propTypes
|
|
15
|
-
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
declare module '#cogs/cogs/textarea/field' {
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
ValueField
|
|
4
|
+
} from '#cogs/components/field'
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
type TextareaProps = CogsTypes.Components.Field.Textarea.TextareaProps
|
|
7
|
+
|
|
8
|
+
export default class TextareaField<P extends TextareaProps> extends ValueField<P> {}
|
|
5
9
|
}
|
|
6
10
|
|
|
7
11
|
declare module 'shinkansen-cogs/cogs/textarea/field' {
|
|
12
|
+
export type TextareaProps = CogsTypes.Components.Field.Textarea.TextareaProps
|
|
13
|
+
|
|
8
14
|
export { default } from '#cogs/cogs/textarea/field'
|
|
9
15
|
}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {CogsTypes.Components.Field.ValueProps} ValueProps
|
|
3
|
+
* @typedef {CogsTypes.Components.Field.Textarea.TextareaProps} TextareaProps
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* TextareaField component
|
|
3
8
|
*/
|
|
4
9
|
import React from 'react'
|
|
5
10
|
import classnames from 'classnames'
|
|
6
11
|
|
|
7
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
ValueField
|
|
14
|
+
} from '#cogs/components/field'
|
|
8
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @extends {ValueField<ValueProps & TextareaProps>}
|
|
18
|
+
*/
|
|
9
19
|
export default class TextareaField extends ValueField {
|
|
10
20
|
getClassName () {
|
|
11
21
|
return classnames(super.getClassName(), 'textarea')
|
|
@@ -47,7 +57,3 @@ export default class TextareaField extends ValueField {
|
|
|
47
57
|
)
|
|
48
58
|
}
|
|
49
59
|
}
|
|
50
|
-
|
|
51
|
-
TextareaField.propTypes = {
|
|
52
|
-
...ValueField.propTypes
|
|
53
|
-
}
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
declare module '#cogs/cogs/textarea' {
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
ValueCog
|
|
4
|
+
} from '#cogs/cogs'
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
type TextareaProps = CogsTypes.Cogs.Cog.Textarea.TextareaProps
|
|
7
|
+
|
|
8
|
+
export default class TextareaCog<P extends TextareaProps> extends ValueCog<P> {
|
|
9
|
+
handleChange (
|
|
10
|
+
name: string,
|
|
11
|
+
value?: string | string[]
|
|
12
|
+
): void
|
|
13
|
+
}
|
|
5
14
|
}
|
|
6
15
|
|
|
7
16
|
declare module 'shinkansen-cogs/cogs/textarea' {
|
|
17
|
+
export type TextareaProps = CogsTypes.Cogs.Cog.Textarea.TextareaProps
|
|
18
|
+
|
|
8
19
|
export { default } from '#cogs/cogs/textarea'
|
|
9
20
|
}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {CogsTypes.Cogs.Cog.ValueProps} ValueProps
|
|
3
|
+
* @typedef {CogsTypes.Cogs.Cog.Textarea.TextareaProps} TextareaProps
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* TextareaCog component
|
|
3
8
|
*/
|
|
4
9
|
import React from 'react'
|
|
5
10
|
import classnames from 'classnames'
|
|
6
11
|
|
|
7
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
ValueCog
|
|
14
|
+
} from '#cogs/cogs'
|
|
8
15
|
|
|
9
16
|
import {
|
|
10
17
|
DEFAULT_HANDLE_CHANGE
|
|
@@ -15,15 +22,21 @@ import Description from './description/index.jsx'
|
|
|
15
22
|
import ErrorMessage from './error-message/index.jsx'
|
|
16
23
|
import Field from './field/index.jsx'
|
|
17
24
|
|
|
25
|
+
/**
|
|
26
|
+
* @extends {ValueCog<ValueProps & TextareaProps>}
|
|
27
|
+
*/
|
|
18
28
|
export default class TextareaCog extends ValueCog {
|
|
19
29
|
getClassName () {
|
|
20
30
|
return classnames(super.getClassName(), 'textarea')
|
|
21
31
|
}
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
/**
|
|
34
|
+
* @param {string} name
|
|
35
|
+
* @param {string | string[]} [value]
|
|
36
|
+
*/
|
|
37
|
+
handleChange = (name, value) => {
|
|
24
38
|
const {
|
|
25
|
-
onChange = DEFAULT_HANDLE_CHANGE
|
|
26
|
-
name
|
|
39
|
+
onChange = DEFAULT_HANDLE_CHANGE
|
|
27
40
|
} = this.props
|
|
28
41
|
|
|
29
42
|
onChange(name, value)
|
|
@@ -108,7 +121,3 @@ export default class TextareaCog extends ValueCog {
|
|
|
108
121
|
)
|
|
109
122
|
}
|
|
110
123
|
}
|
|
111
|
-
|
|
112
|
-
TextareaCog.propTypes = {
|
|
113
|
-
...ValueCog.propTypes
|
|
114
|
-
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
declare module '#cogs/cogs/textarea/title' {
|
|
2
2
|
import Title from '#cogs/components/title'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type TextareaProps = CogsTypes.Components.Title.Textarea.TextareaProps
|
|
5
|
+
|
|
6
|
+
export default class TextareaTitle<P extends TextareaProps> extends Title<P> {}
|
|
5
7
|
}
|
|
6
8
|
|
|
7
9
|
declare module 'shinkansen-cogs/cogs/textarea/title' {
|
|
10
|
+
export type TextareaProps = CogsTypes.Components.Title.Textarea.TextareaProps
|
|
11
|
+
|
|
8
12
|
export { default } from '#cogs/cogs/textarea/title'
|
|
9
13
|
}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {CogsTypes.Components.Title.TitleProps} TitleProps
|
|
3
|
+
* @typedef {CogsTypes.Components.Title.Textarea.TextareaProps} TextareaProps
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* TextareaTitle component
|
|
3
8
|
*/
|
|
4
9
|
import classnames from 'classnames'
|
|
5
10
|
import Title from '#cogs/components/title'
|
|
6
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @extends {Title<TitleProps & TextareaProps>}
|
|
14
|
+
*/
|
|
7
15
|
export default class TextareaTitle extends Title {
|
|
8
16
|
getClassName () {
|
|
9
17
|
return classnames(super.getClassName(), 'textarea')
|
|
10
18
|
}
|
|
11
19
|
}
|
|
12
|
-
|
|
13
|
-
TextareaTitle.propTypes = {
|
|
14
|
-
...Title.propTypes
|
|
15
|
-
}
|
package/src/common/index.d.mts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
declare module '#cogs/common' {
|
|
2
|
-
export function DEFAULT_HANDLE_CHANGE (
|
|
2
|
+
export function DEFAULT_HANDLE_CHANGE (
|
|
3
|
+
name: string,
|
|
4
|
+
value?: string | string[],
|
|
5
|
+
checked?: boolean
|
|
6
|
+
): void
|
|
3
7
|
|
|
4
|
-
export function DEFAULT_HANDLE_CLICK (
|
|
8
|
+
export function DEFAULT_HANDLE_CLICK (
|
|
9
|
+
name: string,
|
|
10
|
+
value?: string | string[],
|
|
11
|
+
checked?: boolean
|
|
12
|
+
): void
|
|
5
13
|
}
|
|
6
14
|
|
|
7
15
|
declare module 'shinkansen-cogs/common' {
|
|
@@ -2,8 +2,10 @@ import React from 'react'
|
|
|
2
2
|
|
|
3
3
|
const DISABLED = String.fromCharCode(42)
|
|
4
4
|
|
|
5
|
-
export default ()
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export default function Disabled () {
|
|
6
|
+
return (
|
|
7
|
+
<span className='is-disabled'>
|
|
8
|
+
{DISABLED}
|
|
9
|
+
</span>
|
|
10
|
+
)
|
|
11
|
+
}
|
|
@@ -2,8 +2,10 @@ import React from 'react'
|
|
|
2
2
|
|
|
3
3
|
const READONLY = String.fromCharCode(42)
|
|
4
4
|
|
|
5
|
-
export default ()
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export default function ReadOnly () {
|
|
6
|
+
return (
|
|
7
|
+
<span className='is-readonly'>
|
|
8
|
+
{READONLY}
|
|
9
|
+
</span>
|
|
10
|
+
)
|
|
11
|
+
}
|