@instructure/ui-checkbox 8.16.1-snapshot.2 → 8.17.1-snapshot.14

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/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [8.17.0](https://github.com/instructure/instructure-ui/compare/v8.16.0...v8.17.0) (2022-02-07)
7
+
8
+ ### Bug Fixes
9
+
10
+ - remove type:"commonjs" from package.json files ([0b243be](https://github.com/instructure/instructure-ui/commit/0b243bee389ee14493e6b3dbb30a8b660c295d3d))
11
+
6
12
  # [8.16.0](https://github.com/instructure/instructure-ui/compare/v8.15.0...v8.16.0) (2022-02-03)
7
13
 
8
14
  **Note:** Version bump only for package @instructure/ui-checkbox
@@ -1,4 +1,4 @@
1
- var _dec, _dec2, _class, _class2, _temp;
1
+ var _dec, _dec2, _dec3, _class, _class2, _temp;
2
2
 
3
3
  /*
4
4
  * The MIT License (MIT)
@@ -30,9 +30,8 @@ import keycode from 'keycode';
30
30
  import { FormFieldMessages } from '@instructure/ui-form-field';
31
31
  import { createChainedFunction } from '@instructure/ui-utils';
32
32
  import { logError as error } from '@instructure/console';
33
- import { uid } from '@instructure/uid';
34
33
  import { isActiveElement } from '@instructure/ui-dom-utils';
35
- import { omitProps } from '@instructure/ui-react-utils';
34
+ import { omitProps, withDeterministicId } from '@instructure/ui-react-utils';
36
35
  import { View } from '@instructure/ui-view';
37
36
  import { testable } from '@instructure/ui-testable';
38
37
  import { withStyle, jsx } from '@instructure/emotion';
@@ -48,7 +47,7 @@ tags: toggle, switch
48
47
  ---
49
48
  @tsProps
50
49
  **/
51
- let Checkbox = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class Checkbox extends Component {
50
+ let Checkbox = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, null), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_temp = _class2 = class Checkbox extends Component {
52
51
  constructor(props) {
53
52
  super(props);
54
53
  this._defaultId = void 0;
@@ -118,7 +117,13 @@ let Checkbox = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec(
118
117
  hovered: false,
119
118
  checked: typeof props.checked === 'undefined' ? !!props.defaultChecked : void 0
120
119
  };
121
- this._defaultId = uid('Checkbox');
120
+
121
+ if (typeof props.checked === 'undefined') {
122
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'checked' does not exist on type 'Readonl... Remove this comment to see the full error message
123
+ this.state.checked = !!props.defaultChecked;
124
+ }
125
+
126
+ this._defaultId = props.deterministicId();
122
127
  }
123
128
 
124
129
  componentDidMount() {
@@ -256,6 +261,6 @@ let Checkbox = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec(
256
261
  indeterminate: false,
257
262
  readOnly: false,
258
263
  labelPlacement: 'end'
259
- }, _temp)) || _class) || _class);
264
+ }, _temp)) || _class) || _class) || _class);
260
265
  export default Checkbox;
261
266
  export { Checkbox, CheckboxFacade, ToggleFacade };
@@ -1,4 +1,4 @@
1
- var _dec, _class, _class2, _temp;
1
+ var _dec, _dec2, _class, _class2, _temp;
2
2
 
3
3
  /*
4
4
  * The MIT License (MIT)
@@ -25,8 +25,7 @@ var _dec, _class, _class2, _temp;
25
25
  */
26
26
  import React, { Children, Component } from 'react';
27
27
  import { FormFieldGroup } from '@instructure/ui-form-field';
28
- import { uid } from '@instructure/uid';
29
- import { matchComponentTypes, safeCloneElement, pickProps, omitProps } from '@instructure/ui-react-utils';
28
+ import { matchComponentTypes, safeCloneElement, pickProps, omitProps, withDeterministicId } from '@instructure/ui-react-utils';
30
29
  import { testable } from '@instructure/ui-testable';
31
30
  import { Checkbox } from '../Checkbox';
32
31
  import { propTypes, allowedProps } from './props';
@@ -37,7 +36,7 @@ category: components
37
36
  ---
38
37
  @tsProps
39
38
  **/
40
- let CheckboxGroup = (_dec = testable(), _dec(_class = (_temp = _class2 = class CheckboxGroup extends Component {
39
+ let CheckboxGroup = (_dec = withDeterministicId(), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class CheckboxGroup extends Component {
41
40
  constructor(props) {
42
41
  super(props);
43
42
  this._messagesId = void 0;
@@ -78,7 +77,7 @@ let CheckboxGroup = (_dec = testable(), _dec(_class = (_temp = _class2 = class C
78
77
  };
79
78
  }
80
79
 
81
- this._messagesId = uid('CheckboxGroup-messages');
80
+ this._messagesId = props.deterministicId();
82
81
  }
83
82
 
84
83
  get hasMessages() {
@@ -132,6 +131,6 @@ let CheckboxGroup = (_dec = testable(), _dec(_class = (_temp = _class2 = class C
132
131
  size: 'medium',
133
132
  layout: 'stacked',
134
133
  children: null
135
- }, _temp)) || _class);
134
+ }, _temp)) || _class) || _class);
136
135
  export default CheckboxGroup;
137
136
  export { CheckboxGroup };
@@ -32,12 +32,12 @@ var _createChainedFunction = require("@instructure/ui-utils/lib/createChainedFun
32
32
 
33
33
  var _console = require("@instructure/console");
34
34
 
35
- var _uid = require("@instructure/uid");
36
-
37
35
  var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
38
36
 
39
37
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
40
38
 
39
+ var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
40
+
41
41
  var _View = require("@instructure/ui-view/lib/View");
42
42
 
43
43
  var _testable = require("@instructure/ui-testable/lib/testable.js");
@@ -52,7 +52,7 @@ var _styles = _interopRequireDefault(require("./styles"));
52
52
 
53
53
  var _props = require("./props");
54
54
 
55
- var _dec, _dec2, _class, _class2, _temp;
55
+ var _dec, _dec2, _dec3, _class, _class2, _temp;
56
56
 
57
57
  /**
58
58
  ---
@@ -61,7 +61,7 @@ tags: toggle, switch
61
61
  ---
62
62
  @tsProps
63
63
  **/
64
- let Checkbox = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_temp = _class2 = class Checkbox extends _react.Component {
64
+ let Checkbox = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, null), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_temp = _class2 = class Checkbox extends _react.Component {
65
65
  constructor(props) {
66
66
  super(props);
67
67
  this._defaultId = void 0;
@@ -131,7 +131,13 @@ let Checkbox = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2 = (
131
131
  hovered: false,
132
132
  checked: typeof props.checked === 'undefined' ? !!props.defaultChecked : void 0
133
133
  };
134
- this._defaultId = (0, _uid.uid)('Checkbox');
134
+
135
+ if (typeof props.checked === 'undefined') {
136
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'checked' does not exist on type 'Readonl... Remove this comment to see the full error message
137
+ this.state.checked = !!props.defaultChecked;
138
+ }
139
+
140
+ this._defaultId = props.deterministicId();
135
141
  }
136
142
 
137
143
  componentDidMount() {
@@ -269,7 +275,7 @@ let Checkbox = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2 = (
269
275
  indeterminate: false,
270
276
  readOnly: false,
271
277
  labelPlacement: 'end'
272
- }, _temp)) || _class) || _class);
278
+ }, _temp)) || _class) || _class) || _class);
273
279
  exports.Checkbox = Checkbox;
274
280
  var _default = Checkbox;
275
281
  exports.default = _default;
@@ -11,8 +11,6 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _FormFieldGroup = require("@instructure/ui-form-field/lib/FormFieldGroup");
13
13
 
14
- var _uid = require("@instructure/uid");
15
-
16
14
  var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
17
15
 
18
16
  var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
@@ -21,13 +19,15 @@ var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
21
19
 
22
20
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
23
21
 
22
+ var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
23
+
24
24
  var _testable = require("@instructure/ui-testable/lib/testable.js");
25
25
 
26
26
  var _Checkbox = require("../Checkbox");
27
27
 
28
28
  var _props = require("./props");
29
29
 
30
- var _dec, _class, _class2, _temp;
30
+ var _dec, _dec2, _class, _class2, _temp;
31
31
 
32
32
  /**
33
33
  ---
@@ -35,7 +35,7 @@ category: components
35
35
  ---
36
36
  @tsProps
37
37
  **/
38
- let CheckboxGroup = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _class2 = class CheckboxGroup extends _react.Component {
38
+ let CheckboxGroup = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_temp = _class2 = class CheckboxGroup extends _react.Component {
39
39
  constructor(props) {
40
40
  super(props);
41
41
  this._messagesId = void 0;
@@ -76,7 +76,7 @@ let CheckboxGroup = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _c
76
76
  };
77
77
  }
78
78
 
79
- this._messagesId = (0, _uid.uid)('CheckboxGroup-messages');
79
+ this._messagesId = props.deterministicId();
80
80
  }
81
81
 
82
82
  get hasMessages() {
@@ -130,7 +130,7 @@ let CheckboxGroup = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _c
130
130
  size: 'medium',
131
131
  layout: 'stacked',
132
132
  children: null
133
- }, _temp)) || _class);
133
+ }, _temp)) || _class) || _class);
134
134
  exports.CheckboxGroup = CheckboxGroup;
135
135
  var _default = CheckboxGroup;
136
136
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-checkbox",
3
- "version": "8.16.1-snapshot.2+25359e770",
3
+ "version": "8.17.1-snapshot.14+f0b03679c",
4
4
  "description": " styled HTML input type='checkbox' component.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -24,28 +24,28 @@
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.13.10",
27
- "@instructure/console": "8.16.1-snapshot.2+25359e770",
28
- "@instructure/emotion": "8.16.1-snapshot.2+25359e770",
29
- "@instructure/shared-types": "8.16.1-snapshot.2+25359e770",
30
- "@instructure/ui-dom-utils": "8.16.1-snapshot.2+25359e770",
31
- "@instructure/ui-form-field": "8.16.1-snapshot.2+25359e770",
32
- "@instructure/ui-icons": "8.16.1-snapshot.2+25359e770",
33
- "@instructure/ui-prop-types": "8.16.1-snapshot.2+25359e770",
34
- "@instructure/ui-react-utils": "8.16.1-snapshot.2+25359e770",
35
- "@instructure/ui-svg-images": "8.16.1-snapshot.2+25359e770",
36
- "@instructure/ui-testable": "8.16.1-snapshot.2+25359e770",
37
- "@instructure/ui-utils": "8.16.1-snapshot.2+25359e770",
38
- "@instructure/ui-view": "8.16.1-snapshot.2+25359e770",
39
- "@instructure/uid": "8.16.1-snapshot.2+25359e770",
27
+ "@instructure/console": "8.17.1-snapshot.14+f0b03679c",
28
+ "@instructure/emotion": "8.17.1-snapshot.14+f0b03679c",
29
+ "@instructure/shared-types": "8.17.1-snapshot.14+f0b03679c",
30
+ "@instructure/ui-dom-utils": "8.17.1-snapshot.14+f0b03679c",
31
+ "@instructure/ui-form-field": "8.17.1-snapshot.14+f0b03679c",
32
+ "@instructure/ui-icons": "8.17.1-snapshot.14+f0b03679c",
33
+ "@instructure/ui-prop-types": "8.17.1-snapshot.14+f0b03679c",
34
+ "@instructure/ui-react-utils": "8.17.1-snapshot.14+f0b03679c",
35
+ "@instructure/ui-svg-images": "8.17.1-snapshot.14+f0b03679c",
36
+ "@instructure/ui-testable": "8.17.1-snapshot.14+f0b03679c",
37
+ "@instructure/ui-utils": "8.17.1-snapshot.14+f0b03679c",
38
+ "@instructure/ui-view": "8.17.1-snapshot.14+f0b03679c",
39
+ "@instructure/uid": "8.17.1-snapshot.14+f0b03679c",
40
40
  "keycode": "^2",
41
41
  "prop-types": "^15"
42
42
  },
43
43
  "devDependencies": {
44
- "@instructure/ui-babel-preset": "8.16.1-snapshot.2+25359e770",
45
- "@instructure/ui-color-utils": "8.16.1-snapshot.2+25359e770",
46
- "@instructure/ui-test-locator": "8.16.1-snapshot.2+25359e770",
47
- "@instructure/ui-test-utils": "8.16.1-snapshot.2+25359e770",
48
- "@instructure/ui-themes": "8.16.1-snapshot.2+25359e770"
44
+ "@instructure/ui-babel-preset": "8.17.1-snapshot.14+f0b03679c",
45
+ "@instructure/ui-color-utils": "8.17.1-snapshot.14+f0b03679c",
46
+ "@instructure/ui-test-locator": "8.17.1-snapshot.14+f0b03679c",
47
+ "@instructure/ui-test-utils": "8.17.1-snapshot.14+f0b03679c",
48
+ "@instructure/ui-themes": "8.17.1-snapshot.14+f0b03679c"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "react": ">=16.8 <=17"
@@ -54,5 +54,5 @@
54
54
  "access": "public"
55
55
  },
56
56
  "sideEffects": false,
57
- "gitHead": "25359e77043270cf26e92b14f396b498f1540c62"
57
+ "gitHead": "f0b03679c4c4d05d4d650d22646ac1dc6791e935"
58
58
  }
@@ -29,9 +29,8 @@ import keycode from 'keycode'
29
29
  import { FormFieldMessages } from '@instructure/ui-form-field'
30
30
  import { createChainedFunction } from '@instructure/ui-utils'
31
31
  import { logError as error } from '@instructure/console'
32
- import { uid } from '@instructure/uid'
33
32
  import { isActiveElement } from '@instructure/ui-dom-utils'
34
- import { omitProps } from '@instructure/ui-react-utils'
33
+ import { omitProps, withDeterministicId } from '@instructure/ui-react-utils'
35
34
  import { View } from '@instructure/ui-view'
36
35
  import { testable } from '@instructure/ui-testable'
37
36
 
@@ -58,6 +57,7 @@ tags: toggle, switch
58
57
  @tsProps
59
58
  **/
60
59
 
60
+ @withDeterministicId()
61
61
  @withStyle(generateStyle, null)
62
62
  @testable()
63
63
  class Checkbox extends Component<CheckboxProps, CheckboxState> {
@@ -87,7 +87,12 @@ class Checkbox extends Component<CheckboxProps, CheckboxState> {
87
87
  : undefined
88
88
  }
89
89
 
90
- this._defaultId = uid('Checkbox')
90
+ if (typeof props.checked === 'undefined') {
91
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'checked' does not exist on type 'Readonl... Remove this comment to see the full error message
92
+ this.state.checked = !!props.defaultChecked
93
+ }
94
+
95
+ this._defaultId = props.deterministicId!()
91
96
  }
92
97
  private readonly _defaultId: string
93
98
  private _input: HTMLInputElement | null = null
@@ -35,6 +35,7 @@ import type {
35
35
  ToggleFacadeTheme
36
36
  } from '@instructure/shared-types'
37
37
  import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
38
+ import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'
38
39
 
39
40
  type CheckboxOwnProps = {
40
41
  label: React.ReactNode
@@ -86,7 +87,7 @@ type AllowedPropKeys = Readonly<Array<PropKeys>>
86
87
 
87
88
  type CheckboxProps = CheckboxOwnProps &
88
89
  WithStyleProps<CheckboxFacadeTheme | ToggleFacadeTheme, CheckboxStyle> &
89
- OtherHTMLAttributes<CheckboxOwnProps>
90
+ OtherHTMLAttributes<CheckboxOwnProps> & WithDeterministicIdProps
90
91
 
91
92
  type CheckboxStyle = ComponentStyle<'checkbox' | 'input' | 'control'>
92
93
 
@@ -25,12 +25,12 @@
25
25
  import React, { Children, Component } from 'react'
26
26
 
27
27
  import { FormFieldGroup } from '@instructure/ui-form-field'
28
- import { uid } from '@instructure/uid'
29
28
  import {
30
29
  matchComponentTypes,
31
30
  safeCloneElement,
32
31
  pickProps,
33
- omitProps
32
+ omitProps,
33
+ withDeterministicId
34
34
  } from '@instructure/ui-react-utils'
35
35
  import { testable } from '@instructure/ui-testable'
36
36
 
@@ -49,6 +49,8 @@ category: components
49
49
  ---
50
50
  @tsProps
51
51
  **/
52
+
53
+ @withDeterministicId()
52
54
  @testable()
53
55
  class CheckboxGroup extends Component<CheckboxGroupProps, CheckboxGroupState> {
54
56
  static readonly componentId = 'CheckboxGroup'
@@ -72,7 +74,7 @@ class CheckboxGroup extends Component<CheckboxGroupProps, CheckboxGroupState> {
72
74
  }
73
75
  }
74
76
 
75
- this._messagesId = uid('CheckboxGroup-messages')
77
+ this._messagesId = props.deterministicId!()
76
78
  }
77
79
  private readonly _messagesId: string
78
80
  ref: Element | null = null
@@ -33,6 +33,7 @@ import {
33
33
 
34
34
  import type { FormMessage } from '@instructure/ui-form-field'
35
35
  import type { PropValidators } from '@instructure/shared-types'
36
+ import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'
36
37
 
37
38
  import { Checkbox } from '../Checkbox'
38
39
  import type { CheckboxProps } from '../Checkbox/props'
@@ -57,7 +58,7 @@ type PropKeys = keyof CheckboxGroupOwnProps
57
58
 
58
59
  type AllowedPropKeys = Readonly<Array<PropKeys>>
59
60
 
60
- type CheckboxGroupProps = CheckboxGroupOwnProps
61
+ type CheckboxGroupProps = CheckboxGroupOwnProps & WithDeterministicIdProps
61
62
 
62
63
  const propTypes: PropValidators<PropKeys> = {
63
64
  name: PropTypes.string.isRequired,