@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,78 @@
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
+ import { omitProps, pickProps } from '@instructure/ui-react-utils';
27
+ import { allowedProps as formFieldLayoutAllowedProps } from "../../FormFieldLayout/v2/props.js";
28
+ import { FormFieldLayout } from "../../FormFieldLayout/v2/index.js";
29
+ import { allowedProps } from "./props.js";
30
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
31
+ /**
32
+ ---
33
+ category: components
34
+ ---
35
+ **/
36
+ class FormField extends Component {
37
+ constructor(...args) {
38
+ super(...args);
39
+ this.ref = null;
40
+ this.handleRef = el => {
41
+ const elementRef = this.props.elementRef;
42
+ this.ref = el;
43
+ if (typeof elementRef === 'function') {
44
+ elementRef(el);
45
+ }
46
+ };
47
+ }
48
+ render() {
49
+ return _jsx(FormFieldLayout, {
50
+ ...omitProps(this.props, FormField.allowedProps),
51
+ ...pickProps(this.props, formFieldLayoutAllowedProps),
52
+ label: this.props.label,
53
+ vAlign: this.props.vAlign,
54
+ as: "label"
55
+ // This makes the control in focus when the label is clicked
56
+ // This is needed to prevent the wrong element to be focused, e.g.
57
+ // multi selects Tag-s
58
+ ,
59
+ htmlFor: this.props.id,
60
+ elementRef: this.handleRef,
61
+ margin: this.props.margin,
62
+ isRequired: this.props.isRequired,
63
+ disabled: this.props.disabled,
64
+ readOnly: this.props.readOnly
65
+ });
66
+ }
67
+ }
68
+ FormField.displayName = "FormField";
69
+ FormField.componentId = 'FormField';
70
+ FormField.allowedProps = allowedProps;
71
+ FormField.defaultProps = {
72
+ inline: false,
73
+ layout: 'stacked',
74
+ labelAlign: 'end',
75
+ vAlign: 'middle'
76
+ };
77
+ export default FormField;
78
+ export { FormField };
@@ -0,0 +1,26 @@
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
+ const allowedProps = ['label', 'id', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'vAlign', 'width', 'inputContainerRef', 'elementRef', 'isRequired', 'margin', 'disabled', 'readOnly'];
26
+ export { allowedProps };
@@ -26,10 +26,11 @@ var _dec, _class, _FormFieldGroup;
26
26
  */
27
27
 
28
28
  import { Component, Children } from 'react';
29
- import { Grid } from '@instructure/ui-grid';
29
+ import { Grid } from '@instructure/ui-grid/v11_6';
30
30
  import { pickProps, omitProps } from '@instructure/ui-react-utils';
31
- import { withStyle } from '@instructure/emotion';
32
- import { FormFieldLayout } from "../FormFieldLayout/index.js";
31
+ import { withStyleLegacy as withStyle } from '@instructure/emotion';
32
+ import { allowedProps as FormFieldLayoutAllowedProps } from "../../FormFieldLayout/v1/props.js";
33
+ import { FormFieldLayout } from "../../FormFieldLayout/v1/index.js";
33
34
  import generateStyle from "./styles.js";
34
35
  import generateComponentTheme from "./theme.js";
35
36
  import { allowedProps } from "./props.js";
@@ -116,7 +117,7 @@ let FormFieldGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _
116
117
  }
117
118
  return _jsx(FormFieldLayout, {
118
119
  ...omitProps(props, FormFieldGroup.allowedProps),
119
- ...pickProps(props, FormFieldLayout.allowedProps),
120
+ ...pickProps(props, FormFieldLayoutAllowedProps),
120
121
  vAlign: props.vAlign,
121
122
  layout: props.layout === 'inline' ? 'inline' : 'stacked',
122
123
  label: props.description,
@@ -0,0 +1,130 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ const _excluded = ["styles", "makeStyles", "isGroup"];
3
+ var _dec, _class, _FormFieldGroup;
4
+ /*
5
+ * The MIT License (MIT)
6
+ *
7
+ * Copyright (c) 2015 - present Instructure, Inc.
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ * of this software and associated documentation files (the "Software"), to deal
11
+ * in the Software without restriction, including without limitation the rights
12
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ * copies of the Software, and to permit persons to whom the Software is
14
+ * furnished to do so, subject to the following conditions:
15
+ *
16
+ * The above copyright notice and this permission notice shall be included in all
17
+ * copies or substantial portions of the Software.
18
+ *
19
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ * SOFTWARE.
26
+ */
27
+
28
+ import { Component, Children } from 'react';
29
+ import { Grid } from '@instructure/ui-grid/latest';
30
+ import { pickProps, omitProps } from '@instructure/ui-react-utils';
31
+ import { withStyle } from '@instructure/emotion';
32
+ import { allowedProps as formFieldLayoutAllowedProps } from "../../FormFieldLayout/v2/props.js";
33
+ import { FormFieldLayout } from "../../FormFieldLayout/v2/index.js";
34
+ import generateStyle from "./styles.js";
35
+ import { allowedProps } from "./props.js";
36
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
37
+ /**
38
+ ---
39
+ category: components
40
+ ---
41
+ **/
42
+ let FormFieldGroup = (_dec = withStyle(generateStyle), _dec(_class = (_FormFieldGroup = class FormFieldGroup extends Component {
43
+ constructor(...args) {
44
+ super(...args);
45
+ this.ref = null;
46
+ this.handleRef = el => {
47
+ const elementRef = this.props.elementRef;
48
+ this.ref = el;
49
+ if (typeof elementRef === 'function') {
50
+ elementRef(el);
51
+ }
52
+ };
53
+ }
54
+ componentDidMount() {
55
+ var _this$props$makeStyle, _this$props;
56
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
57
+ }
58
+ componentDidUpdate() {
59
+ var _this$props$makeStyle2, _this$props2;
60
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
61
+ }
62
+ get invalid() {
63
+ return !!this.props.messages && this.props.messages.findIndex(message => {
64
+ return message.type === 'error' || message.type === 'newError';
65
+ }) >= 0;
66
+ }
67
+ renderColumns() {
68
+ return Children.map(this.props.children, (child, index) => {
69
+ return child ? _jsx(Grid.Col, {
70
+ width: child.props && child.props.width ? 'auto' : void 0,
71
+ children: child
72
+ }, index) : null;
73
+ });
74
+ }
75
+ renderChildren() {
76
+ return _jsx(Grid, {
77
+ colSpacing: this.props.colSpacing,
78
+ rowSpacing: this.props.rowSpacing,
79
+ vAlign: this.props.vAlign,
80
+ startAt: this.props.startAt || (this.props.layout === 'columns' ? 'medium' : null),
81
+ children: _jsx(Grid.Row, {
82
+ children: this.renderColumns()
83
+ })
84
+ });
85
+ }
86
+ renderFields() {
87
+ const styles = this.props.styles;
88
+ return _jsx("span", {
89
+ css: styles === null || styles === void 0 ? void 0 : styles.formFieldGroup,
90
+ children: this.renderChildren()
91
+ }, "fields");
92
+ }
93
+ render() {
94
+ const _this$props3 = this.props,
95
+ styles = _this$props3.styles,
96
+ makeStyles = _this$props3.makeStyles,
97
+ isGroup = _this$props3.isGroup,
98
+ props = _objectWithoutProperties(_this$props3, _excluded);
99
+ // This is quite ugly, but according to ARIA spec the `aria-invalid` prop
100
+ // can only be used with certain roles see
101
+ // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-invalid#associated_roles
102
+ // `aria-invalid` is put on in FormFieldLayout because the error message
103
+ // DOM part gets there its ID.
104
+ let ariaInvalid = void 0;
105
+ if (this.props.role && this.invalid && ['application', 'checkbox', 'combobox', 'gridcell', 'listbox', 'radiogroup', 'slider', 'spinbutton', 'textbox', 'tree', 'columnheader', 'rowheader', 'searchbox', 'switch', 'treegrid'].includes(this.props.role)) {
106
+ ariaInvalid = 'true';
107
+ }
108
+ return _jsx(FormFieldLayout, {
109
+ ...omitProps(props, FormFieldGroup.allowedProps),
110
+ ...pickProps(props, formFieldLayoutAllowedProps),
111
+ vAlign: props.vAlign,
112
+ layout: props.layout === 'inline' ? 'inline' : 'stacked',
113
+ label: props.description,
114
+ "aria-disabled": props.disabled ? 'true' : void 0,
115
+ "aria-invalid": ariaInvalid,
116
+ elementRef: this.handleRef,
117
+ isGroup: isGroup,
118
+ children: this.renderFields()
119
+ });
120
+ }
121
+ }, _FormFieldGroup.displayName = "FormFieldGroup", _FormFieldGroup.componentId = 'FormFieldGroup', _FormFieldGroup.allowedProps = allowedProps, _FormFieldGroup.defaultProps = {
122
+ as: 'fieldset',
123
+ disabled: false,
124
+ rowSpacing: 'medium',
125
+ colSpacing: 'small',
126
+ vAlign: 'middle',
127
+ isGroup: true
128
+ }, _FormFieldGroup)) || _class);
129
+ export default FormFieldGroup;
130
+ export { FormFieldGroup };
@@ -0,0 +1,26 @@
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
+ const allowedProps = ['description', 'as', 'messages', 'messagesId', 'disabled', 'readOnly', 'children', 'layout', 'rowSpacing', 'colSpacing', 'vAlign', 'startAt', 'elementRef'];
26
+ export { allowedProps };
@@ -0,0 +1,49 @@
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
+ /**
26
+ * ---
27
+ * private: true
28
+ * ---
29
+ * Generates the style object from the theme and provided additional information
30
+ * @param {Object} componentTheme The theme variable object.
31
+ * @param {Object} props the props of the component, the style is applied to
32
+ * @param {Object} state the state of the component, the style is applied to
33
+ * @return {Object} The final style object, which will be used in the component
34
+ */
35
+ const generateStyle = (_componentTheme, props) => {
36
+ const disabled = props.disabled;
37
+ return {
38
+ formFieldGroup: {
39
+ label: 'formFieldGroup',
40
+ display: 'block',
41
+ ...(disabled && {
42
+ opacity: 0.6,
43
+ cursor: 'not-allowed',
44
+ pointerEvents: 'none'
45
+ })
46
+ }
47
+ };
48
+ };
49
+ export default generateStyle;
@@ -25,7 +25,7 @@ var _dec, _class, _FormFieldLabel;
25
25
 
26
26
  import { Component } from 'react';
27
27
  import { omitProps, getElementType } from '@instructure/ui-react-utils';
28
- import { withStyle } from '@instructure/emotion';
28
+ import { withStyleLegacy as withStyle } from '@instructure/emotion';
29
29
  import generateStyle from "./styles.js";
30
30
  import generateComponentTheme from "./theme.js";
31
31
  import { allowedProps } from "./props.js";
@@ -0,0 +1,83 @@
1
+ var _dec, _class, _FormFieldLabel;
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2015 - present Instructure, Inc.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ import { Component } from 'react';
27
+ import { omitProps, getElementType } from '@instructure/ui-react-utils';
28
+ import { withStyleLegacy as withStyle } from '@instructure/emotion';
29
+ import generateStyle from "./styles.js";
30
+ import generateComponentTheme from "./theme.js";
31
+ import { allowedProps } from "./props.js";
32
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
33
+ /**
34
+ ---
35
+ parent: FormField
36
+ ---
37
+
38
+ This is a helper component that is used by most of the custom form
39
+ components. In most cases it shouldn't be used directly.
40
+
41
+ ```js
42
+ ---
43
+ type: example
44
+ ---
45
+ <FormFieldLabel>Hello</FormFieldLabel>
46
+ ```
47
+
48
+ @deprecated since version 10. This is an internal component that will be
49
+ removed in the future
50
+ **/
51
+ let FormFieldLabel = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_FormFieldLabel = class FormFieldLabel extends Component {
52
+ constructor(...args) {
53
+ super(...args);
54
+ this.ref = null;
55
+ this.handleRef = el => {
56
+ this.ref = el;
57
+ };
58
+ }
59
+ componentDidMount() {
60
+ var _this$props$makeStyle, _this$props;
61
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
62
+ }
63
+ componentDidUpdate() {
64
+ var _this$props$makeStyle2, _this$props2;
65
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
66
+ }
67
+ render() {
68
+ const ElementType = getElementType(FormFieldLabel, this.props);
69
+ const _this$props3 = this.props,
70
+ styles = _this$props3.styles,
71
+ children = _this$props3.children;
72
+ return _jsx(ElementType, {
73
+ ...omitProps(this.props, FormFieldLabel.allowedProps),
74
+ css: styles === null || styles === void 0 ? void 0 : styles.formFieldLabel,
75
+ ref: this.handleRef,
76
+ children: children
77
+ });
78
+ }
79
+ }, _FormFieldLabel.displayName = "FormFieldLabel", _FormFieldLabel.componentId = 'FormFieldLabel', _FormFieldLabel.allowedProps = allowedProps, _FormFieldLabel.defaultProps = {
80
+ as: 'span'
81
+ }, _FormFieldLabel)) || _class);
82
+ export default FormFieldLabel;
83
+ export { FormFieldLabel };
@@ -0,0 +1,26 @@
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
+ const allowedProps = ['as', 'children'];
26
+ export { allowedProps };
@@ -0,0 +1,62 @@
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 { hasVisibleChildren } from '@instructure/ui-a11y-utils';
26
+ /**
27
+ * ---
28
+ * private: true
29
+ * ---
30
+ * Generates the style object from the theme and provided additional information
31
+ * @param {Object} componentTheme The theme variable object.
32
+ * @param {Object} props the props of the component, the style is applied to
33
+ * @param {Object} state the state of the component, the style is applied to
34
+ * @return {Object} The final style object, which will be used in the component
35
+ */
36
+ const generateStyle = (componentTheme, props) => {
37
+ const children = props.children;
38
+ const hasContent = hasVisibleChildren(children);
39
+ const labelStyles = {
40
+ all: 'initial',
41
+ display: 'block',
42
+ ...(hasContent && {
43
+ color: componentTheme.color,
44
+ fontFamily: componentTheme.fontFamily,
45
+ fontWeight: componentTheme.fontWeight,
46
+ fontSize: componentTheme.fontSize,
47
+ lineHeight: componentTheme.lineHeight,
48
+ margin: 0,
49
+ textAlign: 'inherit'
50
+ })
51
+ };
52
+ return {
53
+ formFieldLabel: {
54
+ label: 'formFieldLabel',
55
+ ...labelStyles,
56
+ // NOTE: needs separate groups for `:is()` and `:-webkit-any()` because of css selector group validation (see https://www.w3.org/TR/selectors-3/#grouping)
57
+ '&:is(label)': labelStyles,
58
+ '&:-webkit-any(label)': labelStyles
59
+ }
60
+ };
61
+ };
62
+ export default generateStyle;
@@ -0,0 +1,52 @@
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
+ /**
26
+ * Generates the theme object for the component from the theme and provided additional information
27
+ * @param {Object} theme The actual theme object.
28
+ * @return {Object} The final theme object with the overrides and component variables
29
+ */
30
+ const generateComponentTheme = theme => {
31
+ var _colors$contrasts;
32
+ const colors = theme.colors,
33
+ typography = theme.typography,
34
+ themeName = theme.key;
35
+ const themeSpecificStyle = {
36
+ canvas: {
37
+ color: theme['ic-brand-font-color-dark']
38
+ }
39
+ };
40
+ const componentVariables = {
41
+ color: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey125125,
42
+ fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
43
+ fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightBold,
44
+ fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
45
+ lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeightFit
46
+ };
47
+ return {
48
+ ...componentVariables,
49
+ ...themeSpecificStyle[themeName]
50
+ };
51
+ };
52
+ export default generateComponentTheme;
@@ -28,8 +28,8 @@ var _dec, _dec2, _class, _FormFieldLayout;
28
28
  import { Component } from 'react';
29
29
  import { hasVisibleChildren } from '@instructure/ui-a11y-utils';
30
30
  import { omitProps, getElementType, withDeterministicId } from '@instructure/ui-react-utils';
31
- import { withStyle } from '@instructure/emotion';
32
- import { FormFieldMessages } from "../FormFieldMessages/index.js";
31
+ import { withStyleLegacy as withStyle } from '@instructure/emotion';
32
+ import { FormFieldMessages } from "../../FormFieldMessages/v1/index.js";
33
33
  import generateStyle from "./styles.js";
34
34
  import { allowedProps } from "./props.js";
35
35
  import generateComponentTheme from "./theme.js";
@@ -22,7 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import { mapSpacingToShorthand } from '@instructure/emotion';
25
+ import { calcSpacingFromShorthand } from '@instructure/emotion';
26
26
  const generateGridLayout = (isInlineLayout, hasNewErrorMsgAndIsGroup, hasVisibleLabel, hasMessages) => {
27
27
  if (isInlineLayout) {
28
28
  if (hasNewErrorMsgAndIsGroup) {
@@ -68,7 +68,7 @@ const generateStyle = (componentTheme, props, styleProps) => {
68
68
  const hasMessages = styleProps.hasMessages,
69
69
  hasVisibleLabel = styleProps.hasVisibleLabel,
70
70
  hasNewErrorMsgAndIsGroup = styleProps.hasNewErrorMsgAndIsGroup;
71
- const cssMargin = mapSpacingToShorthand(margin, componentTheme.spacing);
71
+ const cssMargin = calcSpacingFromShorthand(margin, componentTheme.spacing);
72
72
  const isInlineLayout = layout === 'inline';
73
73
  const hasNonEmptyMessages = messages === null || messages === void 0 ? void 0 : messages.reduce((acc, message) => acc || message.type !== 'screenreader-only', false);
74
74