@instructure/ui-form-field 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 (248) hide show
  1. package/CHANGELOG.md +46 -300
  2. package/es/FormField/{index.js → v1/index.js} +1 -1
  3. package/es/FormField/v2/index.js +78 -0
  4. package/es/FormField/v2/props.js +26 -0
  5. package/es/FormFieldGroup/{index.js → v1/index.js} +5 -4
  6. package/es/FormFieldGroup/v2/index.js +130 -0
  7. package/es/FormFieldGroup/v2/props.js +26 -0
  8. package/es/FormFieldGroup/v2/styles.js +49 -0
  9. package/es/FormFieldLabel/{index.js → v1/index.js} +1 -1
  10. package/es/FormFieldLabel/v2/index.js +83 -0
  11. package/es/FormFieldLabel/v2/props.js +26 -0
  12. package/es/FormFieldLabel/v2/styles.js +62 -0
  13. package/es/FormFieldLabel/v2/theme.js +52 -0
  14. package/es/FormFieldLayout/{index.js → v1/index.js} +2 -2
  15. package/es/FormFieldLayout/{styles.js → v1/styles.js} +2 -2
  16. package/es/FormFieldLayout/v2/index.js +207 -0
  17. package/es/FormFieldLayout/v2/props.js +26 -0
  18. package/es/FormFieldLayout/v2/styles.js +171 -0
  19. package/es/FormFieldMessage/{index.js → v1/index.js} +1 -1
  20. package/es/FormFieldMessage/v2/index.js +96 -0
  21. package/es/FormFieldMessage/v2/props.js +26 -0
  22. package/es/FormFieldMessage/v2/styles.js +69 -0
  23. package/es/FormFieldMessages/{index.js → v1/index.js} +2 -2
  24. package/es/FormFieldMessages/v2/index.js +88 -0
  25. package/es/FormFieldMessages/v2/props.js +26 -0
  26. package/es/FormFieldMessages/v2/styles.js +50 -0
  27. package/es/{index.js → exports/a.js} +6 -6
  28. package/es/exports/b.js +29 -0
  29. package/lib/FormField/{index.js → v1/index.js} +3 -3
  30. package/lib/FormField/v2/index.js +85 -0
  31. package/lib/FormField/v2/props.js +31 -0
  32. package/lib/FormFieldGroup/{index.js → v1/index.js} +11 -10
  33. package/lib/FormFieldGroup/v2/index.js +136 -0
  34. package/lib/FormFieldGroup/v2/props.js +31 -0
  35. package/lib/FormFieldGroup/v2/styles.js +55 -0
  36. package/lib/FormFieldLabel/{index.js → v1/index.js} +1 -1
  37. package/lib/FormFieldLabel/v2/index.js +89 -0
  38. package/lib/FormFieldLabel/v2/props.js +31 -0
  39. package/lib/FormFieldLabel/v2/styles.js +68 -0
  40. package/lib/FormFieldLabel/v2/theme.js +58 -0
  41. package/lib/FormFieldLayout/{index.js → v1/index.js} +3 -3
  42. package/lib/FormFieldLayout/{styles.js → v1/styles.js} +1 -1
  43. package/lib/FormFieldLayout/v2/index.js +220 -0
  44. package/lib/FormFieldLayout/v2/props.js +31 -0
  45. package/lib/FormFieldLayout/v2/styles.js +177 -0
  46. package/lib/FormFieldMessage/{index.js → v1/index.js} +2 -2
  47. package/lib/FormFieldMessage/v2/index.js +101 -0
  48. package/lib/FormFieldMessage/v2/props.js +31 -0
  49. package/lib/FormFieldMessage/v2/styles.js +75 -0
  50. package/lib/FormFieldMessages/{index.js → v1/index.js} +3 -3
  51. package/lib/FormFieldMessages/v2/index.js +93 -0
  52. package/lib/FormFieldMessages/v2/props.js +31 -0
  53. package/lib/FormFieldMessages/v2/styles.js +56 -0
  54. package/lib/{index.js → exports/a.js} +12 -12
  55. package/lib/exports/b.js +47 -0
  56. package/package.json +43 -21
  57. package/src/FormField/{index.tsx → v1/index.tsx} +1 -1
  58. package/src/FormField/{props.ts → v1/props.ts} +1 -1
  59. package/src/FormField/v2/README.md +43 -0
  60. package/src/FormField/v2/index.tsx +87 -0
  61. package/src/FormField/v2/props.ts +104 -0
  62. package/src/FormFieldGroup/{index.tsx → v1/index.tsx} +6 -4
  63. package/src/FormFieldGroup/{props.ts → v1/props.ts} +2 -2
  64. package/src/FormFieldGroup/v2/README.md +114 -0
  65. package/src/FormFieldGroup/v2/index.tsx +182 -0
  66. package/src/FormFieldGroup/v2/props.ts +103 -0
  67. package/src/FormFieldGroup/v2/styles.ts +58 -0
  68. package/src/FormFieldLabel/{index.tsx → v1/index.tsx} +1 -1
  69. package/src/FormFieldLabel/v2/index.tsx +95 -0
  70. package/src/FormFieldLabel/v2/props.ts +49 -0
  71. package/src/FormFieldLabel/v2/styles.ts +74 -0
  72. package/src/FormFieldLabel/v2/theme.ts +56 -0
  73. package/src/FormFieldLayout/{index.tsx → v1/index.tsx} +2 -2
  74. package/src/FormFieldLayout/{props.ts → v1/props.ts} +1 -1
  75. package/src/FormFieldLayout/{styles.ts → v1/styles.ts} +2 -2
  76. package/src/FormFieldLayout/v2/index.tsx +237 -0
  77. package/src/FormFieldLayout/v2/props.ts +157 -0
  78. package/src/FormFieldLayout/v2/styles.ts +209 -0
  79. package/src/FormFieldMessage/{index.tsx → v1/index.tsx} +1 -1
  80. package/src/FormFieldMessage/{props.ts → v1/props.ts} +4 -1
  81. package/src/FormFieldMessage/{styles.ts → v1/styles.ts} +2 -3
  82. package/src/FormFieldMessage/v2/index.tsx +104 -0
  83. package/src/FormFieldMessage/v2/props.ts +48 -0
  84. package/src/FormFieldMessage/v2/styles.ts +76 -0
  85. package/src/FormFieldMessages/{index.tsx → v1/index.tsx} +2 -2
  86. package/src/FormFieldMessages/{props.ts → v1/props.ts} +1 -1
  87. package/src/FormFieldMessages/v2/index.tsx +99 -0
  88. package/src/FormFieldMessages/v2/props.ts +59 -0
  89. package/src/FormFieldMessages/v2/styles.ts +55 -0
  90. package/src/{index.ts → exports/a.ts} +17 -13
  91. package/src/exports/b.ts +43 -0
  92. package/tsconfig.build.json +1 -0
  93. package/tsconfig.build.tsbuildinfo +1 -1
  94. package/types/FormField/v1/index.d.ts.map +1 -0
  95. package/types/FormField/{props.d.ts → v1/props.d.ts} +1 -1
  96. package/types/FormField/v1/props.d.ts.map +1 -0
  97. package/types/FormField/v2/index.d.ts +23 -0
  98. package/types/FormField/v2/index.d.ts.map +1 -0
  99. package/types/FormField/v2/props.d.ts +57 -0
  100. package/types/FormField/v2/props.d.ts.map +1 -0
  101. package/types/FormFieldGroup/{index.d.ts → v1/index.d.ts} +1 -1
  102. package/types/FormFieldGroup/v1/index.d.ts.map +1 -0
  103. package/types/FormFieldGroup/{props.d.ts → v1/props.d.ts} +2 -2
  104. package/types/FormFieldGroup/v1/props.d.ts.map +1 -0
  105. package/types/FormFieldGroup/v1/styles.d.ts.map +1 -0
  106. package/types/FormFieldGroup/v1/theme.d.ts.map +1 -0
  107. package/types/FormFieldGroup/v2/index.d.ts +45 -0
  108. package/types/FormFieldGroup/v2/index.d.ts.map +1 -0
  109. package/types/FormFieldGroup/v2/props.d.ts +48 -0
  110. package/types/FormFieldGroup/v2/props.d.ts.map +1 -0
  111. package/types/FormFieldGroup/v2/styles.d.ts +14 -0
  112. package/types/FormFieldGroup/v2/styles.d.ts.map +1 -0
  113. package/types/FormFieldLabel/v1/index.d.ts.map +1 -0
  114. package/types/FormFieldLabel/v1/props.d.ts.map +1 -0
  115. package/types/FormFieldLabel/v1/styles.d.ts.map +1 -0
  116. package/types/FormFieldLabel/v1/theme.d.ts.map +1 -0
  117. package/types/FormFieldLabel/v2/index.d.ts +38 -0
  118. package/types/FormFieldLabel/v2/index.d.ts.map +1 -0
  119. package/types/FormFieldLabel/v2/props.d.ts +14 -0
  120. package/types/FormFieldLabel/v2/props.d.ts.map +1 -0
  121. package/types/FormFieldLabel/v2/styles.d.ts +15 -0
  122. package/types/FormFieldLabel/v2/styles.d.ts.map +1 -0
  123. package/types/FormFieldLabel/v2/theme.d.ts +10 -0
  124. package/types/FormFieldLabel/v2/theme.d.ts.map +1 -0
  125. package/types/FormFieldLayout/v1/index.d.ts.map +1 -0
  126. package/types/FormFieldLayout/{props.d.ts → v1/props.d.ts} +1 -1
  127. package/types/FormFieldLayout/v1/props.d.ts.map +1 -0
  128. package/types/FormFieldLayout/v1/styles.d.ts.map +1 -0
  129. package/types/FormFieldLayout/v1/theme.d.ts.map +1 -0
  130. package/types/FormFieldLayout/v2/index.d.ts +14 -0
  131. package/types/FormFieldLayout/v2/index.d.ts.map +1 -0
  132. package/types/FormFieldLayout/v2/props.d.ts +90 -0
  133. package/types/FormFieldLayout/v2/props.d.ts.map +1 -0
  134. package/types/FormFieldLayout/v2/styles.d.ts +25 -0
  135. package/types/FormFieldLayout/v2/styles.d.ts.map +1 -0
  136. package/types/FormFieldMessage/{index.d.ts → v1/index.d.ts} +2 -2
  137. package/types/FormFieldMessage/v1/index.d.ts.map +1 -0
  138. package/types/FormFieldMessage/{props.d.ts → v1/props.d.ts} +1 -1
  139. package/types/FormFieldMessage/v1/props.d.ts.map +1 -0
  140. package/types/FormFieldMessage/v1/styles.d.ts.map +1 -0
  141. package/types/FormFieldMessage/v1/theme.d.ts.map +1 -0
  142. package/types/FormFieldMessage/v2/index.d.ts +24 -0
  143. package/types/FormFieldMessage/v2/index.d.ts.map +1 -0
  144. package/types/FormFieldMessage/v2/props.d.ts +16 -0
  145. package/types/FormFieldMessage/v2/props.d.ts.map +1 -0
  146. package/types/FormFieldMessage/v2/styles.d.ts +18 -0
  147. package/types/FormFieldMessage/v2/styles.d.ts.map +1 -0
  148. package/types/FormFieldMessages/{index.d.ts → v1/index.d.ts} +1 -1
  149. package/types/FormFieldMessages/v1/index.d.ts.map +1 -0
  150. package/types/FormFieldMessages/{props.d.ts → v1/props.d.ts} +1 -1
  151. package/types/FormFieldMessages/v1/props.d.ts.map +1 -0
  152. package/types/FormFieldMessages/v1/styles.d.ts.map +1 -0
  153. package/types/FormFieldMessages/v1/theme.d.ts.map +1 -0
  154. package/types/FormFieldMessages/v2/index.d.ts +36 -0
  155. package/types/FormFieldMessages/v2/index.d.ts.map +1 -0
  156. package/types/FormFieldMessages/v2/props.d.ts +25 -0
  157. package/types/FormFieldMessages/v2/props.d.ts.map +1 -0
  158. package/types/FormFieldMessages/v2/styles.d.ts +14 -0
  159. package/types/FormFieldMessages/v2/styles.d.ts.map +1 -0
  160. package/types/exports/a.d.ts +14 -0
  161. package/types/exports/a.d.ts.map +1 -0
  162. package/types/exports/b.d.ts +14 -0
  163. package/types/exports/b.d.ts.map +1 -0
  164. package/types/utils/v1/FormPropTypes.d.ts.map +1 -0
  165. package/types/FormField/index.d.ts.map +0 -1
  166. package/types/FormField/props.d.ts.map +0 -1
  167. package/types/FormFieldGroup/index.d.ts.map +0 -1
  168. package/types/FormFieldGroup/props.d.ts.map +0 -1
  169. package/types/FormFieldGroup/styles.d.ts.map +0 -1
  170. package/types/FormFieldGroup/theme.d.ts.map +0 -1
  171. package/types/FormFieldLabel/index.d.ts.map +0 -1
  172. package/types/FormFieldLabel/props.d.ts.map +0 -1
  173. package/types/FormFieldLabel/styles.d.ts.map +0 -1
  174. package/types/FormFieldLabel/theme.d.ts.map +0 -1
  175. package/types/FormFieldLayout/index.d.ts.map +0 -1
  176. package/types/FormFieldLayout/props.d.ts.map +0 -1
  177. package/types/FormFieldLayout/styles.d.ts.map +0 -1
  178. package/types/FormFieldLayout/theme.d.ts.map +0 -1
  179. package/types/FormFieldMessage/index.d.ts.map +0 -1
  180. package/types/FormFieldMessage/props.d.ts.map +0 -1
  181. package/types/FormFieldMessage/styles.d.ts.map +0 -1
  182. package/types/FormFieldMessage/theme.d.ts.map +0 -1
  183. package/types/FormFieldMessages/index.d.ts.map +0 -1
  184. package/types/FormFieldMessages/props.d.ts.map +0 -1
  185. package/types/FormFieldMessages/styles.d.ts.map +0 -1
  186. package/types/FormFieldMessages/theme.d.ts.map +0 -1
  187. package/types/FormPropTypes.d.ts.map +0 -1
  188. package/types/index.d.ts +0 -14
  189. package/types/index.d.ts.map +0 -1
  190. /package/es/FormField/{props.js → v1/props.js} +0 -0
  191. /package/es/FormFieldGroup/{props.js → v1/props.js} +0 -0
  192. /package/es/FormFieldGroup/{styles.js → v1/styles.js} +0 -0
  193. /package/es/FormFieldGroup/{theme.js → v1/theme.js} +0 -0
  194. /package/es/FormFieldLabel/{props.js → v1/props.js} +0 -0
  195. /package/es/FormFieldLabel/{styles.js → v1/styles.js} +0 -0
  196. /package/es/FormFieldLabel/{theme.js → v1/theme.js} +0 -0
  197. /package/es/FormFieldLayout/{props.js → v1/props.js} +0 -0
  198. /package/es/FormFieldLayout/{theme.js → v1/theme.js} +0 -0
  199. /package/es/FormFieldMessage/{props.js → v1/props.js} +0 -0
  200. /package/es/FormFieldMessage/{styles.js → v1/styles.js} +0 -0
  201. /package/es/FormFieldMessage/{theme.js → v1/theme.js} +0 -0
  202. /package/es/FormFieldMessages/{props.js → v1/props.js} +0 -0
  203. /package/es/FormFieldMessages/{styles.js → v1/styles.js} +0 -0
  204. /package/es/FormFieldMessages/{theme.js → v1/theme.js} +0 -0
  205. /package/es/{FormPropTypes.js → utils/v1/FormPropTypes.js} +0 -0
  206. /package/lib/FormField/{props.js → v1/props.js} +0 -0
  207. /package/lib/FormFieldGroup/{props.js → v1/props.js} +0 -0
  208. /package/lib/FormFieldGroup/{styles.js → v1/styles.js} +0 -0
  209. /package/lib/FormFieldGroup/{theme.js → v1/theme.js} +0 -0
  210. /package/lib/FormFieldLabel/{props.js → v1/props.js} +0 -0
  211. /package/lib/FormFieldLabel/{styles.js → v1/styles.js} +0 -0
  212. /package/lib/FormFieldLabel/{theme.js → v1/theme.js} +0 -0
  213. /package/lib/FormFieldLayout/{props.js → v1/props.js} +0 -0
  214. /package/lib/FormFieldLayout/{theme.js → v1/theme.js} +0 -0
  215. /package/lib/FormFieldMessage/{props.js → v1/props.js} +0 -0
  216. /package/lib/FormFieldMessage/{styles.js → v1/styles.js} +0 -0
  217. /package/lib/FormFieldMessage/{theme.js → v1/theme.js} +0 -0
  218. /package/lib/FormFieldMessages/{props.js → v1/props.js} +0 -0
  219. /package/lib/FormFieldMessages/{styles.js → v1/styles.js} +0 -0
  220. /package/lib/FormFieldMessages/{theme.js → v1/theme.js} +0 -0
  221. /package/lib/{FormPropTypes.js → utils/v1/FormPropTypes.js} +0 -0
  222. /package/src/FormField/{README.md → v1/README.md} +0 -0
  223. /package/src/FormFieldGroup/{README.md → v1/README.md} +0 -0
  224. /package/src/FormFieldGroup/{styles.ts → v1/styles.ts} +0 -0
  225. /package/src/FormFieldGroup/{theme.ts → v1/theme.ts} +0 -0
  226. /package/src/FormFieldLabel/{props.ts → v1/props.ts} +0 -0
  227. /package/src/FormFieldLabel/{styles.ts → v1/styles.ts} +0 -0
  228. /package/src/FormFieldLabel/{theme.ts → v1/theme.ts} +0 -0
  229. /package/src/FormFieldLayout/{theme.ts → v1/theme.ts} +0 -0
  230. /package/src/FormFieldMessage/{theme.ts → v1/theme.ts} +0 -0
  231. /package/src/FormFieldMessages/{styles.ts → v1/styles.ts} +0 -0
  232. /package/src/FormFieldMessages/{theme.ts → v1/theme.ts} +0 -0
  233. /package/src/{FormPropTypes.ts → utils/v1/FormPropTypes.ts} +0 -0
  234. /package/types/FormField/{index.d.ts → v1/index.d.ts} +0 -0
  235. /package/types/FormFieldGroup/{styles.d.ts → v1/styles.d.ts} +0 -0
  236. /package/types/FormFieldGroup/{theme.d.ts → v1/theme.d.ts} +0 -0
  237. /package/types/FormFieldLabel/{index.d.ts → v1/index.d.ts} +0 -0
  238. /package/types/FormFieldLabel/{props.d.ts → v1/props.d.ts} +0 -0
  239. /package/types/FormFieldLabel/{styles.d.ts → v1/styles.d.ts} +0 -0
  240. /package/types/FormFieldLabel/{theme.d.ts → v1/theme.d.ts} +0 -0
  241. /package/types/FormFieldLayout/{index.d.ts → v1/index.d.ts} +0 -0
  242. /package/types/FormFieldLayout/{styles.d.ts → v1/styles.d.ts} +0 -0
  243. /package/types/FormFieldLayout/{theme.d.ts → v1/theme.d.ts} +0 -0
  244. /package/types/FormFieldMessage/{styles.d.ts → v1/styles.d.ts} +0 -0
  245. /package/types/FormFieldMessage/{theme.d.ts → v1/theme.d.ts} +0 -0
  246. /package/types/FormFieldMessages/{styles.d.ts → v1/styles.d.ts} +0 -0
  247. /package/types/FormFieldMessages/{theme.d.ts → v1/theme.d.ts} +0 -0
  248. /package/types/{FormPropTypes.d.ts → utils/v1/FormPropTypes.d.ts} +0 -0
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = exports.FormFieldLabel = void 0;
8
+ var _react = require("react");
9
+ var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
10
+ var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
11
+ var _emotion = require("@instructure/emotion");
12
+ var _styles = _interopRequireDefault(require("./styles"));
13
+ var _theme = _interopRequireDefault(require("./theme"));
14
+ var _props = require("./props");
15
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
16
+ var _dec, _class, _FormFieldLabel;
17
+ /*
18
+ * The MIT License (MIT)
19
+ *
20
+ * Copyright (c) 2015 - present Instructure, Inc.
21
+ *
22
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
23
+ * of this software and associated documentation files (the "Software"), to deal
24
+ * in the Software without restriction, including without limitation the rights
25
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
26
+ * copies of the Software, and to permit persons to whom the Software is
27
+ * furnished to do so, subject to the following conditions:
28
+ *
29
+ * The above copyright notice and this permission notice shall be included in all
30
+ * copies or substantial portions of the Software.
31
+ *
32
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
33
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
34
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
35
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
36
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
37
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38
+ * SOFTWARE.
39
+ */
40
+ /**
41
+ ---
42
+ parent: FormField
43
+ ---
44
+
45
+ This is a helper component that is used by most of the custom form
46
+ components. In most cases it shouldn't be used directly.
47
+
48
+ ```js
49
+ ---
50
+ type: example
51
+ ---
52
+ <FormFieldLabel>Hello</FormFieldLabel>
53
+ ```
54
+
55
+ @deprecated since version 10. This is an internal component that will be
56
+ removed in the future
57
+ **/
58
+ let FormFieldLabel = exports.FormFieldLabel = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = (_FormFieldLabel = class FormFieldLabel extends _react.Component {
59
+ constructor(...args) {
60
+ super(...args);
61
+ this.ref = null;
62
+ this.handleRef = el => {
63
+ this.ref = el;
64
+ };
65
+ }
66
+ componentDidMount() {
67
+ var _this$props$makeStyle, _this$props;
68
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
69
+ }
70
+ componentDidUpdate() {
71
+ var _this$props$makeStyle2, _this$props2;
72
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
73
+ }
74
+ render() {
75
+ const ElementType = (0, _getElementType.getElementType)(FormFieldLabel, this.props);
76
+ const _this$props3 = this.props,
77
+ styles = _this$props3.styles,
78
+ children = _this$props3.children;
79
+ return (0, _jsxRuntime.jsx)(ElementType, {
80
+ ...(0, _omitProps.omitProps)(this.props, FormFieldLabel.allowedProps),
81
+ css: styles === null || styles === void 0 ? void 0 : styles.formFieldLabel,
82
+ ref: this.handleRef,
83
+ children: children
84
+ });
85
+ }
86
+ }, _FormFieldLabel.displayName = "FormFieldLabel", _FormFieldLabel.componentId = 'FormFieldLabel', _FormFieldLabel.allowedProps = _props.allowedProps, _FormFieldLabel.defaultProps = {
87
+ as: 'span'
88
+ }, _FormFieldLabel)) || _class);
89
+ var _default = exports.default = FormFieldLabel;
@@ -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 = ['as', 'children'];
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _hasVisibleChildren = require("@instructure/ui-a11y-utils/lib/hasVisibleChildren.js");
8
+ /*
9
+ * The MIT License (MIT)
10
+ *
11
+ * Copyright (c) 2015 - present Instructure, Inc.
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ * copies of the Software, and to permit persons to whom the Software is
18
+ * furnished to do so, subject to the following conditions:
19
+ *
20
+ * The above copyright notice and this permission notice shall be included in all
21
+ * copies or substantial portions of the Software.
22
+ *
23
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ * SOFTWARE.
30
+ */
31
+
32
+ /**
33
+ * ---
34
+ * private: true
35
+ * ---
36
+ * Generates the style object from the theme and provided additional information
37
+ * @param {Object} componentTheme The theme variable object.
38
+ * @param {Object} props the props of the component, the style is applied to
39
+ * @param {Object} state the state of the component, the style is applied to
40
+ * @return {Object} The final style object, which will be used in the component
41
+ */
42
+ const generateStyle = (componentTheme, props) => {
43
+ const children = props.children;
44
+ const hasContent = (0, _hasVisibleChildren.hasVisibleChildren)(children);
45
+ const labelStyles = {
46
+ all: 'initial',
47
+ display: 'block',
48
+ ...(hasContent && {
49
+ color: componentTheme.color,
50
+ fontFamily: componentTheme.fontFamily,
51
+ fontWeight: componentTheme.fontWeight,
52
+ fontSize: componentTheme.fontSize,
53
+ lineHeight: componentTheme.lineHeight,
54
+ margin: 0,
55
+ textAlign: 'inherit'
56
+ })
57
+ };
58
+ return {
59
+ formFieldLabel: {
60
+ label: 'formFieldLabel',
61
+ ...labelStyles,
62
+ // NOTE: needs separate groups for `:is()` and `:-webkit-any()` because of css selector group validation (see https://www.w3.org/TR/selectors-3/#grouping)
63
+ '&:is(label)': labelStyles,
64
+ '&:-webkit-any(label)': labelStyles
65
+ }
66
+ };
67
+ };
68
+ var _default = exports.default = generateStyle;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = 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
+ /**
32
+ * Generates the theme object for the component from the theme and provided additional information
33
+ * @param {Object} theme The actual theme object.
34
+ * @return {Object} The final theme object with the overrides and component variables
35
+ */
36
+ const generateComponentTheme = theme => {
37
+ var _colors$contrasts;
38
+ const colors = theme.colors,
39
+ typography = theme.typography,
40
+ themeName = theme.key;
41
+ const themeSpecificStyle = {
42
+ canvas: {
43
+ color: theme['ic-brand-font-color-dark']
44
+ }
45
+ };
46
+ const componentVariables = {
47
+ color: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey125125,
48
+ fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
49
+ fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightBold,
50
+ fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
51
+ lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeightFit
52
+ };
53
+ return {
54
+ ...componentVariables,
55
+ ...themeSpecificStyle[themeName]
56
+ };
57
+ };
58
+ var _default = exports.default = generateComponentTheme;
@@ -12,7 +12,7 @@ var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
12
12
  var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
13
13
  var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
14
14
  var _emotion = require("@instructure/emotion");
15
- var _FormFieldMessages = require("../FormFieldMessages");
15
+ var _v = require("../../FormFieldMessages/v1");
16
16
  var _styles = _interopRequireDefault(require("./styles"));
17
17
  var _props = require("./props");
18
18
  var _theme = _interopRequireDefault(require("./theme"));
@@ -47,7 +47,7 @@ var _dec, _dec2, _class, _FormFieldLayout;
47
47
  parent: FormField
48
48
  ---
49
49
  **/
50
- let FormFieldLayout = exports.FormFieldLayout = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_FormFieldLayout = class FormFieldLayout extends _react.Component {
50
+ let FormFieldLayout = exports.FormFieldLayout = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_FormFieldLayout = class FormFieldLayout extends _react.Component {
51
51
  constructor(props) {
52
52
  super(props);
53
53
  this._messagesId = void 0;
@@ -150,7 +150,7 @@ let FormFieldLayout = exports.FormFieldLayout = (_dec = (0, _withDeterministicId
150
150
  } else return null;
151
151
  }
152
152
  renderVisibleMessages() {
153
- return this.hasMessages ? (0, _jsxRuntime.jsx)(_FormFieldMessages.FormFieldMessages, {
153
+ return this.hasMessages ? (0, _jsxRuntime.jsx)(_v.FormFieldMessages, {
154
154
  id: this._messagesId,
155
155
  messages: this.props.messages,
156
156
  gridArea: "messages"
@@ -74,7 +74,7 @@ const generateStyle = (componentTheme, props, styleProps) => {
74
74
  const hasMessages = styleProps.hasMessages,
75
75
  hasVisibleLabel = styleProps.hasVisibleLabel,
76
76
  hasNewErrorMsgAndIsGroup = styleProps.hasNewErrorMsgAndIsGroup;
77
- const cssMargin = (0, _emotion.mapSpacingToShorthand)(margin, componentTheme.spacing);
77
+ const cssMargin = (0, _emotion.calcSpacingFromShorthand)(margin, componentTheme.spacing);
78
78
  const isInlineLayout = layout === 'inline';
79
79
  const hasNonEmptyMessages = messages === null || messages === void 0 ? void 0 : messages.reduce((acc, message) => acc || message.type !== 'screenreader-only', false);
80
80
 
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.FormFieldLayout = void 0;
8
+ Object.defineProperty(exports, "allowedProps", {
9
+ enumerable: true,
10
+ get: function () {
11
+ return _props.allowedProps;
12
+ }
13
+ });
14
+ exports.default = void 0;
15
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
16
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
17
+ var _react = require("react");
18
+ var _hasVisibleChildren = require("@instructure/ui-a11y-utils/lib/hasVisibleChildren.js");
19
+ var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
20
+ var _useDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/useDeterministicId.js");
21
+ var _emotion = require("@instructure/emotion");
22
+ var _v = require("../../FormFieldMessages/v2");
23
+ var _styles = _interopRequireDefault(require("./styles"));
24
+ var _props = require("./props");
25
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
26
+ const _excluded = ["inline", "layout", "as", "labelAlign", "vAlign", "label", "messages", "messagesId", "children", "width", "elementRef", "inputContainerRef", "isGroup", "isRequired", "margin", "disabled", "readOnly", "themeOverride"];
27
+ /*
28
+ * The MIT License (MIT)
29
+ *
30
+ * Copyright (c) 2015 - present Instructure, Inc.
31
+ *
32
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
33
+ * of this software and associated documentation files (the "Software"), to deal
34
+ * in the Software without restriction, including without limitation the rights
35
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
36
+ * copies of the Software, and to permit persons to whom the Software is
37
+ * furnished to do so, subject to the following conditions:
38
+ *
39
+ * The above copyright notice and this permission notice shall be included in all
40
+ * copies or substantial portions of the Software.
41
+ *
42
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
45
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
46
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
47
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
48
+ * SOFTWARE.
49
+ */
50
+ /**
51
+ ---
52
+ parent: FormField
53
+ ---
54
+ **/
55
+ const FormFieldLayout = exports.FormFieldLayout = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
56
+ var _FormFieldMessages;
57
+ const _props$inline = props.inline,
58
+ inline = _props$inline === void 0 ? false : _props$inline,
59
+ _props$layout = props.layout,
60
+ layout = _props$layout === void 0 ? 'stacked' : _props$layout,
61
+ _props$as = props.as,
62
+ as = _props$as === void 0 ? 'label' : _props$as,
63
+ _props$labelAlign = props.labelAlign,
64
+ labelAlign = _props$labelAlign === void 0 ? 'end' : _props$labelAlign,
65
+ vAlign = props.vAlign,
66
+ label = props.label,
67
+ messages = props.messages,
68
+ messagesIdProp = props.messagesId,
69
+ children = props.children,
70
+ width = props.width,
71
+ elementRef = props.elementRef,
72
+ inputContainerRef = props.inputContainerRef,
73
+ isGroup = props.isGroup,
74
+ _props$isRequired = props.isRequired,
75
+ isRequired = _props$isRequired === void 0 ? false : _props$isRequired,
76
+ margin = props.margin,
77
+ _props$disabled = props.disabled,
78
+ disabled = _props$disabled === void 0 ? false : _props$disabled,
79
+ _props$readOnly = props.readOnly,
80
+ readOnly = _props$readOnly === void 0 ? false : _props$readOnly,
81
+ themeOverride = props.themeOverride,
82
+ rest = (0, _objectWithoutProperties2.default)(props, _excluded);
83
+
84
+ // Deterministic ID generation
85
+ const _useState = (0, _react.useState)(),
86
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
87
+ deterministicId = _useState2[0],
88
+ setDeterministicId = _useState2[1];
89
+ const getId = (0, _useDeterministicId.useDeterministicId)('FormFieldLayout');
90
+ (0, _react.useEffect)(() => {
91
+ setDeterministicId(getId());
92
+ }, []);
93
+ const messagesId = messagesIdProp || deterministicId;
94
+ const labelId = deterministicId ? `${deterministicId}-Label` : void 0;
95
+
96
+ // Filter out error and success messages when disabled or readOnly
97
+ const filteredMessages = disabled || readOnly ? messages === null || messages === void 0 ? void 0 : messages.filter(msg => msg.type !== 'error' && msg.type !== 'newError' && msg.type !== 'success') : messages;
98
+
99
+ // Compute style props
100
+ const hasMessages = filteredMessages && filteredMessages.length > 0 ? filteredMessages.some(msg => {
101
+ if (msg.text) {
102
+ if (typeof msg.text === 'string') {
103
+ return msg.text.length > 0;
104
+ }
105
+ return true;
106
+ }
107
+ return false;
108
+ }) : false;
109
+ const hasVisibleLabel = label ? (0, _hasVisibleChildren.hasVisibleChildren)(label) : false;
110
+ const hasErrorMsgAndIsGroup = !!(filteredMessages !== null && filteredMessages !== void 0 && filteredMessages.find(m => m.type === 'error' || m.type === 'newError')) && !!isGroup;
111
+ const invalid = !!(filteredMessages !== null && filteredMessages !== void 0 && filteredMessages.find(m => m.type === 'error' || m.type === 'newError'));
112
+
113
+ // Styles
114
+ const styles = (0, _emotion.useStyle)({
115
+ generateStyle: _styles.default,
116
+ themeOverride,
117
+ params: {
118
+ hasMessages,
119
+ hasVisibleLabel,
120
+ hasErrorMsgAndIsGroup,
121
+ inline,
122
+ layout,
123
+ vAlign,
124
+ labelAlign,
125
+ margin,
126
+ messages: filteredMessages,
127
+ isRequired,
128
+ invalid
129
+ },
130
+ componentId: 'FormFieldLayout',
131
+ displayName: 'FormFieldLayout'
132
+ });
133
+ const ElementType = as;
134
+ const handleRef = (0, _react.useCallback)(el => {
135
+ if (typeof ref === 'function') {
136
+ ref(el);
137
+ } else if (ref) {
138
+ const refObject = ref;
139
+ refObject.current = el;
140
+ }
141
+ if (typeof elementRef === 'function') {
142
+ elementRef(el);
143
+ }
144
+ }, [ref, elementRef]);
145
+ const handleInputContainerRef = (0, _react.useCallback)(node => {
146
+ if (typeof inputContainerRef === 'function') {
147
+ inputContainerRef(node);
148
+ }
149
+ }, [inputContainerRef]);
150
+ const renderLabel = () => {
151
+ const labelContent = hasVisibleLabel ? (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
152
+ children: [label, isRequired && (0, _jsxRuntime.jsxs)("span", {
153
+ css: invalid ? styles === null || styles === void 0 ? void 0 : styles.requiredAsterisk : {},
154
+ "aria-hidden": true,
155
+ children: [' ', "*"]
156
+ })]
157
+ }) : label;
158
+ if (hasVisibleLabel) {
159
+ if (ElementType === 'fieldset') {
160
+ // `legend` has some special built in CSS, this can only be reset
161
+ // this way https://stackoverflow.com/a/65866981/319473
162
+ return (0, _jsxRuntime.jsx)("legend", {
163
+ style: {
164
+ display: 'contents'
165
+ },
166
+ children: (0, _jsxRuntime.jsx)("span", {
167
+ css: styles === null || styles === void 0 ? void 0 : styles.formFieldLabel,
168
+ children: labelContent
169
+ })
170
+ });
171
+ }
172
+ return (0, _jsxRuntime.jsx)("span", {
173
+ css: styles === null || styles === void 0 ? void 0 : styles.formFieldLabel,
174
+ children: labelContent
175
+ });
176
+ } else if (label) {
177
+ if (ElementType === 'fieldset') {
178
+ return (0, _jsxRuntime.jsx)("legend", {
179
+ id: labelId,
180
+ style: {
181
+ display: 'contents'
182
+ },
183
+ children: label
184
+ });
185
+ }
186
+ // needs to be wrapped because it needs an `id`
187
+ return (0, _jsxRuntime.jsx)("div", {
188
+ id: labelId,
189
+ style: {
190
+ display: 'contents'
191
+ },
192
+ children: label
193
+ });
194
+ } else return null;
195
+ };
196
+ const renderVisibleMessages = () => {
197
+ return hasMessages ? _FormFieldMessages || (_FormFieldMessages = (0, _jsxRuntime.jsx)(_v.FormFieldMessages, {
198
+ id: messagesId,
199
+ messages: filteredMessages,
200
+ gridArea: "messages"
201
+ })) : null;
202
+ };
203
+ return (0, _jsxRuntime.jsxs)(ElementType, {
204
+ ...(0, _omitProps.omitProps)(rest, [..._props.allowedProps]),
205
+ css: styles === null || styles === void 0 ? void 0 : styles.formFieldLayout,
206
+ "aria-describedby": hasMessages ? messagesId : void 0,
207
+ "aria-errormessage": rest['aria-invalid'] ? messagesId : void 0,
208
+ style: {
209
+ width
210
+ },
211
+ ref: handleRef,
212
+ children: [renderLabel(), hasErrorMsgAndIsGroup && renderVisibleMessages(), (0, _jsxRuntime.jsx)("span", {
213
+ css: styles === null || styles === void 0 ? void 0 : styles.formFieldChildren,
214
+ ref: handleInputContainerRef,
215
+ children: children
216
+ }), !hasErrorMsgAndIsGroup && renderVisibleMessages()]
217
+ });
218
+ });
219
+ FormFieldLayout.displayName = 'FormFieldLayout';
220
+ var _default = exports.default = FormFieldLayout;
@@ -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 = ['label', 'id', 'as', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'width', 'inputContainerRef', 'elementRef', 'margin', 'vAlign', 'isRequired', 'disabled', 'readOnly'];