@instructure/ui-checkbox 11.6.0 → 11.6.1-snapshot-129

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 (158) hide show
  1. package/CHANGELOG.md +44 -297
  2. package/es/Checkbox/{CheckboxFacade → v1/CheckboxFacade}/index.js +1 -1
  3. package/es/Checkbox/{ToggleFacade → v1/ToggleFacade}/index.js +1 -1
  4. package/es/Checkbox/{index.js → v1/index.js} +3 -3
  5. package/es/Checkbox/v2/CheckboxFacade/index.js +104 -0
  6. package/es/Checkbox/v2/CheckboxFacade/props.js +26 -0
  7. package/es/Checkbox/v2/CheckboxFacade/styles.js +177 -0
  8. package/es/Checkbox/v2/ToggleFacade/index.js +116 -0
  9. package/es/Checkbox/v2/ToggleFacade/props.js +26 -0
  10. package/es/Checkbox/v2/ToggleFacade/styles.js +232 -0
  11. package/es/Checkbox/v2/index.js +289 -0
  12. package/es/Checkbox/v2/props.js +26 -0
  13. package/es/Checkbox/v2/styles.js +102 -0
  14. package/es/CheckboxGroup/{index.js → v1/index.js} +2 -2
  15. package/es/CheckboxGroup/v2/index.js +125 -0
  16. package/es/CheckboxGroup/v2/props.js +26 -0
  17. package/es/{index.js → exports/a.js} +2 -2
  18. package/es/exports/b.js +25 -0
  19. package/lib/Checkbox/{CheckboxFacade → v1/CheckboxFacade}/index.js +2 -2
  20. package/lib/Checkbox/{ToggleFacade → v1/ToggleFacade}/index.js +3 -3
  21. package/lib/Checkbox/{index.js → v1/index.js} +5 -5
  22. package/lib/Checkbox/v2/CheckboxFacade/index.js +109 -0
  23. package/lib/Checkbox/v2/CheckboxFacade/props.js +31 -0
  24. package/lib/Checkbox/v2/CheckboxFacade/styles.js +183 -0
  25. package/lib/Checkbox/v2/ToggleFacade/index.js +121 -0
  26. package/lib/Checkbox/v2/ToggleFacade/props.js +31 -0
  27. package/lib/Checkbox/v2/ToggleFacade/styles.js +238 -0
  28. package/lib/Checkbox/v2/index.js +308 -0
  29. package/lib/Checkbox/v2/props.js +31 -0
  30. package/lib/Checkbox/v2/styles.js +108 -0
  31. package/lib/CheckboxGroup/{index.js → v1/index.js} +5 -5
  32. package/lib/CheckboxGroup/v2/index.js +133 -0
  33. package/lib/CheckboxGroup/v2/props.js +31 -0
  34. package/lib/{index.js → exports/a.js} +6 -6
  35. package/lib/exports/b.js +31 -0
  36. package/package.json +45 -23
  37. package/src/Checkbox/{CheckboxFacade → v1/CheckboxFacade}/index.tsx +1 -1
  38. package/src/Checkbox/{CheckboxFacade → v1/CheckboxFacade}/styles.ts +3 -1
  39. package/src/Checkbox/{ToggleFacade → v1/ToggleFacade}/index.tsx +1 -1
  40. package/src/Checkbox/{index.tsx → v1/index.tsx} +3 -3
  41. package/src/Checkbox/{props.ts → v1/props.ts} +1 -1
  42. package/src/Checkbox/{styles.ts → v1/styles.ts} +1 -1
  43. package/src/Checkbox/{theme.ts → v1/theme.ts} +1 -1
  44. package/src/Checkbox/v2/CheckboxFacade/index.tsx +113 -0
  45. package/src/Checkbox/v2/CheckboxFacade/props.ts +67 -0
  46. package/src/Checkbox/v2/CheckboxFacade/styles.ts +209 -0
  47. package/src/Checkbox/v2/README.md +193 -0
  48. package/src/Checkbox/v2/ToggleFacade/index.tsx +124 -0
  49. package/src/Checkbox/v2/ToggleFacade/props.ts +67 -0
  50. package/src/Checkbox/v2/ToggleFacade/styles.ts +301 -0
  51. package/src/Checkbox/v2/index.tsx +376 -0
  52. package/src/Checkbox/v2/props.ts +132 -0
  53. package/src/Checkbox/v2/styles.ts +118 -0
  54. package/src/CheckboxGroup/{index.tsx → v1/index.tsx} +2 -2
  55. package/src/CheckboxGroup/{props.ts → v1/props.ts} +3 -3
  56. package/src/CheckboxGroup/v2/README.md +111 -0
  57. package/src/CheckboxGroup/v2/index.tsx +157 -0
  58. package/src/CheckboxGroup/v2/props.ts +77 -0
  59. package/src/{index.ts → exports/a.ts} +6 -6
  60. package/src/exports/b.ts +30 -0
  61. package/tsconfig.build.tsbuildinfo +1 -1
  62. package/types/Checkbox/v1/CheckboxFacade/index.d.ts.map +1 -0
  63. package/types/Checkbox/v1/CheckboxFacade/props.d.ts.map +1 -0
  64. package/types/Checkbox/v1/CheckboxFacade/styles.d.ts.map +1 -0
  65. package/types/Checkbox/v1/CheckboxFacade/theme.d.ts.map +1 -0
  66. package/types/Checkbox/v1/ToggleFacade/index.d.ts.map +1 -0
  67. package/types/Checkbox/v1/ToggleFacade/props.d.ts.map +1 -0
  68. package/types/Checkbox/v1/ToggleFacade/styles.d.ts.map +1 -0
  69. package/types/Checkbox/v1/ToggleFacade/theme.d.ts.map +1 -0
  70. package/types/Checkbox/{index.d.ts → v1/index.d.ts} +1 -1
  71. package/types/Checkbox/v1/index.d.ts.map +1 -0
  72. package/types/Checkbox/{props.d.ts → v1/props.d.ts} +1 -1
  73. package/types/Checkbox/v1/props.d.ts.map +1 -0
  74. package/types/Checkbox/v1/styles.d.ts.map +1 -0
  75. package/types/Checkbox/v1/theme.d.ts.map +1 -0
  76. package/types/Checkbox/v2/CheckboxFacade/index.d.ts +39 -0
  77. package/types/Checkbox/v2/CheckboxFacade/index.d.ts.map +1 -0
  78. package/types/Checkbox/v2/CheckboxFacade/props.d.ts +27 -0
  79. package/types/Checkbox/v2/CheckboxFacade/props.d.ts.map +1 -0
  80. package/types/Checkbox/v2/CheckboxFacade/styles.d.ts +16 -0
  81. package/types/Checkbox/v2/CheckboxFacade/styles.d.ts.map +1 -0
  82. package/types/Checkbox/v2/ToggleFacade/index.d.ts +40 -0
  83. package/types/Checkbox/v2/ToggleFacade/index.d.ts.map +1 -0
  84. package/types/Checkbox/v2/ToggleFacade/props.d.ts +25 -0
  85. package/types/Checkbox/v2/ToggleFacade/props.d.ts.map +1 -0
  86. package/types/Checkbox/v2/ToggleFacade/styles.d.ts +16 -0
  87. package/types/Checkbox/v2/ToggleFacade/styles.d.ts.map +1 -0
  88. package/types/Checkbox/v2/index.d.ts +71 -0
  89. package/types/Checkbox/v2/index.d.ts.map +1 -0
  90. package/types/Checkbox/v2/props.d.ts +64 -0
  91. package/types/Checkbox/v2/props.d.ts.map +1 -0
  92. package/types/Checkbox/v2/styles.d.ts +16 -0
  93. package/types/Checkbox/v2/styles.d.ts.map +1 -0
  94. package/types/CheckboxGroup/{index.d.ts → v1/index.d.ts} +1 -1
  95. package/types/CheckboxGroup/v1/index.d.ts.map +1 -0
  96. package/types/CheckboxGroup/{props.d.ts → v1/props.d.ts} +3 -3
  97. package/types/CheckboxGroup/v1/props.d.ts.map +1 -0
  98. package/types/CheckboxGroup/v2/index.d.ts +42 -0
  99. package/types/CheckboxGroup/v2/index.d.ts.map +1 -0
  100. package/types/CheckboxGroup/v2/props.d.ts +30 -0
  101. package/types/CheckboxGroup/v2/props.d.ts.map +1 -0
  102. package/types/exports/a.d.ts +7 -0
  103. package/types/exports/a.d.ts.map +1 -0
  104. package/types/exports/b.d.ts +7 -0
  105. package/types/exports/b.d.ts.map +1 -0
  106. package/types/Checkbox/CheckboxFacade/index.d.ts.map +0 -1
  107. package/types/Checkbox/CheckboxFacade/props.d.ts.map +0 -1
  108. package/types/Checkbox/CheckboxFacade/styles.d.ts.map +0 -1
  109. package/types/Checkbox/CheckboxFacade/theme.d.ts.map +0 -1
  110. package/types/Checkbox/ToggleFacade/index.d.ts.map +0 -1
  111. package/types/Checkbox/ToggleFacade/props.d.ts.map +0 -1
  112. package/types/Checkbox/ToggleFacade/styles.d.ts.map +0 -1
  113. package/types/Checkbox/ToggleFacade/theme.d.ts.map +0 -1
  114. package/types/Checkbox/index.d.ts.map +0 -1
  115. package/types/Checkbox/props.d.ts.map +0 -1
  116. package/types/Checkbox/styles.d.ts.map +0 -1
  117. package/types/Checkbox/theme.d.ts.map +0 -1
  118. package/types/CheckboxGroup/index.d.ts.map +0 -1
  119. package/types/CheckboxGroup/props.d.ts.map +0 -1
  120. package/types/index.d.ts +0 -7
  121. package/types/index.d.ts.map +0 -1
  122. /package/es/Checkbox/{CheckboxFacade → v1/CheckboxFacade}/props.js +0 -0
  123. /package/es/Checkbox/{CheckboxFacade → v1/CheckboxFacade}/styles.js +0 -0
  124. /package/es/Checkbox/{CheckboxFacade → v1/CheckboxFacade}/theme.js +0 -0
  125. /package/es/Checkbox/{ToggleFacade → v1/ToggleFacade}/props.js +0 -0
  126. /package/es/Checkbox/{ToggleFacade → v1/ToggleFacade}/styles.js +0 -0
  127. /package/es/Checkbox/{ToggleFacade → v1/ToggleFacade}/theme.js +0 -0
  128. /package/es/Checkbox/{props.js → v1/props.js} +0 -0
  129. /package/es/Checkbox/{styles.js → v1/styles.js} +0 -0
  130. /package/es/Checkbox/{theme.js → v1/theme.js} +0 -0
  131. /package/es/CheckboxGroup/{props.js → v1/props.js} +0 -0
  132. /package/lib/Checkbox/{CheckboxFacade → v1/CheckboxFacade}/props.js +0 -0
  133. /package/lib/Checkbox/{CheckboxFacade → v1/CheckboxFacade}/styles.js +0 -0
  134. /package/lib/Checkbox/{CheckboxFacade → v1/CheckboxFacade}/theme.js +0 -0
  135. /package/lib/Checkbox/{ToggleFacade → v1/ToggleFacade}/props.js +0 -0
  136. /package/lib/Checkbox/{ToggleFacade → v1/ToggleFacade}/styles.js +0 -0
  137. /package/lib/Checkbox/{ToggleFacade → v1/ToggleFacade}/theme.js +0 -0
  138. /package/lib/Checkbox/{props.js → v1/props.js} +0 -0
  139. /package/lib/Checkbox/{styles.js → v1/styles.js} +0 -0
  140. /package/lib/Checkbox/{theme.js → v1/theme.js} +0 -0
  141. /package/lib/CheckboxGroup/{props.js → v1/props.js} +0 -0
  142. /package/src/Checkbox/{CheckboxFacade → v1/CheckboxFacade}/props.ts +0 -0
  143. /package/src/Checkbox/{CheckboxFacade → v1/CheckboxFacade}/theme.ts +0 -0
  144. /package/src/Checkbox/{README.md → v1/README.md} +0 -0
  145. /package/src/Checkbox/{ToggleFacade → v1/ToggleFacade}/props.ts +0 -0
  146. /package/src/Checkbox/{ToggleFacade → v1/ToggleFacade}/styles.ts +0 -0
  147. /package/src/Checkbox/{ToggleFacade → v1/ToggleFacade}/theme.ts +0 -0
  148. /package/src/CheckboxGroup/{README.md → v1/README.md} +0 -0
  149. /package/types/Checkbox/{CheckboxFacade → v1/CheckboxFacade}/index.d.ts +0 -0
  150. /package/types/Checkbox/{CheckboxFacade → v1/CheckboxFacade}/props.d.ts +0 -0
  151. /package/types/Checkbox/{CheckboxFacade → v1/CheckboxFacade}/styles.d.ts +0 -0
  152. /package/types/Checkbox/{CheckboxFacade → v1/CheckboxFacade}/theme.d.ts +0 -0
  153. /package/types/Checkbox/{ToggleFacade → v1/ToggleFacade}/index.d.ts +0 -0
  154. /package/types/Checkbox/{ToggleFacade → v1/ToggleFacade}/props.d.ts +0 -0
  155. /package/types/Checkbox/{ToggleFacade → v1/ToggleFacade}/styles.d.ts +0 -0
  156. /package/types/Checkbox/{ToggleFacade → v1/ToggleFacade}/theme.d.ts +0 -0
  157. /package/types/Checkbox/{styles.d.ts → v1/styles.d.ts} +0 -0
  158. /package/types/Checkbox/{theme.d.ts → v1/theme.d.ts} +0 -0
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = exports.CheckboxGroup = void 0;
7
7
  var _react = require("react");
8
- var _FormFieldGroup = require("@instructure/ui-form-field/lib/FormFieldGroup");
8
+ var _v11_ = require("@instructure/ui-form-field/v11_6");
9
9
  var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
10
10
  var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
11
11
  var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
12
12
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
13
13
  var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
14
- var _Checkbox = require("../Checkbox");
14
+ var _v = require("../../Checkbox/v1");
15
15
  var _props = require("./props");
16
16
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
  var _dec, _class, _CheckboxGroup;
@@ -92,7 +92,7 @@ let CheckboxGroup = exports.CheckboxGroup = (_dec = (0, _withDeterministicId.wit
92
92
  disabled = _this$props.disabled,
93
93
  readOnly = _this$props.readOnly;
94
94
  return _react.Children.map(children, child => {
95
- if ((0, _matchComponentTypes.matchComponentTypes)(child, [_Checkbox.Checkbox])) {
95
+ if ((0, _matchComponentTypes.matchComponentTypes)(child, [_v.Checkbox])) {
96
96
  return (0, _safeCloneElement.safeCloneElement)(child, {
97
97
  key: `${child.props.name}`,
98
98
  name,
@@ -111,9 +111,9 @@ let CheckboxGroup = exports.CheckboxGroup = (_dec = (0, _withDeterministicId.wit
111
111
  });
112
112
  }
113
113
  render() {
114
- return (0, _jsxRuntime.jsx)(_FormFieldGroup.FormFieldGroup, {
114
+ return (0, _jsxRuntime.jsx)(_v11_.FormFieldGroup, {
115
115
  ...(0, _omitProps.omitProps)(this.props, CheckboxGroup.allowedProps),
116
- ...(0, _pickProps.pickProps)(this.props, _FormFieldGroup.FormFieldGroup.allowedProps),
116
+ ...(0, _pickProps.pickProps)(this.props, _v11_.FormFieldGroup.allowedProps),
117
117
  description: this.props.description,
118
118
  rowSpacing: "small",
119
119
  vAlign: "top",
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.CheckboxGroup = void 0;
7
+ var _react = require("react");
8
+ var _latest = require("@instructure/ui-form-field/latest");
9
+ var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
10
+ var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
11
+ var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
12
+ var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
13
+ var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
14
+ var _v = require("../../Checkbox/v2");
15
+ var _props = require("./props");
16
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
+ var _dec, _class, _CheckboxGroup;
18
+ /*
19
+ * The MIT License (MIT)
20
+ *
21
+ * Copyright (c) 2015 - present Instructure, Inc.
22
+ *
23
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
24
+ * of this software and associated documentation files (the "Software"), to deal
25
+ * in the Software without restriction, including without limitation the rights
26
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
27
+ * copies of the Software, and to permit persons to whom the Software is
28
+ * furnished to do so, subject to the following conditions:
29
+ *
30
+ * The above copyright notice and this permission notice shall be included in all
31
+ * copies or substantial portions of the Software.
32
+ *
33
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
36
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
38
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39
+ * SOFTWARE.
40
+ */
41
+ /**
42
+ ---
43
+ category: components
44
+ ---
45
+ **/
46
+ let CheckboxGroup = exports.CheckboxGroup = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec(_class = (_CheckboxGroup = class CheckboxGroup extends _react.Component {
47
+ constructor(props) {
48
+ super(props);
49
+ this._messagesId = void 0;
50
+ this.ref = null;
51
+ this.handleRef = el => {
52
+ this.ref = el;
53
+ };
54
+ this.handleChange = e => {
55
+ const newValue = this.value;
56
+ if (this.props.disabled || this.props.readOnly) {
57
+ e.preventDefault();
58
+ return;
59
+ }
60
+ if (e.target.checked) {
61
+ newValue.push(e.target.value);
62
+ } else {
63
+ newValue.splice(newValue.indexOf(e.target.value), 1);
64
+ }
65
+ if (typeof this.props.value === 'undefined') {
66
+ this.setState({
67
+ value: newValue
68
+ });
69
+ }
70
+ if (typeof this.props.onChange === 'function') {
71
+ this.props.onChange(newValue);
72
+ }
73
+ };
74
+ if (typeof props.value === 'undefined') {
75
+ this.state = {
76
+ value: props.defaultValue || []
77
+ };
78
+ }
79
+ this._messagesId = props.deterministicId();
80
+ }
81
+ get hasMessages() {
82
+ return this.props.messages && this.props.messages.length > 0;
83
+ }
84
+ get value() {
85
+ return typeof this.props.value === 'undefined' ? [...this.state.value] : [...this.props.value];
86
+ }
87
+ renderChildren() {
88
+ const _this$props = this.props,
89
+ children = _this$props.children,
90
+ name = _this$props.name,
91
+ size = _this$props.size,
92
+ disabled = _this$props.disabled,
93
+ readOnly = _this$props.readOnly;
94
+ return _react.Children.map(children, child => {
95
+ if ((0, _matchComponentTypes.matchComponentTypes)(child, [_v.Checkbox])) {
96
+ return (0, _safeCloneElement.safeCloneElement)(child, {
97
+ key: `${child.props.name}`,
98
+ name,
99
+ label: child.props.label,
100
+ disabled: disabled || child.props.disabled,
101
+ readOnly: readOnly || child.props.readOnly,
102
+ size,
103
+ checked: this.value.indexOf(child.props.value) > -1,
104
+ onChange: this.handleChange,
105
+ width: child.props.width || 'auto',
106
+ 'aria-describedby': this.hasMessages ? this._messagesId : void 0
107
+ });
108
+ } else {
109
+ return child;
110
+ }
111
+ });
112
+ }
113
+ render() {
114
+ return (0, _jsxRuntime.jsx)(_latest.FormFieldGroup, {
115
+ ...(0, _omitProps.omitProps)(this.props, CheckboxGroup.allowedProps),
116
+ ...(0, _pickProps.pickProps)(this.props, _latest.FormFieldGroup.allowedProps),
117
+ description: this.props.description,
118
+ rowSpacing: "small",
119
+ vAlign: "top",
120
+ messagesId: this._messagesId,
121
+ elementRef: this.handleRef,
122
+ "data-cid": "CheckboxGroup",
123
+ children: this.renderChildren()
124
+ });
125
+ }
126
+ }, _CheckboxGroup.displayName = "CheckboxGroup", _CheckboxGroup.componentId = 'CheckboxGroup', _CheckboxGroup.allowedProps = _props.allowedProps, _CheckboxGroup.defaultProps = {
127
+ disabled: false,
128
+ readOnly: false,
129
+ size: 'medium',
130
+ layout: 'stacked',
131
+ children: null
132
+ }, _CheckboxGroup)) || _class);
133
+ var _default = exports.default = CheckboxGroup;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.allowedProps = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ const allowedProps = exports.allowedProps = ['name', 'description', 'defaultValue', 'value', 'onChange', 'disabled', 'readOnly', 'messages', 'children', 'size', 'layout'];
@@ -6,26 +6,26 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "Checkbox", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _Checkbox.Checkbox;
9
+ return _v.Checkbox;
10
10
  }
11
11
  });
12
12
  Object.defineProperty(exports, "CheckboxFacade", {
13
13
  enumerable: true,
14
14
  get: function () {
15
- return _Checkbox.CheckboxFacade;
15
+ return _v.CheckboxFacade;
16
16
  }
17
17
  });
18
18
  Object.defineProperty(exports, "CheckboxGroup", {
19
19
  enumerable: true,
20
20
  get: function () {
21
- return _CheckboxGroup.CheckboxGroup;
21
+ return _v2.CheckboxGroup;
22
22
  }
23
23
  });
24
24
  Object.defineProperty(exports, "ToggleFacade", {
25
25
  enumerable: true,
26
26
  get: function () {
27
- return _Checkbox.ToggleFacade;
27
+ return _v.ToggleFacade;
28
28
  }
29
29
  });
30
- var _Checkbox = require("./Checkbox");
31
- var _CheckboxGroup = require("./CheckboxGroup");
30
+ var _v = require("../Checkbox/v1");
31
+ var _v2 = require("../CheckboxGroup/v1");
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Checkbox", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _v.Checkbox;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "CheckboxFacade", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _v.CheckboxFacade;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "CheckboxGroup", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _v2.CheckboxGroup;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "ToggleFacade", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _v.ToggleFacade;
28
+ }
29
+ });
30
+ var _v = require("../Checkbox/v2");
31
+ var _v2 = require("../CheckboxGroup/v2");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-checkbox",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-snapshot-129",
4
4
  "description": " styled HTML input type='checkbox' component.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -16,27 +16,27 @@
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.27.6",
18
18
  "keycode": "^2",
19
- "@instructure/console": "11.6.0",
20
- "@instructure/emotion": "11.6.0",
21
- "@instructure/shared-types": "11.6.0",
22
- "@instructure/ui-dom-utils": "11.6.0",
23
- "@instructure/ui-form-field": "11.6.0",
24
- "@instructure/ui-react-utils": "11.6.0",
25
- "@instructure/ui-svg-images": "11.6.0",
26
- "@instructure/ui-utils": "11.6.0",
27
- "@instructure/ui-view": "11.6.0",
28
- "@instructure/uid": "11.6.0",
29
- "@instructure/ui-icons": "11.6.0"
19
+ "@instructure/console": "11.6.1-snapshot-129",
20
+ "@instructure/shared-types": "11.6.1-snapshot-129",
21
+ "@instructure/emotion": "11.6.1-snapshot-129",
22
+ "@instructure/ui-dom-utils": "11.6.1-snapshot-129",
23
+ "@instructure/ui-form-field": "11.6.1-snapshot-129",
24
+ "@instructure/ui-icons": "11.6.1-snapshot-129",
25
+ "@instructure/ui-react-utils": "11.6.1-snapshot-129",
26
+ "@instructure/ui-svg-images": "11.6.1-snapshot-129",
27
+ "@instructure/ui-view": "11.6.1-snapshot-129",
28
+ "@instructure/uid": "11.6.1-snapshot-129",
29
+ "@instructure/ui-utils": "11.6.1-snapshot-129"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@testing-library/jest-dom": "^6.6.3",
33
33
  "@testing-library/react": "15.0.7",
34
34
  "@testing-library/user-event": "^14.6.1",
35
35
  "vitest": "^3.2.2",
36
- "@instructure/ui-babel-preset": "11.6.0",
37
- "@instructure/ui-color-utils": "11.6.0",
38
- "@instructure/ui-axe-check": "11.6.0",
39
- "@instructure/ui-themes": "11.6.0"
36
+ "@instructure/ui-babel-preset": "11.6.1-snapshot-129",
37
+ "@instructure/ui-axe-check": "11.6.1-snapshot-129",
38
+ "@instructure/ui-color-utils": "11.6.1-snapshot-129",
39
+ "@instructure/ui-themes": "11.6.1-snapshot-129"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": ">=18 <=19"
@@ -46,17 +46,39 @@
46
46
  },
47
47
  "sideEffects": false,
48
48
  "exports": {
49
- ".": {
50
- "types": "./types/index.d.ts",
51
- "import": "./es/index.js",
52
- "require": "./lib/index.js",
53
- "default": "./es/index.js"
54
- },
55
49
  "./lib/*": "./lib/*",
56
50
  "./es/*": "./es/*",
57
51
  "./types/*": "./types/*",
58
52
  "./package.json": "./package.json",
59
- "./src/*": "./src/*"
53
+ "./src/*": "./src/*",
54
+ ".": {
55
+ "src": "./src/exports/a.ts",
56
+ "types": "./types/exports/a.d.ts",
57
+ "import": "./es/exports/a.js",
58
+ "require": "./lib/exports/a.js",
59
+ "default": "./es/exports/a.js"
60
+ },
61
+ "./v11_6": {
62
+ "src": "./src/exports/a.ts",
63
+ "types": "./types/exports/a.d.ts",
64
+ "import": "./es/exports/a.js",
65
+ "require": "./lib/exports/a.js",
66
+ "default": "./es/exports/a.js"
67
+ },
68
+ "./v11_7": {
69
+ "src": "./src/exports/b.ts",
70
+ "types": "./types/exports/b.d.ts",
71
+ "import": "./es/exports/b.js",
72
+ "require": "./lib/exports/b.js",
73
+ "default": "./es/exports/b.js"
74
+ },
75
+ "./latest": {
76
+ "src": "./src/exports/b.ts",
77
+ "types": "./types/exports/b.d.ts",
78
+ "import": "./es/exports/b.js",
79
+ "require": "./lib/exports/b.js",
80
+ "default": "./es/exports/b.js"
81
+ }
60
82
  },
61
83
  "scripts": {
62
84
  "lint": "ui-scripts lint",
@@ -27,7 +27,7 @@ import { Component } from 'react'
27
27
  import { SVGIcon } from '@instructure/ui-svg-images'
28
28
  import { IconCheckMarkSolid } from '@instructure/ui-icons'
29
29
 
30
- import { withStyle } from '@instructure/emotion'
30
+ import { withStyleLegacy as withStyle } from '@instructure/emotion'
31
31
 
32
32
  import generateStyle from './styles'
33
33
  import generateComponentTheme from './theme'
@@ -87,7 +87,9 @@ const generateStyle = (
87
87
  boxSizing: 'border-box',
88
88
  flexShrink: 0,
89
89
  transition: 'all 0.2s',
90
- border: `${componentTheme.borderWidth} solid ${invalid ? componentTheme.errorBorderColor : componentTheme.borderColor}`,
90
+ border: `${componentTheme.borderWidth} solid ${
91
+ invalid ? componentTheme.errorBorderColor : componentTheme.borderColor
92
+ }`,
91
93
  borderRadius: componentTheme.borderRadius,
92
94
  marginInlineEnd: componentTheme.marginRight,
93
95
  marginInlineStart: '0',
@@ -26,7 +26,7 @@ import { Component } from 'react'
26
26
 
27
27
  import { IconCheckSolid, IconXSolid } from '@instructure/ui-icons'
28
28
 
29
- import { withStyle } from '@instructure/emotion'
29
+ import { withStyleLegacy as withStyle } from '@instructure/emotion'
30
30
 
31
31
  import generateStyle from './styles'
32
32
  import generateComponentTheme from './theme'
@@ -25,14 +25,14 @@
25
25
  import { Component } from 'react'
26
26
  import keycode from 'keycode'
27
27
 
28
- import { FormFieldMessages } from '@instructure/ui-form-field'
28
+ import { FormFieldMessages } from '@instructure/ui-form-field/v11_6'
29
29
  import { createChainedFunction } from '@instructure/ui-utils'
30
30
  import { logError as error } from '@instructure/console'
31
31
  import { isActiveElement } from '@instructure/ui-dom-utils'
32
32
  import { omitProps, withDeterministicId } from '@instructure/ui-react-utils'
33
- import { View } from '@instructure/ui-view'
33
+ import { View } from '@instructure/ui-view/v11_6'
34
34
 
35
- import { withStyle } from '@instructure/emotion'
35
+ import { withStyleLegacy as withStyle } from '@instructure/emotion'
36
36
 
37
37
  import { CheckboxFacade } from './CheckboxFacade'
38
38
  import { ToggleFacade } from './ToggleFacade'
@@ -22,7 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import type { FormMessage } from '@instructure/ui-form-field'
25
+ import type { FormMessage } from '@instructure/ui-form-field/v11_6'
26
26
  import type {
27
27
  CheckboxFacadeTheme,
28
28
  OtherHTMLAttributes,
@@ -49,7 +49,7 @@ const generateStyle = (
49
49
  paddingLeft: componentTheme.checkErrorInsetWidth
50
50
  },
51
51
  indentedToggleError: {
52
- paddingLeft: componentTheme.toggleErrorInsetWidth,
52
+ paddingLeft: componentTheme.toggleErrorInsetWidth
53
53
  },
54
54
  checkbox: {
55
55
  label: 'checkbox',
@@ -35,7 +35,7 @@ const generateComponentTheme = (theme: Theme): any => {
35
35
  const componentVariables: any = {
36
36
  requiredInvalidColor: colors?.contrasts?.red5782,
37
37
  toggleErrorInsetWidth: `calc(${forms?.inputHeightSmall}*1.5 + ${spacing?.small})`,
38
- checkErrorInsetWidth: `calc(1.25em + ${spacing?.xSmall})`,
38
+ checkErrorInsetWidth: `calc(1.25em + ${spacing?.xSmall})`
39
39
  }
40
40
 
41
41
  return {
@@ -0,0 +1,113 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import { Component } from 'react'
26
+
27
+ import {
28
+ CheckInstUIIcon,
29
+ MinusInstUIIcon,
30
+ renderIconWithProps
31
+ } from '@instructure/ui-icons'
32
+
33
+ import { withStyle } from '@instructure/emotion'
34
+
35
+ import generateStyle from './styles'
36
+
37
+ import { allowedProps } from './props'
38
+ import type { CheckboxFacadeProps } from './props'
39
+
40
+ /**
41
+ ---
42
+ parent: Checkbox
43
+ ---
44
+ **/
45
+ @withStyle(generateStyle, 'Checkbox')
46
+ class CheckboxFacade extends Component<CheckboxFacadeProps> {
47
+ static readonly componentId = 'CheckboxFacade'
48
+
49
+ static allowedProps = allowedProps
50
+ static defaultProps = {
51
+ checked: false,
52
+ disabled: false,
53
+ readOnly: false,
54
+ focused: false,
55
+ hovered: false,
56
+ size: 'medium',
57
+ indeterminate: false
58
+ }
59
+
60
+ ref: Element | null = null
61
+
62
+ handleRef = (el: Element | null) => {
63
+ this.ref = el
64
+ }
65
+
66
+ componentDidMount() {
67
+ this.props.makeStyles?.()
68
+ }
69
+
70
+ componentDidUpdate() {
71
+ this.props.makeStyles?.()
72
+ }
73
+
74
+ renderIcon() {
75
+ const { disabled, readOnly, indeterminate, checked } = this.props
76
+
77
+ const getIconColor = () => {
78
+ if (disabled) {
79
+ return 'disabledBaseColor'
80
+ }
81
+ if (readOnly) {
82
+ return 'baseColor'
83
+ }
84
+ return 'inverseColor'
85
+ }
86
+
87
+ const iconColor = getIconColor()
88
+
89
+ if (indeterminate) {
90
+ return renderIconWithProps(MinusInstUIIcon, 'sm', iconColor)
91
+ } else if (checked) {
92
+ return renderIconWithProps(CheckInstUIIcon, 'sm', iconColor)
93
+ } else {
94
+ return null
95
+ }
96
+ }
97
+
98
+ render() {
99
+ const { children, styles } = this.props
100
+
101
+ return (
102
+ <span css={styles?.checkboxFacade} ref={this.handleRef}>
103
+ <span css={styles?.facade} aria-hidden="true">
104
+ {this.renderIcon()}
105
+ </span>
106
+ <span css={styles?.label}>{children}</span>
107
+ </span>
108
+ )
109
+ }
110
+ }
111
+
112
+ export default CheckboxFacade
113
+ export { CheckboxFacade }
@@ -0,0 +1,67 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import type { CheckboxFacadeTheme } from '@instructure/shared-types'
26
+ import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
27
+
28
+ type CheckboxFacadeOwnProps = {
29
+ children: React.ReactNode
30
+ checked?: boolean
31
+ disabled?: boolean
32
+ readOnly?: boolean
33
+ focused?: boolean
34
+ hovered?: boolean
35
+ size?: 'small' | 'medium' | 'large'
36
+ /**
37
+ * Visual state showing that child checkboxes are a combination of checked and unchecked
38
+ */
39
+ indeterminate?: boolean
40
+ /**
41
+ * Indicate if the parent component (`Checkbox`) is invalid to set the style accordingly.
42
+ */
43
+ invalid?: boolean
44
+ }
45
+
46
+ type PropKeys = keyof CheckboxFacadeOwnProps
47
+
48
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
49
+
50
+ type CheckboxFacadeProps = CheckboxFacadeOwnProps &
51
+ WithStyleProps<CheckboxFacadeTheme, CheckboxFacadeStyle>
52
+
53
+ type CheckboxFacadeStyle = ComponentStyle<'checkboxFacade' | 'facade' | 'label'>
54
+ const allowedProps: AllowedPropKeys = [
55
+ 'children',
56
+ 'checked',
57
+ 'disabled',
58
+ 'readOnly',
59
+ 'focused',
60
+ 'hovered',
61
+ 'size',
62
+ 'indeterminate',
63
+ 'invalid'
64
+ ]
65
+
66
+ export type { CheckboxFacadeProps, CheckboxFacadeStyle }
67
+ export { allowedProps }