@modernpoacher/gremlins 0.0.242 → 0.0.243

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 (77) hide show
  1. package/babel.config.cjs +2 -46
  2. package/package.json +12 -29
  3. package/src/common/index.d.mts +9 -0
  4. package/src/components/common/disabled/index.cjs +1 -1
  5. package/src/components/common/disabled/index.d.mts +9 -0
  6. package/src/components/common/readonly/index.cjs +1 -1
  7. package/src/components/common/readonly/index.d.mts +9 -0
  8. package/src/components/common/required/index.cjs +1 -1
  9. package/src/components/common/required/index.d.mts +9 -0
  10. package/src/components/common/text-content/index.cjs +1 -1
  11. package/src/components/common/text-content/index.d.mts +14 -0
  12. package/src/components/common/text-content/index.jsx +1 -1
  13. package/src/components/field/index.cjs +1 -1
  14. package/src/components/field/index.d.mts +23 -0
  15. package/src/components/field/index.jsx +20 -13
  16. package/src/components/group/index.cjs +1 -1
  17. package/src/components/group/index.d.mts +16 -0
  18. package/src/components/group/index.jsx +2 -2
  19. package/src/gremlins/checkbox/field/index.cjs +1 -1
  20. package/src/gremlins/checkbox/field/index.d.mts +9 -0
  21. package/src/gremlins/checkbox/field/index.jsx +4 -8
  22. package/src/gremlins/checkbox/index.cjs +1 -1
  23. package/src/gremlins/checkbox/index.d.mts +9 -0
  24. package/src/gremlins/checkbox/index.jsx +20 -12
  25. package/src/gremlins/email/field/index.cjs +1 -1
  26. package/src/gremlins/email/field/index.d.mts +9 -0
  27. package/src/gremlins/email/field/index.jsx +1 -5
  28. package/src/gremlins/email/index.cjs +1 -1
  29. package/src/gremlins/email/index.d.mts +9 -0
  30. package/src/gremlins/email/index.jsx +6 -6
  31. package/src/gremlins/fieldset/group/index.cjs +1 -1
  32. package/src/gremlins/fieldset/group/index.d.mts +9 -0
  33. package/src/gremlins/fieldset/group/index.jsx +1 -5
  34. package/src/gremlins/fieldset/index.cjs +1 -1
  35. package/src/gremlins/fieldset/index.d.mts +9 -0
  36. package/src/gremlins/fieldset/index.jsx +2 -6
  37. package/src/gremlins/index.cjs +1 -1
  38. package/src/gremlins/index.d.mts +45 -0
  39. package/src/gremlins/index.jsx +7 -7
  40. package/src/gremlins/number/field/index.cjs +1 -1
  41. package/src/gremlins/number/field/index.d.mts +9 -0
  42. package/src/gremlins/number/field/index.jsx +1 -5
  43. package/src/gremlins/number/index.cjs +1 -1
  44. package/src/gremlins/number/index.d.mts +9 -0
  45. package/src/gremlins/number/index.jsx +6 -6
  46. package/src/gremlins/password/field/index.cjs +1 -1
  47. package/src/gremlins/password/field/index.d.mts +9 -0
  48. package/src/gremlins/password/field/index.jsx +1 -5
  49. package/src/gremlins/password/index.cjs +1 -1
  50. package/src/gremlins/password/index.d.mts +9 -0
  51. package/src/gremlins/password/index.jsx +6 -6
  52. package/src/gremlins/radio/field/index.cjs +1 -1
  53. package/src/gremlins/radio/field/index.d.mts +9 -0
  54. package/src/gremlins/radio/field/index.jsx +3 -19
  55. package/src/gremlins/radio/index.cjs +1 -1
  56. package/src/gremlins/radio/index.d.mts +9 -0
  57. package/src/gremlins/radio/index.jsx +14 -13
  58. package/src/gremlins/select/field/index.cjs +1 -1
  59. package/src/gremlins/select/field/index.d.mts +9 -0
  60. package/src/gremlins/select/field/index.jsx +9 -10
  61. package/src/gremlins/select/index.cjs +1 -1
  62. package/src/gremlins/select/index.d.mts +9 -0
  63. package/src/gremlins/select/index.jsx +8 -9
  64. package/src/gremlins/text/field/index.cjs +1 -1
  65. package/src/gremlins/text/field/index.d.mts +9 -0
  66. package/src/gremlins/text/field/index.jsx +1 -5
  67. package/src/gremlins/text/index.cjs +1 -1
  68. package/src/gremlins/text/index.d.mts +9 -0
  69. package/src/gremlins/text/index.jsx +6 -6
  70. package/src/gremlins/textarea/field/index.cjs +1 -1
  71. package/src/gremlins/textarea/field/index.d.mts +9 -0
  72. package/src/gremlins/textarea/field/index.jsx +1 -5
  73. package/src/gremlins/textarea/index.cjs +1 -1
  74. package/src/gremlins/textarea/index.d.mts +9 -0
  75. package/src/gremlins/textarea/index.jsx +6 -6
  76. package/src/index.cjs +1 -1
  77. package/src/index.d.mts +13 -208
@@ -0,0 +1,9 @@
1
+ declare module '#gremlins/gremlins/fieldset/group' {
2
+ import Group from '#gremlins/components/group'
3
+
4
+ export default class FieldsetGroup extends Group {}
5
+ }
6
+
7
+ declare module '@modernpoacher/gremlins/gremlins/fieldset/group' {
8
+ export { default } from '#gremlins/gremlins/fieldset/group'
9
+ }
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  import classnames from 'classnames'
6
- import Group from '@modernpoacher/gremlins/components/group'
6
+ import Group from '#gremlins/components/group'
7
7
 
8
8
  export default class FieldsetGroup extends Group {
9
9
  getClassName () {
@@ -14,7 +14,3 @@ export default class FieldsetGroup extends Group {
14
14
  FieldsetGroup.propTypes = {
15
15
  ...Group.propTypes
16
16
  }
17
-
18
- FieldsetGroup.defaultProps = {
19
- ...Group.defaultProps
20
- }
@@ -1,6 +1,6 @@
1
1
  require('@babel/register')({
2
2
  ignore: [
3
- /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/gremlins)/
3
+ /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/sprockets|@modernpoacher\/gremlins)/
4
4
  ]
5
5
  })
6
6
 
@@ -0,0 +1,9 @@
1
+ declare module '#gremlins/gremlins/fieldset' {
2
+ import { GroupGremlin as Gremlin } from '#gremlins/gremlins'
3
+
4
+ export default class FieldsetGremlin extends Gremlin {}
5
+ }
6
+
7
+ declare module '@modernpoacher/gremlins/gremlins/fieldset' {
8
+ export { default } from '#gremlins/gremlins/fieldset'
9
+ }
@@ -8,11 +8,11 @@ import React from 'react'
8
8
 
9
9
  import classnames from 'classnames'
10
10
 
11
- import { GroupGremlin as Gremlin } from '@modernpoacher/gremlins/gremlins'
11
+ import { GroupGremlin as Gremlin } from '#gremlins/gremlins'
12
12
 
13
13
  import {
14
14
  DEFAULT_HANDLE_CHANGE
15
- } from '@modernpoacher/gremlins/common'
15
+ } from '#gremlins/common'
16
16
 
17
17
  import Group from './group/index.jsx'
18
18
 
@@ -39,7 +39,3 @@ export default class FieldsetGremlin extends Gremlin {
39
39
  FieldsetGremlin.propTypes = {
40
40
  ...Gremlin.propTypes
41
41
  }
42
-
43
- FieldsetGremlin.defaultProps = {
44
- ...Gremlin.defaultProps
45
- }
@@ -1,6 +1,6 @@
1
1
  require('@babel/register')({
2
2
  ignore: [
3
- /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/gremlins|@modernpoacher\/sprockets)/
3
+ /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/sprockets|@modernpoacher\/gremlins)/
4
4
  ]
5
5
  })
6
6
 
@@ -0,0 +1,45 @@
1
+ declare module '#gremlins/gremlins' {
2
+ import React from 'react'
3
+
4
+ export interface FieldGremlinProps {
5
+ id: string
6
+ name: string
7
+ required: boolean
8
+ disabled: boolean
9
+ readOnly: boolean
10
+ placeholder: string
11
+ onChange: GremlinsTypes.OnChangeType
12
+ fieldRef: object
13
+ }
14
+
15
+ export interface ValueGremlinProps extends FieldGremlinProps {
16
+ value: string
17
+ defaultValue: string
18
+ onChange: GremlinsTypes.OnChangeType
19
+ }
20
+
21
+ export interface CheckGremlinProps extends FieldGremlinProps {
22
+ checked: boolean
23
+ defaultChecked: boolean
24
+ onClick: GremlinsTypes.OnClickType
25
+ }
26
+
27
+ export interface GroupGremlinProps {
28
+ title: string
29
+ onChange: GremlinsTypes.OnChangeType
30
+ groupRef: object
31
+ children: React.JSX.Element | React.JSX.Element[]
32
+ }
33
+
34
+ export class FieldGremlin extends React.Component<FieldGremlinProps> {}
35
+
36
+ export class ValueGremlin extends React.Component<ValueGremlinProps> {}
37
+
38
+ export class CheckGremlin extends React.Component<CheckGremlinProps> {}
39
+
40
+ export class GroupGremlin extends React.Component<GroupGremlinProps> {}
41
+ }
42
+
43
+ declare module '@modernpoacher/gremlins/gremlins' {
44
+ export * from '#gremlins/gremlins'
45
+ }
@@ -16,14 +16,14 @@ import classnames from 'classnames'
16
16
  import {
17
17
  DEFAULT_HANDLE_CHANGE,
18
18
  DEFAULT_HANDLE_CLICK
19
- } from '@modernpoacher/gremlins/common'
19
+ } from '#gremlins/common'
20
20
 
21
21
  import Field, {
22
22
  ValueField,
23
23
  CheckField
24
- } from '@modernpoacher/gremlins/components/field'
24
+ } from '#gremlins/components/field'
25
25
 
26
- import Group from '@modernpoacher/gremlins/components/group'
26
+ import Group from '#gremlins/components/group'
27
27
 
28
28
  export class FieldGremlin extends Component {
29
29
  getClassName () {
@@ -49,7 +49,7 @@ export class FieldGremlin extends Component {
49
49
  * @param {FieldGremlinProps} props
50
50
  * @returns {boolean}
51
51
  */
52
- shouldComponentUpdate (props) {
52
+ shouldComponentUpdate (props, state) {
53
53
  return (
54
54
  (props.name !== this.props.name) ||
55
55
  (props.id !== this.props.id) ||
@@ -126,7 +126,7 @@ FieldGremlin.defaultProps = {
126
126
  }
127
127
 
128
128
  export class ValueGremlin extends FieldGremlin {
129
- shouldComponentUpdate (props) {
129
+ shouldComponentUpdate (props, state) {
130
130
  return (
131
131
  super.shouldComponentUpdate(props) ||
132
132
  (props.value !== this.props.value)
@@ -176,7 +176,7 @@ ValueGremlin.defaultProps = {
176
176
  }
177
177
 
178
178
  export class CheckGremlin extends FieldGremlin {
179
- shouldComponentUpdate (props) {
179
+ shouldComponentUpdate (props, state) {
180
180
  return (
181
181
  super.shouldComponentUpdate(props) ||
182
182
  (props.checked !== this.props.checked) ||
@@ -239,7 +239,7 @@ export class GroupGremlin extends Component {
239
239
  * @param {GroupGremlinProps} props
240
240
  * @returns {boolean}
241
241
  */
242
- shouldComponentUpdate (props) {
242
+ shouldComponentUpdate (props, state) {
243
243
  return (
244
244
  (props.children !== this.props.children) ||
245
245
  (props.onChange !== this.props.onChange)
@@ -1,6 +1,6 @@
1
1
  require('@babel/register')({
2
2
  ignore: [
3
- /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/gremlins|@modernpoacher\/sprockets)/
3
+ /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/sprockets|@modernpoacher\/gremlins)/
4
4
  ]
5
5
  })
6
6
 
@@ -0,0 +1,9 @@
1
+ declare module '#gremlins/gremlins/number/field' {
2
+ import Field from '#gremlins/components/field'
3
+
4
+ export default class NumberField extends Field {}
5
+ }
6
+
7
+ declare module '@modernpoacher/gremlins/number/field' {
8
+ export { default } from '#gremlins/gremlins/number/field'
9
+ }
@@ -5,7 +5,7 @@ import React from 'react'
5
5
  import PropTypes from 'prop-types'
6
6
  import classnames from 'classnames'
7
7
 
8
- import { ValueField } from '@modernpoacher/gremlins/components/field'
8
+ import { ValueField } from '#gremlins/components/field'
9
9
 
10
10
  export default class NumberField extends ValueField {
11
11
  getClassName () {
@@ -61,7 +61,3 @@ NumberField.propTypes = {
61
61
  PropTypes.number
62
62
  ])
63
63
  }
64
-
65
- NumberField.defaultProps = {
66
- ...ValueField.defaultProps
67
- }
@@ -1,6 +1,6 @@
1
1
  require('@babel/register')({
2
2
  ignore: [
3
- /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/gremlins|@modernpoacher\/sprockets)/
3
+ /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/sprockets|@modernpoacher\/gremlins)/
4
4
  ]
5
5
  })
6
6
 
@@ -0,0 +1,9 @@
1
+ declare module '#gremlins/gremlins/number' {
2
+ import { FieldGremlin as Gremlin } from '#gremlins/gremlins'
3
+
4
+ export default class NumberGremlin extends Gremlin {}
5
+ }
6
+
7
+ declare module '@modernpoacher/gremlins/gremlins/number' {
8
+ export { default } from '#gremlins/gremlins/number'
9
+ }
@@ -5,7 +5,11 @@ import React from 'react'
5
5
  import PropTypes from 'prop-types'
6
6
  import classnames from 'classnames'
7
7
 
8
- import { ValueGremlin } from '@modernpoacher/gremlins/gremlins'
8
+ import { ValueGremlin } from '#gremlins/gremlins'
9
+
10
+ import {
11
+ DEFAULT_HANDLE_CHANGE
12
+ } from '#gremlins/common'
9
13
 
10
14
  import Field from './field/index.jsx'
11
15
 
@@ -16,7 +20,7 @@ export default class NumberGremlin extends ValueGremlin {
16
20
 
17
21
  handleChange = (value) => {
18
22
  const {
19
- onChange
23
+ onChange = DEFAULT_HANDLE_CHANGE
20
24
  } = this.props
21
25
 
22
26
  onChange(value)
@@ -68,7 +72,3 @@ NumberGremlin.propTypes = {
68
72
  PropTypes.number
69
73
  ])
70
74
  }
71
-
72
- NumberGremlin.defaultProps = {
73
- ...ValueGremlin.defaultProps
74
- }
@@ -1,6 +1,6 @@
1
1
  require('@babel/register')({
2
2
  ignore: [
3
- /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/gremlins|@modernpoacher\/sprockets)/
3
+ /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/sprockets|@modernpoacher\/gremlins)/
4
4
  ]
5
5
  })
6
6
 
@@ -0,0 +1,9 @@
1
+ declare module '#gremlins/gremlins/password/field' {
2
+ import Field from '#gremlins/components/field'
3
+
4
+ export default class PasswordField extends Field {}
5
+ }
6
+
7
+ declare module '@modernpoacher/gremlins/password/field' {
8
+ export { default } from '#gremlins/gremlins/password/field'
9
+ }
@@ -4,7 +4,7 @@
4
4
  import React from 'react'
5
5
  import classnames from 'classnames'
6
6
 
7
- import { ValueField } from '@modernpoacher/gremlins/components/field'
7
+ import { ValueField } from '#gremlins/components/field'
8
8
 
9
9
  export default class PasswordField extends ValueField {
10
10
  getClassName () {
@@ -52,7 +52,3 @@ export default class PasswordField extends ValueField {
52
52
  PasswordField.propTypes = {
53
53
  ...ValueField.propTypes
54
54
  }
55
-
56
- PasswordField.defaultProps = {
57
- ...ValueField.defaultProps
58
- }
@@ -1,6 +1,6 @@
1
1
  require('@babel/register')({
2
2
  ignore: [
3
- /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/gremlins|@modernpoacher\/sprockets)/
3
+ /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/sprockets|@modernpoacher\/gremlins)/
4
4
  ]
5
5
  })
6
6
 
@@ -0,0 +1,9 @@
1
+ declare module '#gremlins/gremlins/password' {
2
+ import { FieldGremlin as Gremlin } from '#gremlins/gremlins'
3
+
4
+ export default class PasswordGremlin extends Gremlin {}
5
+ }
6
+
7
+ declare module '@modernpoacher/gremlins/gremlins/password' {
8
+ export { default } from '#gremlins/gremlins/password'
9
+ }
@@ -4,7 +4,11 @@
4
4
  import React from 'react'
5
5
  import classnames from 'classnames'
6
6
 
7
- import { ValueGremlin } from '@modernpoacher/gremlins/gremlins'
7
+ import { ValueGremlin } from '#gremlins/gremlins'
8
+
9
+ import {
10
+ DEFAULT_HANDLE_CHANGE
11
+ } from '#gremlins/common'
8
12
 
9
13
  import Field from './field/index.jsx'
10
14
 
@@ -15,7 +19,7 @@ export default class PasswordGremlin extends ValueGremlin {
15
19
 
16
20
  handleChange = (value) => {
17
21
  const {
18
- onChange
22
+ onChange = DEFAULT_HANDLE_CHANGE
19
23
  } = this.props
20
24
 
21
25
  onChange(value)
@@ -59,7 +63,3 @@ export default class PasswordGremlin extends ValueGremlin {
59
63
  PasswordGremlin.propTypes = {
60
64
  ...ValueGremlin.propTypes
61
65
  }
62
-
63
- PasswordGremlin.defaultProps = {
64
- ...ValueGremlin.defaultProps
65
- }
@@ -1,6 +1,6 @@
1
1
  require('@babel/register')({
2
2
  ignore: [
3
- /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/gremlins|@modernpoacher\/sprockets)/
3
+ /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/sprockets|@modernpoacher\/gremlins)/
4
4
  ]
5
5
  })
6
6
 
@@ -0,0 +1,9 @@
1
+ declare module '#gremlins/gremlins/radio/field' {
2
+ import Field from '#gremlins/components/field'
3
+
4
+ export default class RadioField extends Field {}
5
+ }
6
+
7
+ declare module '@modernpoacher/gremlins/radio/field' {
8
+ export { default } from '#gremlins/gremlins/radio/field'
9
+ }
@@ -5,25 +5,13 @@ import React from 'react'
5
5
  import PropTypes from 'prop-types'
6
6
  import classnames from 'classnames'
7
7
 
8
- import { CheckField } from '@modernpoacher/gremlins/components/field'
8
+ import { CheckField } from '#gremlins/components/field'
9
9
 
10
10
  export default class RadioField extends CheckField {
11
11
  getClassName () {
12
12
  return classnames(super.getClassName(), 'radio')
13
13
  }
14
14
 
15
- handleClick = ({ target: { value } }) => {
16
- const { onClick } = this.props
17
-
18
- onClick(value)
19
- }
20
-
21
- handleChange = ({ target: { value } }) => {
22
- const { onChange } = this.props
23
-
24
- onChange(value)
25
- }
26
-
27
15
  render () {
28
16
  const {
29
17
  checked,
@@ -53,8 +41,8 @@ export default class RadioField extends CheckField {
53
41
  readOnly={readOnly}
54
42
  tabIndex={tabIndex}
55
43
  accessKey={accessKey}
56
- onClick={this.handleClick}
57
44
  onChange={this.handleChange}
45
+ onClick={this.handleClick}
58
46
  className={className}
59
47
  type='radio'
60
48
  ref={fieldRef}
@@ -82,8 +70,8 @@ export default class RadioField extends CheckField {
82
70
  readOnly={readOnly}
83
71
  tabIndex={tabIndex}
84
72
  accessKey={accessKey}
85
- onClick={this.handleClick}
86
73
  onChange={this.handleChange}
74
+ onClick={this.handleClick}
87
75
  className={className}
88
76
  type='radio'
89
77
  ref={fieldRef}
@@ -101,7 +89,3 @@ RadioField.propTypes = {
101
89
  id: PropTypes.string.isRequired,
102
90
  value: PropTypes.string.isRequired
103
91
  }
104
-
105
- RadioField.defaultProps = {
106
- ...CheckField.defaultProps
107
- }
@@ -1,6 +1,6 @@
1
1
  require('@babel/register')({
2
2
  ignore: [
3
- /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/gremlins|@modernpoacher\/sprockets)/
3
+ /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/sprockets|@modernpoacher\/gremlins)/
4
4
  ]
5
5
  })
6
6
 
@@ -0,0 +1,9 @@
1
+ declare module '#gremlins/gremlins/radio' {
2
+ import { FieldGremlin as Gremlin } from '#gremlins/gremlins'
3
+
4
+ export default class RadioGremlin extends Gremlin {}
5
+ }
6
+
7
+ declare module '@modernpoacher/gremlins/gremlins/radio' {
8
+ export { default } from '#gremlins/gremlins/radio'
9
+ }
@@ -5,7 +5,12 @@ import React from 'react'
5
5
  import PropTypes from 'prop-types'
6
6
  import classnames from 'classnames'
7
7
 
8
- import { CheckGremlin } from '@modernpoacher/gremlins/gremlins'
8
+ import { CheckGremlin } from '#gremlins/gremlins'
9
+
10
+ import {
11
+ DEFAULT_HANDLE_CHANGE,
12
+ DEFAULT_HANDLE_CLICK
13
+ } from '#gremlins/common'
9
14
 
10
15
  import Field from './field/index.jsx'
11
16
 
@@ -14,23 +19,23 @@ export default class Radio extends CheckGremlin {
14
19
  return classnames(super.getClassName(), 'radio')
15
20
  }
16
21
 
17
- handleClick = (value) => {
22
+ handleChange = (value, checked) => {
18
23
  const {
19
- onClick
24
+ onChange = DEFAULT_HANDLE_CHANGE
20
25
  } = this.props
21
26
 
22
- onClick(value)
27
+ onChange(value, checked)
23
28
  }
24
29
 
25
- handleChange = (value) => {
30
+ handleClick = (value, checked) => {
26
31
  const {
27
- onChange
32
+ onClick = DEFAULT_HANDLE_CLICK
28
33
  } = this.props
29
34
 
30
- onChange(value)
35
+ onClick(value, checked)
31
36
  }
32
37
 
33
- shouldComponentUpdate (props) {
38
+ shouldComponentUpdate (props, state) {
34
39
  return (
35
40
  super.shouldComponentUpdate(props) ||
36
41
  (props.value !== this.props.value)
@@ -67,8 +72,8 @@ export default class Radio extends CheckGremlin {
67
72
  tabIndex={tabIndex}
68
73
  accessKey={accessKey}
69
74
  placeholder={placeholder}
70
- onClick={this.handleClick}
71
75
  onChange={this.handleChange}
76
+ onClick={this.handleClick}
72
77
  fieldRef={fieldRef}
73
78
  />
74
79
  )
@@ -90,7 +95,3 @@ Radio.propTypes = {
90
95
  id: PropTypes.string.isRequired,
91
96
  value: PropTypes.string.isRequired
92
97
  }
93
-
94
- Radio.defaultProps = {
95
- ...CheckGremlin.defaultProps
96
- }
@@ -1,6 +1,6 @@
1
1
  require('@babel/register')({
2
2
  ignore: [
3
- /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/gremlins|@modernpoacher\/sprockets)/
3
+ /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/sprockets|@modernpoacher\/gremlins)/
4
4
  ]
5
5
  })
6
6
 
@@ -0,0 +1,9 @@
1
+ declare module '#gremlins/gremlins/select/field' {
2
+ import Field from '#gremlins/components/field'
3
+
4
+ export default class SelectField extends Field {}
5
+ }
6
+
7
+ declare module '@modernpoacher/gremlins/select/field' {
8
+ export { default } from '#gremlins/gremlins/select/field'
9
+ }
@@ -5,7 +5,11 @@ import React from 'react'
5
5
  import PropTypes from 'prop-types'
6
6
  import classnames from 'classnames'
7
7
 
8
- import { ValueField } from '@modernpoacher/gremlins/components/field'
8
+ import { ValueField } from '#gremlins/components/field'
9
+
10
+ import {
11
+ DEFAULT_HANDLE_CHANGE
12
+ } from '#gremlins/common'
9
13
 
10
14
  function getSelectedValues ({ target: { selectedOptions } }) {
11
15
  return (
@@ -19,7 +23,7 @@ function getSelectedValue ({ target: { value } }) {
19
23
  }
20
24
 
21
25
  export default class SelectField extends ValueField {
22
- shouldComponentUpdate (props) {
26
+ shouldComponentUpdate (props, state) {
23
27
  return (
24
28
  super.shouldComponentUpdate(props) ||
25
29
  (props.multiple !== this.props.multiple) ||
@@ -33,8 +37,8 @@ export default class SelectField extends ValueField {
33
37
 
34
38
  handleChange = (event) => {
35
39
  const {
36
- multiple,
37
- onChange
40
+ multiple = false,
41
+ onChange = DEFAULT_HANDLE_CHANGE
38
42
  } = this.props
39
43
 
40
44
  if (multiple) {
@@ -55,7 +59,7 @@ export default class SelectField extends ValueField {
55
59
  readOnly = false,
56
60
  tabIndex,
57
61
  accessKey,
58
- multiple,
62
+ multiple = false,
59
63
  children,
60
64
  fieldRef
61
65
  } = this.props
@@ -105,8 +109,3 @@ SelectField.propTypes = {
105
109
  )
106
110
  ])
107
111
  }
108
-
109
- SelectField.defaultProps = {
110
- ...ValueField.defaultProps,
111
- multiple: false
112
- }
@@ -1,6 +1,6 @@
1
1
  require('@babel/register')({
2
2
  ignore: [
3
- /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/gremlins|@modernpoacher\/sprockets)/
3
+ /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/sprockets|@modernpoacher\/gremlins)/
4
4
  ]
5
5
  })
6
6
 
@@ -0,0 +1,9 @@
1
+ declare module '#gremlins/gremlins/select' {
2
+ import { FieldGremlin as Gremlin } from '#gremlins/gremlins'
3
+
4
+ export default class SelectGremlin extends Gremlin {}
5
+ }
6
+
7
+ declare module '@modernpoacher/gremlins/gremlins/select' {
8
+ export { default } from '#gremlins/gremlins/select'
9
+ }
@@ -5,12 +5,16 @@ import React from 'react'
5
5
  import PropTypes from 'prop-types'
6
6
  import classnames from 'classnames'
7
7
 
8
- import { ValueGremlin } from '@modernpoacher/gremlins/gremlins'
8
+ import { ValueGremlin } from '#gremlins/gremlins'
9
+
10
+ import {
11
+ DEFAULT_HANDLE_CHANGE
12
+ } from '#gremlins/common'
9
13
 
10
14
  import Field from './field/index.jsx'
11
15
 
12
16
  export default class SelectGremlin extends ValueGremlin {
13
- shouldComponentUpdate (props) {
17
+ shouldComponentUpdate (props, state) {
14
18
  return (
15
19
  super.shouldComponentUpdate(props) ||
16
20
  (props.multiple !== this.props.multiple) ||
@@ -24,7 +28,7 @@ export default class SelectGremlin extends ValueGremlin {
24
28
 
25
29
  handleChange = (value) => {
26
30
  const {
27
- onChange
31
+ onChange = DEFAULT_HANDLE_CHANGE
28
32
  } = this.props
29
33
 
30
34
  onChange(value)
@@ -43,7 +47,7 @@ export default class SelectGremlin extends ValueGremlin {
43
47
  tabIndex,
44
48
  accessKey,
45
49
  placeholder,
46
- multiple,
50
+ multiple = false,
47
51
  fieldRef,
48
52
  children
49
53
  } = this.props
@@ -91,8 +95,3 @@ SelectGremlin.propTypes = {
91
95
  )
92
96
  ])
93
97
  }
94
-
95
- SelectGremlin.defaultProps = {
96
- ...ValueGremlin.defaultProps,
97
- multiple: false
98
- }
@@ -1,6 +1,6 @@
1
1
  require('@babel/register')({
2
2
  ignore: [
3
- /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/gremlins|@modernpoacher\/sprockets)/
3
+ /node_modules\/(?!@modernpoacher\/cogs|@modernpoacher\/sprockets|@modernpoacher\/gremlins)/
4
4
  ]
5
5
  })
6
6
 
@@ -0,0 +1,9 @@
1
+ declare module '#gremlins/gremlins/text/field' {
2
+ import Field from '#gremlins/components/field'
3
+
4
+ export default class TextField extends Field {}
5
+ }
6
+
7
+ declare module '@modernpoacher/gremlins/text/field' {
8
+ export { default } from '#gremlins/gremlins/text/field'
9
+ }