@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.
- package/CHANGELOG.md +46 -300
- package/es/FormField/{index.js → v1/index.js} +1 -1
- package/es/FormField/v2/index.js +78 -0
- package/es/FormField/v2/props.js +26 -0
- package/es/FormFieldGroup/{index.js → v1/index.js} +5 -4
- package/es/FormFieldGroup/v2/index.js +130 -0
- package/es/FormFieldGroup/v2/props.js +26 -0
- package/es/FormFieldGroup/v2/styles.js +49 -0
- package/es/FormFieldLabel/{index.js → v1/index.js} +1 -1
- package/es/FormFieldLabel/v2/index.js +83 -0
- package/es/FormFieldLabel/v2/props.js +26 -0
- package/es/FormFieldLabel/v2/styles.js +62 -0
- package/es/FormFieldLabel/v2/theme.js +52 -0
- package/es/FormFieldLayout/{index.js → v1/index.js} +2 -2
- package/es/FormFieldLayout/{styles.js → v1/styles.js} +2 -2
- package/es/FormFieldLayout/v2/index.js +207 -0
- package/es/FormFieldLayout/v2/props.js +26 -0
- package/es/FormFieldLayout/v2/styles.js +171 -0
- package/es/FormFieldMessage/{index.js → v1/index.js} +1 -1
- package/es/FormFieldMessage/v2/index.js +96 -0
- package/es/FormFieldMessage/v2/props.js +26 -0
- package/es/FormFieldMessage/v2/styles.js +69 -0
- package/es/FormFieldMessages/{index.js → v1/index.js} +2 -2
- package/es/FormFieldMessages/v2/index.js +88 -0
- package/es/FormFieldMessages/v2/props.js +26 -0
- package/es/FormFieldMessages/v2/styles.js +50 -0
- package/es/{index.js → exports/a.js} +6 -6
- package/es/exports/b.js +29 -0
- package/lib/FormField/{index.js → v1/index.js} +3 -3
- package/lib/FormField/v2/index.js +85 -0
- package/lib/FormField/v2/props.js +31 -0
- package/lib/FormFieldGroup/{index.js → v1/index.js} +11 -10
- package/lib/FormFieldGroup/v2/index.js +136 -0
- package/lib/FormFieldGroup/v2/props.js +31 -0
- package/lib/FormFieldGroup/v2/styles.js +55 -0
- package/lib/FormFieldLabel/{index.js → v1/index.js} +1 -1
- package/lib/FormFieldLabel/v2/index.js +89 -0
- package/lib/FormFieldLabel/v2/props.js +31 -0
- package/lib/FormFieldLabel/v2/styles.js +68 -0
- package/lib/FormFieldLabel/v2/theme.js +58 -0
- package/lib/FormFieldLayout/{index.js → v1/index.js} +3 -3
- package/lib/FormFieldLayout/{styles.js → v1/styles.js} +1 -1
- package/lib/FormFieldLayout/v2/index.js +220 -0
- package/lib/FormFieldLayout/v2/props.js +31 -0
- package/lib/FormFieldLayout/v2/styles.js +177 -0
- package/lib/FormFieldMessage/{index.js → v1/index.js} +2 -2
- package/lib/FormFieldMessage/v2/index.js +101 -0
- package/lib/FormFieldMessage/v2/props.js +31 -0
- package/lib/FormFieldMessage/v2/styles.js +75 -0
- package/lib/FormFieldMessages/{index.js → v1/index.js} +3 -3
- package/lib/FormFieldMessages/v2/index.js +93 -0
- package/lib/FormFieldMessages/v2/props.js +31 -0
- package/lib/FormFieldMessages/v2/styles.js +56 -0
- package/lib/{index.js → exports/a.js} +12 -12
- package/lib/exports/b.js +47 -0
- package/package.json +43 -21
- package/src/FormField/{index.tsx → v1/index.tsx} +1 -1
- package/src/FormField/{props.ts → v1/props.ts} +1 -1
- package/src/FormField/v2/README.md +43 -0
- package/src/FormField/v2/index.tsx +87 -0
- package/src/FormField/v2/props.ts +104 -0
- package/src/FormFieldGroup/{index.tsx → v1/index.tsx} +6 -4
- package/src/FormFieldGroup/{props.ts → v1/props.ts} +2 -2
- package/src/FormFieldGroup/v2/README.md +114 -0
- package/src/FormFieldGroup/v2/index.tsx +182 -0
- package/src/FormFieldGroup/v2/props.ts +103 -0
- package/src/FormFieldGroup/v2/styles.ts +58 -0
- package/src/FormFieldLabel/{index.tsx → v1/index.tsx} +1 -1
- package/src/FormFieldLabel/v2/index.tsx +95 -0
- package/src/FormFieldLabel/v2/props.ts +49 -0
- package/src/FormFieldLabel/v2/styles.ts +74 -0
- package/src/FormFieldLabel/v2/theme.ts +56 -0
- package/src/FormFieldLayout/{index.tsx → v1/index.tsx} +2 -2
- package/src/FormFieldLayout/{props.ts → v1/props.ts} +1 -1
- package/src/FormFieldLayout/{styles.ts → v1/styles.ts} +2 -2
- package/src/FormFieldLayout/v2/index.tsx +237 -0
- package/src/FormFieldLayout/v2/props.ts +157 -0
- package/src/FormFieldLayout/v2/styles.ts +209 -0
- package/src/FormFieldMessage/{index.tsx → v1/index.tsx} +1 -1
- package/src/FormFieldMessage/{props.ts → v1/props.ts} +4 -1
- package/src/FormFieldMessage/{styles.ts → v1/styles.ts} +2 -3
- package/src/FormFieldMessage/v2/index.tsx +104 -0
- package/src/FormFieldMessage/v2/props.ts +48 -0
- package/src/FormFieldMessage/v2/styles.ts +76 -0
- package/src/FormFieldMessages/{index.tsx → v1/index.tsx} +2 -2
- package/src/FormFieldMessages/{props.ts → v1/props.ts} +1 -1
- package/src/FormFieldMessages/v2/index.tsx +99 -0
- package/src/FormFieldMessages/v2/props.ts +59 -0
- package/src/FormFieldMessages/v2/styles.ts +55 -0
- package/src/{index.ts → exports/a.ts} +17 -13
- package/src/exports/b.ts +43 -0
- package/tsconfig.build.json +1 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/FormField/v1/index.d.ts.map +1 -0
- package/types/FormField/{props.d.ts → v1/props.d.ts} +1 -1
- package/types/FormField/v1/props.d.ts.map +1 -0
- package/types/FormField/v2/index.d.ts +23 -0
- package/types/FormField/v2/index.d.ts.map +1 -0
- package/types/FormField/v2/props.d.ts +57 -0
- package/types/FormField/v2/props.d.ts.map +1 -0
- package/types/FormFieldGroup/{index.d.ts → v1/index.d.ts} +1 -1
- package/types/FormFieldGroup/v1/index.d.ts.map +1 -0
- package/types/FormFieldGroup/{props.d.ts → v1/props.d.ts} +2 -2
- package/types/FormFieldGroup/v1/props.d.ts.map +1 -0
- package/types/FormFieldGroup/v1/styles.d.ts.map +1 -0
- package/types/FormFieldGroup/v1/theme.d.ts.map +1 -0
- package/types/FormFieldGroup/v2/index.d.ts +45 -0
- package/types/FormFieldGroup/v2/index.d.ts.map +1 -0
- package/types/FormFieldGroup/v2/props.d.ts +48 -0
- package/types/FormFieldGroup/v2/props.d.ts.map +1 -0
- package/types/FormFieldGroup/v2/styles.d.ts +14 -0
- package/types/FormFieldGroup/v2/styles.d.ts.map +1 -0
- package/types/FormFieldLabel/v1/index.d.ts.map +1 -0
- package/types/FormFieldLabel/v1/props.d.ts.map +1 -0
- package/types/FormFieldLabel/v1/styles.d.ts.map +1 -0
- package/types/FormFieldLabel/v1/theme.d.ts.map +1 -0
- package/types/FormFieldLabel/v2/index.d.ts +38 -0
- package/types/FormFieldLabel/v2/index.d.ts.map +1 -0
- package/types/FormFieldLabel/v2/props.d.ts +14 -0
- package/types/FormFieldLabel/v2/props.d.ts.map +1 -0
- package/types/FormFieldLabel/v2/styles.d.ts +15 -0
- package/types/FormFieldLabel/v2/styles.d.ts.map +1 -0
- package/types/FormFieldLabel/v2/theme.d.ts +10 -0
- package/types/FormFieldLabel/v2/theme.d.ts.map +1 -0
- package/types/FormFieldLayout/v1/index.d.ts.map +1 -0
- package/types/FormFieldLayout/{props.d.ts → v1/props.d.ts} +1 -1
- package/types/FormFieldLayout/v1/props.d.ts.map +1 -0
- package/types/FormFieldLayout/v1/styles.d.ts.map +1 -0
- package/types/FormFieldLayout/v1/theme.d.ts.map +1 -0
- package/types/FormFieldLayout/v2/index.d.ts +14 -0
- package/types/FormFieldLayout/v2/index.d.ts.map +1 -0
- package/types/FormFieldLayout/v2/props.d.ts +90 -0
- package/types/FormFieldLayout/v2/props.d.ts.map +1 -0
- package/types/FormFieldLayout/v2/styles.d.ts +25 -0
- package/types/FormFieldLayout/v2/styles.d.ts.map +1 -0
- package/types/FormFieldMessage/{index.d.ts → v1/index.d.ts} +2 -2
- package/types/FormFieldMessage/v1/index.d.ts.map +1 -0
- package/types/FormFieldMessage/{props.d.ts → v1/props.d.ts} +1 -1
- package/types/FormFieldMessage/v1/props.d.ts.map +1 -0
- package/types/FormFieldMessage/v1/styles.d.ts.map +1 -0
- package/types/FormFieldMessage/v1/theme.d.ts.map +1 -0
- package/types/FormFieldMessage/v2/index.d.ts +24 -0
- package/types/FormFieldMessage/v2/index.d.ts.map +1 -0
- package/types/FormFieldMessage/v2/props.d.ts +16 -0
- package/types/FormFieldMessage/v2/props.d.ts.map +1 -0
- package/types/FormFieldMessage/v2/styles.d.ts +18 -0
- package/types/FormFieldMessage/v2/styles.d.ts.map +1 -0
- package/types/FormFieldMessages/{index.d.ts → v1/index.d.ts} +1 -1
- package/types/FormFieldMessages/v1/index.d.ts.map +1 -0
- package/types/FormFieldMessages/{props.d.ts → v1/props.d.ts} +1 -1
- package/types/FormFieldMessages/v1/props.d.ts.map +1 -0
- package/types/FormFieldMessages/v1/styles.d.ts.map +1 -0
- package/types/FormFieldMessages/v1/theme.d.ts.map +1 -0
- package/types/FormFieldMessages/v2/index.d.ts +36 -0
- package/types/FormFieldMessages/v2/index.d.ts.map +1 -0
- package/types/FormFieldMessages/v2/props.d.ts +25 -0
- package/types/FormFieldMessages/v2/props.d.ts.map +1 -0
- package/types/FormFieldMessages/v2/styles.d.ts +14 -0
- package/types/FormFieldMessages/v2/styles.d.ts.map +1 -0
- package/types/exports/a.d.ts +14 -0
- package/types/exports/a.d.ts.map +1 -0
- package/types/exports/b.d.ts +14 -0
- package/types/exports/b.d.ts.map +1 -0
- package/types/utils/v1/FormPropTypes.d.ts.map +1 -0
- package/types/FormField/index.d.ts.map +0 -1
- package/types/FormField/props.d.ts.map +0 -1
- package/types/FormFieldGroup/index.d.ts.map +0 -1
- package/types/FormFieldGroup/props.d.ts.map +0 -1
- package/types/FormFieldGroup/styles.d.ts.map +0 -1
- package/types/FormFieldGroup/theme.d.ts.map +0 -1
- package/types/FormFieldLabel/index.d.ts.map +0 -1
- package/types/FormFieldLabel/props.d.ts.map +0 -1
- package/types/FormFieldLabel/styles.d.ts.map +0 -1
- package/types/FormFieldLabel/theme.d.ts.map +0 -1
- package/types/FormFieldLayout/index.d.ts.map +0 -1
- package/types/FormFieldLayout/props.d.ts.map +0 -1
- package/types/FormFieldLayout/styles.d.ts.map +0 -1
- package/types/FormFieldLayout/theme.d.ts.map +0 -1
- package/types/FormFieldMessage/index.d.ts.map +0 -1
- package/types/FormFieldMessage/props.d.ts.map +0 -1
- package/types/FormFieldMessage/styles.d.ts.map +0 -1
- package/types/FormFieldMessage/theme.d.ts.map +0 -1
- package/types/FormFieldMessages/index.d.ts.map +0 -1
- package/types/FormFieldMessages/props.d.ts.map +0 -1
- package/types/FormFieldMessages/styles.d.ts.map +0 -1
- package/types/FormFieldMessages/theme.d.ts.map +0 -1
- package/types/FormPropTypes.d.ts.map +0 -1
- package/types/index.d.ts +0 -14
- package/types/index.d.ts.map +0 -1
- /package/es/FormField/{props.js → v1/props.js} +0 -0
- /package/es/FormFieldGroup/{props.js → v1/props.js} +0 -0
- /package/es/FormFieldGroup/{styles.js → v1/styles.js} +0 -0
- /package/es/FormFieldGroup/{theme.js → v1/theme.js} +0 -0
- /package/es/FormFieldLabel/{props.js → v1/props.js} +0 -0
- /package/es/FormFieldLabel/{styles.js → v1/styles.js} +0 -0
- /package/es/FormFieldLabel/{theme.js → v1/theme.js} +0 -0
- /package/es/FormFieldLayout/{props.js → v1/props.js} +0 -0
- /package/es/FormFieldLayout/{theme.js → v1/theme.js} +0 -0
- /package/es/FormFieldMessage/{props.js → v1/props.js} +0 -0
- /package/es/FormFieldMessage/{styles.js → v1/styles.js} +0 -0
- /package/es/FormFieldMessage/{theme.js → v1/theme.js} +0 -0
- /package/es/FormFieldMessages/{props.js → v1/props.js} +0 -0
- /package/es/FormFieldMessages/{styles.js → v1/styles.js} +0 -0
- /package/es/FormFieldMessages/{theme.js → v1/theme.js} +0 -0
- /package/es/{FormPropTypes.js → utils/v1/FormPropTypes.js} +0 -0
- /package/lib/FormField/{props.js → v1/props.js} +0 -0
- /package/lib/FormFieldGroup/{props.js → v1/props.js} +0 -0
- /package/lib/FormFieldGroup/{styles.js → v1/styles.js} +0 -0
- /package/lib/FormFieldGroup/{theme.js → v1/theme.js} +0 -0
- /package/lib/FormFieldLabel/{props.js → v1/props.js} +0 -0
- /package/lib/FormFieldLabel/{styles.js → v1/styles.js} +0 -0
- /package/lib/FormFieldLabel/{theme.js → v1/theme.js} +0 -0
- /package/lib/FormFieldLayout/{props.js → v1/props.js} +0 -0
- /package/lib/FormFieldLayout/{theme.js → v1/theme.js} +0 -0
- /package/lib/FormFieldMessage/{props.js → v1/props.js} +0 -0
- /package/lib/FormFieldMessage/{styles.js → v1/styles.js} +0 -0
- /package/lib/FormFieldMessage/{theme.js → v1/theme.js} +0 -0
- /package/lib/FormFieldMessages/{props.js → v1/props.js} +0 -0
- /package/lib/FormFieldMessages/{styles.js → v1/styles.js} +0 -0
- /package/lib/FormFieldMessages/{theme.js → v1/theme.js} +0 -0
- /package/lib/{FormPropTypes.js → utils/v1/FormPropTypes.js} +0 -0
- /package/src/FormField/{README.md → v1/README.md} +0 -0
- /package/src/FormFieldGroup/{README.md → v1/README.md} +0 -0
- /package/src/FormFieldGroup/{styles.ts → v1/styles.ts} +0 -0
- /package/src/FormFieldGroup/{theme.ts → v1/theme.ts} +0 -0
- /package/src/FormFieldLabel/{props.ts → v1/props.ts} +0 -0
- /package/src/FormFieldLabel/{styles.ts → v1/styles.ts} +0 -0
- /package/src/FormFieldLabel/{theme.ts → v1/theme.ts} +0 -0
- /package/src/FormFieldLayout/{theme.ts → v1/theme.ts} +0 -0
- /package/src/FormFieldMessage/{theme.ts → v1/theme.ts} +0 -0
- /package/src/FormFieldMessages/{styles.ts → v1/styles.ts} +0 -0
- /package/src/FormFieldMessages/{theme.ts → v1/theme.ts} +0 -0
- /package/src/{FormPropTypes.ts → utils/v1/FormPropTypes.ts} +0 -0
- /package/types/FormField/{index.d.ts → v1/index.d.ts} +0 -0
- /package/types/FormFieldGroup/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/FormFieldGroup/{theme.d.ts → v1/theme.d.ts} +0 -0
- /package/types/FormFieldLabel/{index.d.ts → v1/index.d.ts} +0 -0
- /package/types/FormFieldLabel/{props.d.ts → v1/props.d.ts} +0 -0
- /package/types/FormFieldLabel/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/FormFieldLabel/{theme.d.ts → v1/theme.d.ts} +0 -0
- /package/types/FormFieldLayout/{index.d.ts → v1/index.d.ts} +0 -0
- /package/types/FormFieldLayout/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/FormFieldLayout/{theme.d.ts → v1/theme.d.ts} +0 -0
- /package/types/FormFieldMessage/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/FormFieldMessage/{theme.d.ts → v1/theme.d.ts} +0 -0
- /package/types/FormFieldMessages/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/FormFieldMessages/{theme.d.ts → v1/theme.d.ts} +0 -0
- /package/types/{FormPropTypes.d.ts → utils/v1/FormPropTypes.d.ts} +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
var _dec, _class, _FormFieldMessages;
|
|
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 } from '@instructure/ui-react-utils';
|
|
28
|
+
import { withStyle } from '@instructure/emotion';
|
|
29
|
+
import { FormFieldMessage } from "../../FormFieldMessage/v2/index.js";
|
|
30
|
+
import generateStyle from "./styles.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
|
+
A FormFieldMessages component
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
---
|
|
42
|
+
type: example
|
|
43
|
+
---
|
|
44
|
+
<FormFieldMessages messages={[
|
|
45
|
+
{ text: 'Invalid name', type: 'error' },
|
|
46
|
+
{ text: 'Good job!', type: 'success' },
|
|
47
|
+
{ text: 'Full name, first and last', type: 'hint' },
|
|
48
|
+
]} />
|
|
49
|
+
```
|
|
50
|
+
**/
|
|
51
|
+
let FormFieldMessages = (_dec = withStyle(generateStyle), _dec(_class = (_FormFieldMessages = class FormFieldMessages 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 _this$props3 = this.props,
|
|
69
|
+
messages = _this$props3.messages,
|
|
70
|
+
styles = _this$props3.styles;
|
|
71
|
+
return messages && messages.length > 0 ? _jsx("div", {
|
|
72
|
+
css: styles === null || styles === void 0 ? void 0 : styles.formFieldMessages,
|
|
73
|
+
...omitProps(this.props, FormFieldMessages.allowedProps),
|
|
74
|
+
ref: this.handleRef,
|
|
75
|
+
children: messages.map((msg, i) => {
|
|
76
|
+
return _jsx("span", {
|
|
77
|
+
css: styles === null || styles === void 0 ? void 0 : styles.message,
|
|
78
|
+
children: _jsx(FormFieldMessage, {
|
|
79
|
+
variant: msg.type,
|
|
80
|
+
children: msg.text
|
|
81
|
+
})
|
|
82
|
+
}, `error${i}`);
|
|
83
|
+
})
|
|
84
|
+
}) : null;
|
|
85
|
+
}
|
|
86
|
+
}, _FormFieldMessages.displayName = "FormFieldMessages", _FormFieldMessages.componentId = 'FormFieldMessages', _FormFieldMessages.allowedProps = allowedProps, _FormFieldMessages.defaultProps = {}, _FormFieldMessages)) || _class);
|
|
87
|
+
export default FormFieldMessages;
|
|
88
|
+
export { FormFieldMessages };
|
|
@@ -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 = ['messages', 'gridArea'];
|
|
26
|
+
export { allowedProps };
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
* @return {Object} The final style object, which will be used in the component
|
|
33
|
+
*/
|
|
34
|
+
const generateStyle = (_componentTheme, props) => {
|
|
35
|
+
return {
|
|
36
|
+
formFieldMessages: {
|
|
37
|
+
label: 'formFieldMessages',
|
|
38
|
+
padding: 0,
|
|
39
|
+
display: 'block',
|
|
40
|
+
...(props.gridArea && {
|
|
41
|
+
gridArea: props.gridArea
|
|
42
|
+
})
|
|
43
|
+
},
|
|
44
|
+
message: {
|
|
45
|
+
label: 'formFieldMessages__message',
|
|
46
|
+
display: 'block'
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export default generateStyle;
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
export { FormField } from "
|
|
25
|
-
export { FormFieldLabel } from "
|
|
26
|
-
export { FormFieldMessage } from "
|
|
27
|
-
export { FormFieldMessages } from "
|
|
28
|
-
export { FormFieldLayout } from "
|
|
29
|
-
export { FormFieldGroup } from "
|
|
24
|
+
export { FormField } from "../FormField/v1/index.js";
|
|
25
|
+
export { FormFieldLabel } from "../FormFieldLabel/v1/index.js";
|
|
26
|
+
export { FormFieldMessage } from "../FormFieldMessage/v1/index.js";
|
|
27
|
+
export { FormFieldMessages } from "../FormFieldMessages/v1/index.js";
|
|
28
|
+
export { FormFieldLayout } from "../FormFieldLayout/v1/index.js";
|
|
29
|
+
export { FormFieldGroup } from "../FormFieldGroup/v1/index.js";
|
package/es/exports/b.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
export { FormField } from "../FormField/v2/index.js";
|
|
25
|
+
export { FormFieldLabel } from "../FormFieldLabel/v2/index.js";
|
|
26
|
+
export { FormFieldMessage } from "../FormFieldMessage/v2/index.js";
|
|
27
|
+
export { FormFieldMessages } from "../FormFieldMessages/v2/index.js";
|
|
28
|
+
export { FormFieldLayout } from "../FormFieldLayout/v2/index.js";
|
|
29
|
+
export { FormFieldGroup } from "../FormFieldGroup/v2/index.js";
|
|
@@ -7,7 +7,7 @@ exports.default = exports.FormField = void 0;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
9
9
|
var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
|
|
10
|
-
var
|
|
10
|
+
var _v = require("../../FormFieldLayout/v1");
|
|
11
11
|
var _props = require("./props");
|
|
12
12
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
13
13
|
/*
|
|
@@ -52,9 +52,9 @@ class FormField extends _react.Component {
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
render() {
|
|
55
|
-
return (0, _jsxRuntime.jsx)(
|
|
55
|
+
return (0, _jsxRuntime.jsx)(_v.FormFieldLayout, {
|
|
56
56
|
...(0, _omitProps.omitProps)(this.props, FormField.allowedProps),
|
|
57
|
-
...(0, _pickProps.pickProps)(this.props,
|
|
57
|
+
...(0, _pickProps.pickProps)(this.props, _v.FormFieldLayout.allowedProps),
|
|
58
58
|
label: this.props.label,
|
|
59
59
|
vAlign: this.props.vAlign,
|
|
60
60
|
as: "label"
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.FormField = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
9
|
+
var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
|
|
10
|
+
var _props = require("../../FormFieldLayout/v2/props");
|
|
11
|
+
var _v = require("../../FormFieldLayout/v2");
|
|
12
|
+
var _props2 = require("./props");
|
|
13
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
14
|
+
/*
|
|
15
|
+
* The MIT License (MIT)
|
|
16
|
+
*
|
|
17
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
18
|
+
*
|
|
19
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
20
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
21
|
+
* in the Software without restriction, including without limitation the rights
|
|
22
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
24
|
+
* furnished to do so, subject to the following conditions:
|
|
25
|
+
*
|
|
26
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
27
|
+
* copies or substantial portions of the Software.
|
|
28
|
+
*
|
|
29
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
30
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
31
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
32
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
33
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
34
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
|
+
* SOFTWARE.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
---
|
|
40
|
+
category: components
|
|
41
|
+
---
|
|
42
|
+
**/
|
|
43
|
+
class FormField extends _react.Component {
|
|
44
|
+
constructor(...args) {
|
|
45
|
+
super(...args);
|
|
46
|
+
this.ref = null;
|
|
47
|
+
this.handleRef = el => {
|
|
48
|
+
const elementRef = this.props.elementRef;
|
|
49
|
+
this.ref = el;
|
|
50
|
+
if (typeof elementRef === 'function') {
|
|
51
|
+
elementRef(el);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
render() {
|
|
56
|
+
return (0, _jsxRuntime.jsx)(_v.FormFieldLayout, {
|
|
57
|
+
...(0, _omitProps.omitProps)(this.props, FormField.allowedProps),
|
|
58
|
+
...(0, _pickProps.pickProps)(this.props, _props.allowedProps),
|
|
59
|
+
label: this.props.label,
|
|
60
|
+
vAlign: this.props.vAlign,
|
|
61
|
+
as: "label"
|
|
62
|
+
// This makes the control in focus when the label is clicked
|
|
63
|
+
// This is needed to prevent the wrong element to be focused, e.g.
|
|
64
|
+
// multi selects Tag-s
|
|
65
|
+
,
|
|
66
|
+
htmlFor: this.props.id,
|
|
67
|
+
elementRef: this.handleRef,
|
|
68
|
+
margin: this.props.margin,
|
|
69
|
+
isRequired: this.props.isRequired,
|
|
70
|
+
disabled: this.props.disabled,
|
|
71
|
+
readOnly: this.props.readOnly
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.FormField = FormField;
|
|
76
|
+
FormField.displayName = "FormField";
|
|
77
|
+
FormField.componentId = 'FormField';
|
|
78
|
+
FormField.allowedProps = _props2.allowedProps;
|
|
79
|
+
FormField.defaultProps = {
|
|
80
|
+
inline: false,
|
|
81
|
+
layout: 'stacked',
|
|
82
|
+
labelAlign: 'end',
|
|
83
|
+
vAlign: 'middle'
|
|
84
|
+
};
|
|
85
|
+
var _default = exports.default = FormField;
|
|
@@ -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', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'vAlign', 'width', 'inputContainerRef', 'elementRef', 'isRequired', 'margin', 'disabled', 'readOnly'];
|
|
@@ -7,14 +7,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.FormFieldGroup = void 0;
|
|
8
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
9
|
var _react = require("react");
|
|
10
|
-
var
|
|
10
|
+
var _v11_ = require("@instructure/ui-grid/v11_6");
|
|
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 _emotion = require("@instructure/emotion");
|
|
14
|
-
var
|
|
14
|
+
var _props = require("../../FormFieldLayout/v1/props");
|
|
15
|
+
var _v = require("../../FormFieldLayout/v1");
|
|
15
16
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
16
17
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
17
|
-
var
|
|
18
|
+
var _props2 = require("./props");
|
|
18
19
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
19
20
|
const _excluded = ["styles", "makeStyles", "isGroup"];
|
|
20
21
|
var _dec, _class, _FormFieldGroup;
|
|
@@ -46,7 +47,7 @@ var _dec, _class, _FormFieldGroup;
|
|
|
46
47
|
category: components
|
|
47
48
|
---
|
|
48
49
|
**/
|
|
49
|
-
let FormFieldGroup = exports.FormFieldGroup = (_dec = (0, _emotion.
|
|
50
|
+
let FormFieldGroup = exports.FormFieldGroup = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = (_FormFieldGroup = class FormFieldGroup extends _react.Component {
|
|
50
51
|
constructor(...args) {
|
|
51
52
|
super(...args);
|
|
52
53
|
this.ref = null;
|
|
@@ -82,19 +83,19 @@ let FormFieldGroup = exports.FormFieldGroup = (_dec = (0, _emotion.withStyle)(_s
|
|
|
82
83
|
}
|
|
83
84
|
renderColumns() {
|
|
84
85
|
return _react.Children.map(this.props.children, (child, index) => {
|
|
85
|
-
return child ? (0, _jsxRuntime.jsx)(
|
|
86
|
+
return child ? (0, _jsxRuntime.jsx)(_v11_.Grid.Col, {
|
|
86
87
|
width: child.props && child.props.width ? 'auto' : void 0,
|
|
87
88
|
children: child
|
|
88
89
|
}, index) : null;
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
92
|
renderChildren() {
|
|
92
|
-
return (0, _jsxRuntime.jsx)(
|
|
93
|
+
return (0, _jsxRuntime.jsx)(_v11_.Grid, {
|
|
93
94
|
colSpacing: this.props.colSpacing,
|
|
94
95
|
rowSpacing: this.props.rowSpacing,
|
|
95
96
|
vAlign: this.props.vAlign,
|
|
96
97
|
startAt: this.props.startAt || (this.props.layout === 'columns' ? 'medium' : null),
|
|
97
|
-
children: (0, _jsxRuntime.jsx)(
|
|
98
|
+
children: (0, _jsxRuntime.jsx)(_v11_.Grid.Row, {
|
|
98
99
|
children: this.renderColumns()
|
|
99
100
|
})
|
|
100
101
|
});
|
|
@@ -121,9 +122,9 @@ let FormFieldGroup = exports.FormFieldGroup = (_dec = (0, _emotion.withStyle)(_s
|
|
|
121
122
|
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)) {
|
|
122
123
|
ariaInvalid = 'true';
|
|
123
124
|
}
|
|
124
|
-
return (0, _jsxRuntime.jsx)(
|
|
125
|
+
return (0, _jsxRuntime.jsx)(_v.FormFieldLayout, {
|
|
125
126
|
...(0, _omitProps.omitProps)(props, FormFieldGroup.allowedProps),
|
|
126
|
-
...(0, _pickProps.pickProps)(props,
|
|
127
|
+
...(0, _pickProps.pickProps)(props, _props.allowedProps),
|
|
127
128
|
vAlign: props.vAlign,
|
|
128
129
|
layout: props.layout === 'inline' ? 'inline' : 'stacked',
|
|
129
130
|
label: props.description,
|
|
@@ -134,7 +135,7 @@ let FormFieldGroup = exports.FormFieldGroup = (_dec = (0, _emotion.withStyle)(_s
|
|
|
134
135
|
children: this.renderFields()
|
|
135
136
|
});
|
|
136
137
|
}
|
|
137
|
-
}, _FormFieldGroup.displayName = "FormFieldGroup", _FormFieldGroup.componentId = 'FormFieldGroup', _FormFieldGroup.allowedProps =
|
|
138
|
+
}, _FormFieldGroup.displayName = "FormFieldGroup", _FormFieldGroup.componentId = 'FormFieldGroup', _FormFieldGroup.allowedProps = _props2.allowedProps, _FormFieldGroup.defaultProps = {
|
|
138
139
|
as: 'fieldset',
|
|
139
140
|
disabled: false,
|
|
140
141
|
rowSpacing: 'medium',
|
|
@@ -0,0 +1,136 @@
|
|
|
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.FormFieldGroup = void 0;
|
|
8
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _latest = require("@instructure/ui-grid/latest");
|
|
11
|
+
var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
|
|
12
|
+
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
13
|
+
var _emotion = require("@instructure/emotion");
|
|
14
|
+
var _props = require("../../FormFieldLayout/v2/props");
|
|
15
|
+
var _v = require("../../FormFieldLayout/v2");
|
|
16
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
17
|
+
var _props2 = require("./props");
|
|
18
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
19
|
+
const _excluded = ["styles", "makeStyles", "isGroup"];
|
|
20
|
+
var _dec, _class, _FormFieldGroup;
|
|
21
|
+
/*
|
|
22
|
+
* The MIT License (MIT)
|
|
23
|
+
*
|
|
24
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
25
|
+
*
|
|
26
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
27
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
28
|
+
* in the Software without restriction, including without limitation the rights
|
|
29
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
30
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
31
|
+
* furnished to do so, subject to the following conditions:
|
|
32
|
+
*
|
|
33
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
34
|
+
* copies or substantial portions of the Software.
|
|
35
|
+
*
|
|
36
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
37
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
38
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
39
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
40
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
41
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
42
|
+
* SOFTWARE.
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
---
|
|
46
|
+
category: components
|
|
47
|
+
---
|
|
48
|
+
**/
|
|
49
|
+
let FormFieldGroup = exports.FormFieldGroup = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_class = (_FormFieldGroup = class FormFieldGroup extends _react.Component {
|
|
50
|
+
constructor(...args) {
|
|
51
|
+
super(...args);
|
|
52
|
+
this.ref = null;
|
|
53
|
+
this.handleRef = el => {
|
|
54
|
+
const elementRef = this.props.elementRef;
|
|
55
|
+
this.ref = el;
|
|
56
|
+
if (typeof elementRef === 'function') {
|
|
57
|
+
elementRef(el);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
componentDidMount() {
|
|
62
|
+
var _this$props$makeStyle, _this$props;
|
|
63
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
64
|
+
}
|
|
65
|
+
componentDidUpdate() {
|
|
66
|
+
var _this$props$makeStyle2, _this$props2;
|
|
67
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
68
|
+
}
|
|
69
|
+
get invalid() {
|
|
70
|
+
return !!this.props.messages && this.props.messages.findIndex(message => {
|
|
71
|
+
return message.type === 'error' || message.type === 'newError';
|
|
72
|
+
}) >= 0;
|
|
73
|
+
}
|
|
74
|
+
renderColumns() {
|
|
75
|
+
return _react.Children.map(this.props.children, (child, index) => {
|
|
76
|
+
return child ? (0, _jsxRuntime.jsx)(_latest.Grid.Col, {
|
|
77
|
+
width: child.props && child.props.width ? 'auto' : void 0,
|
|
78
|
+
children: child
|
|
79
|
+
}, index) : null;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
renderChildren() {
|
|
83
|
+
return (0, _jsxRuntime.jsx)(_latest.Grid, {
|
|
84
|
+
colSpacing: this.props.colSpacing,
|
|
85
|
+
rowSpacing: this.props.rowSpacing,
|
|
86
|
+
vAlign: this.props.vAlign,
|
|
87
|
+
startAt: this.props.startAt || (this.props.layout === 'columns' ? 'medium' : null),
|
|
88
|
+
children: (0, _jsxRuntime.jsx)(_latest.Grid.Row, {
|
|
89
|
+
children: this.renderColumns()
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
renderFields() {
|
|
94
|
+
const styles = this.props.styles;
|
|
95
|
+
return (0, _jsxRuntime.jsx)("span", {
|
|
96
|
+
css: styles === null || styles === void 0 ? void 0 : styles.formFieldGroup,
|
|
97
|
+
children: this.renderChildren()
|
|
98
|
+
}, "fields");
|
|
99
|
+
}
|
|
100
|
+
render() {
|
|
101
|
+
const _this$props3 = this.props,
|
|
102
|
+
styles = _this$props3.styles,
|
|
103
|
+
makeStyles = _this$props3.makeStyles,
|
|
104
|
+
isGroup = _this$props3.isGroup,
|
|
105
|
+
props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
106
|
+
// This is quite ugly, but according to ARIA spec the `aria-invalid` prop
|
|
107
|
+
// can only be used with certain roles see
|
|
108
|
+
// https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-invalid#associated_roles
|
|
109
|
+
// `aria-invalid` is put on in FormFieldLayout because the error message
|
|
110
|
+
// DOM part gets there its ID.
|
|
111
|
+
let ariaInvalid = void 0;
|
|
112
|
+
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)) {
|
|
113
|
+
ariaInvalid = 'true';
|
|
114
|
+
}
|
|
115
|
+
return (0, _jsxRuntime.jsx)(_v.FormFieldLayout, {
|
|
116
|
+
...(0, _omitProps.omitProps)(props, FormFieldGroup.allowedProps),
|
|
117
|
+
...(0, _pickProps.pickProps)(props, _props.allowedProps),
|
|
118
|
+
vAlign: props.vAlign,
|
|
119
|
+
layout: props.layout === 'inline' ? 'inline' : 'stacked',
|
|
120
|
+
label: props.description,
|
|
121
|
+
"aria-disabled": props.disabled ? 'true' : void 0,
|
|
122
|
+
"aria-invalid": ariaInvalid,
|
|
123
|
+
elementRef: this.handleRef,
|
|
124
|
+
isGroup: isGroup,
|
|
125
|
+
children: this.renderFields()
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}, _FormFieldGroup.displayName = "FormFieldGroup", _FormFieldGroup.componentId = 'FormFieldGroup', _FormFieldGroup.allowedProps = _props2.allowedProps, _FormFieldGroup.defaultProps = {
|
|
129
|
+
as: 'fieldset',
|
|
130
|
+
disabled: false,
|
|
131
|
+
rowSpacing: 'medium',
|
|
132
|
+
colSpacing: 'small',
|
|
133
|
+
vAlign: 'middle',
|
|
134
|
+
isGroup: true
|
|
135
|
+
}, _FormFieldGroup)) || _class);
|
|
136
|
+
var _default = exports.default = FormFieldGroup;
|
|
@@ -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 = ['description', 'as', 'messages', 'messagesId', 'disabled', 'readOnly', 'children', 'layout', 'rowSpacing', 'colSpacing', 'vAlign', 'startAt', 'elementRef'];
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
* ---
|
|
33
|
+
* private: true
|
|
34
|
+
* ---
|
|
35
|
+
* Generates the style object from the theme and provided additional information
|
|
36
|
+
* @param {Object} componentTheme The theme variable object.
|
|
37
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
38
|
+
* @param {Object} state the state of the component, the style is applied to
|
|
39
|
+
* @return {Object} The final style object, which will be used in the component
|
|
40
|
+
*/
|
|
41
|
+
const generateStyle = (_componentTheme, props) => {
|
|
42
|
+
const disabled = props.disabled;
|
|
43
|
+
return {
|
|
44
|
+
formFieldGroup: {
|
|
45
|
+
label: 'formFieldGroup',
|
|
46
|
+
display: 'block',
|
|
47
|
+
...(disabled && {
|
|
48
|
+
opacity: 0.6,
|
|
49
|
+
cursor: 'not-allowed',
|
|
50
|
+
pointerEvents: 'none'
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
var _default = exports.default = generateStyle;
|
|
@@ -55,7 +55,7 @@ type: example
|
|
|
55
55
|
@deprecated since version 10. This is an internal component that will be
|
|
56
56
|
removed in the future
|
|
57
57
|
**/
|
|
58
|
-
let FormFieldLabel = exports.FormFieldLabel = (_dec = (0, _emotion.
|
|
58
|
+
let FormFieldLabel = exports.FormFieldLabel = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = (_FormFieldLabel = class FormFieldLabel extends _react.Component {
|
|
59
59
|
constructor(...args) {
|
|
60
60
|
super(...args);
|
|
61
61
|
this.ref = null;
|