@openedx/paragon 22.11.0 → 22.11.2
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/dist/Form/FormGroup.d.ts +41 -0
- package/dist/Form/FormGroup.js +3 -11
- package/dist/Form/FormGroup.js.map +1 -1
- package/dist/Form/FormGroupContext.d.ts +24 -0
- package/dist/Form/FormGroupContext.js +2 -17
- package/dist/Form/FormGroupContext.js.map +1 -1
- package/dist/Form/FormLabel.d.ts +20 -0
- package/dist/Form/FormLabel.js +2 -10
- package/dist/Form/FormLabel.js.map +1 -1
- package/dist/Form/constants.d.ts +13 -0
- package/dist/Form/constants.js +5 -8
- package/dist/Form/constants.js.map +1 -0
- package/dist/Form/fieldUtils.d.ts +9 -0
- package/dist/Form/fieldUtils.js +27 -29
- package/dist/Form/fieldUtils.js.map +1 -0
- package/dist/Form/index.d.ts +39 -0
- package/dist/Form/index.js +18 -1
- package/dist/Form/index.js.map +1 -1
- package/dist/Form/messages.d.ts +13 -0
- package/dist/Form/messages.js +4 -5
- package/dist/Form/messages.js.map +1 -0
- package/dist/IconButton/index.d.ts +3 -0
- package/dist/IconButton/index.js +4 -1
- package/dist/IconButton/index.js.map +1 -1
- package/dist/index.d.ts +22 -22
- package/dist/index.js +22 -22
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/newId.d.ts +2 -0
- package/dist/utils/newId.js +3 -3
- package/dist/utils/newId.js.map +1 -0
- package/dist/utils/propTypes/utils.js +1 -1
- package/package.json +1 -1
- package/src/Collapsible/README.md +2 -2
- package/src/DataTable/README.md +2 -2
- package/src/Dropdown/README.md +1 -1
- package/src/Dropzone/README.md +1 -1
- package/src/Form/{FormGroup.jsx → FormGroup.tsx} +24 -14
- package/src/Form/{FormGroupContext.jsx → FormGroupContext.tsx} +29 -27
- package/src/Form/{FormLabel.jsx → FormLabel.tsx} +8 -11
- package/src/Form/{constants.js → constants.ts} +4 -7
- package/src/Form/{fieldUtils.js → fieldUtils.ts} +14 -11
- package/src/Form/form-control.mdx +4 -6
- package/src/Form/{index.jsx → index.tsx} +33 -1
- package/src/IconButton/index.tsx +5 -0
- package/src/InputSelect/README.md +2 -3
- package/src/InputText/README.md +4 -6
- package/src/ListBox/README.md +1 -1
- package/src/Modal/standard-modal.mdx +1 -1
- package/src/TextArea/README.md +2 -3
- package/src/index.d.ts +22 -22
- package/src/index.js +22 -22
- package/src/utils/propTypes/utils.js +1 -1
- /package/src/Form/{messages.js → messages.ts} +0 -0
- /package/src/utils/{index.js → index.ts} +0 -0
- /package/src/utils/{newId.js → newId.ts} +0 -0
|
@@ -1,22 +1,54 @@
|
|
|
1
|
-
import
|
|
1
|
+
import BootstrapForm, { FormProps } from 'react-bootstrap/Form';
|
|
2
|
+
import { ComponentWithAsProp } from '../utils/types/bootstrap';
|
|
3
|
+
// TODO: add more typing and remove the @ts-ignore directives here
|
|
4
|
+
// @ts-ignore
|
|
2
5
|
import FormControl from './FormControl';
|
|
3
6
|
import FormLabel from './FormLabel';
|
|
4
7
|
import FormGroup from './FormGroup';
|
|
8
|
+
// @ts-ignore
|
|
5
9
|
import FormControlFeedback from './FormControlFeedback';
|
|
10
|
+
// @ts-ignore
|
|
6
11
|
import FormText from './FormText';
|
|
12
|
+
// @ts-ignore
|
|
7
13
|
import FormControlDecoratorGroup from './FormControlDecoratorGroup';
|
|
14
|
+
// @ts-ignore
|
|
8
15
|
import FormRadio, { RadioControl } from './FormRadio';
|
|
16
|
+
// @ts-ignore
|
|
9
17
|
import FormRadioSet from './FormRadioSet';
|
|
18
|
+
// @ts-ignore
|
|
10
19
|
import FormRadioSetContext from './FormRadioSetContext';
|
|
20
|
+
// @ts-ignore
|
|
11
21
|
import FormAutosuggest from './FormAutosuggest';
|
|
22
|
+
// @ts-ignore
|
|
12
23
|
import FormAutosuggestOption from './FormAutosuggestOption';
|
|
24
|
+
// @ts-ignore
|
|
13
25
|
import FormCheckbox, { CheckboxControl } from './FormCheckbox';
|
|
26
|
+
// @ts-ignore
|
|
14
27
|
import FormSwitch, { SwitchControl } from './FormSwitch';
|
|
28
|
+
// @ts-ignore
|
|
15
29
|
import FormCheckboxSet from './FormCheckboxSet';
|
|
30
|
+
// @ts-ignore
|
|
16
31
|
import FormSwitchSet from './FormSwitchSet';
|
|
32
|
+
// @ts-ignore
|
|
17
33
|
import FormCheckboxSetContext from './FormCheckboxSetContext';
|
|
34
|
+
// @ts-ignore
|
|
18
35
|
import useCheckboxSetValues from './useCheckboxSetValues';
|
|
19
36
|
|
|
37
|
+
const Form = BootstrapForm as any as ComponentWithAsProp<'form', FormProps> & {
|
|
38
|
+
Control: typeof FormControl;
|
|
39
|
+
Radio: typeof FormRadio;
|
|
40
|
+
RadioSet: typeof FormRadioSet;
|
|
41
|
+
Autosuggest: typeof FormAutosuggest;
|
|
42
|
+
AutosuggestOption: typeof FormAutosuggestOption;
|
|
43
|
+
Checkbox: typeof FormCheckbox;
|
|
44
|
+
CheckboxSet: typeof FormCheckboxSet;
|
|
45
|
+
Row: typeof BootstrapForm.Row;
|
|
46
|
+
Switch: typeof FormSwitch;
|
|
47
|
+
SwitchSet: typeof FormSwitchSet;
|
|
48
|
+
Label: typeof FormLabel;
|
|
49
|
+
Group: typeof FormGroup;
|
|
50
|
+
Text: typeof FormText;
|
|
51
|
+
};
|
|
20
52
|
Form.Control = FormControl;
|
|
21
53
|
Form.Radio = FormRadio;
|
|
22
54
|
Form.RadioSet = FormRadioSet;
|
package/src/IconButton/index.tsx
CHANGED
|
@@ -36,6 +36,8 @@ interface Props extends React.HTMLAttributes<HTMLButtonElement> {
|
|
|
36
36
|
variant?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'light' | 'dark' | 'black' | 'brand';
|
|
37
37
|
/** size of button to render */
|
|
38
38
|
size?: 'sm' | 'md' | 'inline';
|
|
39
|
+
/** Used with `IconButtonToggle` */
|
|
40
|
+
value?: string;
|
|
39
41
|
/** no children */
|
|
40
42
|
children?: never;
|
|
41
43
|
}
|
|
@@ -104,6 +106,7 @@ IconButton.defaultProps = {
|
|
|
104
106
|
size: 'md',
|
|
105
107
|
onClick: () => {},
|
|
106
108
|
isActive: false,
|
|
109
|
+
value: undefined,
|
|
107
110
|
children: undefined,
|
|
108
111
|
};
|
|
109
112
|
|
|
@@ -140,6 +143,8 @@ IconButton.propTypes = {
|
|
|
140
143
|
size: PropTypes.oneOf(['sm', 'md', 'inline']),
|
|
141
144
|
/** whether to show the `IconButton` in an active state, whose styling is distinct from default state */
|
|
142
145
|
isActive: PropTypes.bool,
|
|
146
|
+
/** Used with `IconButtonToggle` */
|
|
147
|
+
value: PropTypes.string,
|
|
143
148
|
};
|
|
144
149
|
|
|
145
150
|
interface PropsWithTooltip extends Props {
|
|
@@ -90,14 +90,13 @@ notes: |
|
|
|
90
90
|
label="Favorite Color"
|
|
91
91
|
options={['', 'red', 'orange', 'yellow', 'green', 'blue', 'purple']}
|
|
92
92
|
validator={value => {
|
|
93
|
-
let feedback = { isValid: true };
|
|
94
93
|
if (!value) {
|
|
95
|
-
|
|
94
|
+
return {
|
|
96
95
|
isValid: false,
|
|
97
96
|
validationMessage: 'Please make a selection.',
|
|
98
97
|
};
|
|
99
98
|
}
|
|
100
|
-
return
|
|
99
|
+
return { isValid: true };
|
|
101
100
|
}}
|
|
102
101
|
/>
|
|
103
102
|
```
|
package/src/InputText/README.md
CHANGED
|
@@ -33,14 +33,13 @@ notes: |
|
|
|
33
33
|
label="Username"
|
|
34
34
|
description="The unique name that identifies you throughout the site."
|
|
35
35
|
validator={value => {
|
|
36
|
-
let feedback = { isValid: true };
|
|
37
36
|
if (value.length < 3) {
|
|
38
|
-
|
|
37
|
+
return {
|
|
39
38
|
isValid: false,
|
|
40
39
|
validationMessage: 'Username must be at least 3 characters in length.',
|
|
41
40
|
};
|
|
42
41
|
}
|
|
43
|
-
return
|
|
42
|
+
return { isValid: true };
|
|
44
43
|
}}
|
|
45
44
|
/>
|
|
46
45
|
```
|
|
@@ -53,15 +52,14 @@ notes: |
|
|
|
53
52
|
label="Username"
|
|
54
53
|
description="The unique name that identifies you throughout the site."
|
|
55
54
|
validator={value => {
|
|
56
|
-
let feedback = { isValid: true };
|
|
57
55
|
if (value.length < 3) {
|
|
58
|
-
|
|
56
|
+
return {
|
|
59
57
|
isValid: false,
|
|
60
58
|
validationMessage: 'Username must be at least 3 characters in length.',
|
|
61
59
|
dangerIconDescription: 'Error',
|
|
62
60
|
};
|
|
63
61
|
}
|
|
64
|
-
return
|
|
62
|
+
return { isValid: true };
|
|
65
63
|
}}
|
|
66
64
|
themes={['danger']}
|
|
67
65
|
/>
|
package/src/ListBox/README.md
CHANGED
|
@@ -31,7 +31,7 @@ The standard `ModalDialog` composition. `StandardModal` passes all of its props
|
|
|
31
31
|
footerNode={(
|
|
32
32
|
<ActionRow>
|
|
33
33
|
<p className="small">
|
|
34
|
-
<Hyperlink
|
|
34
|
+
<Hyperlink destination="#">Get help</Hyperlink>
|
|
35
35
|
</p>
|
|
36
36
|
<ActionRow.Spacer />
|
|
37
37
|
<Button variant="tertiary" onClick={close}>Cancel</Button>
|
package/src/TextArea/README.md
CHANGED
|
@@ -40,14 +40,13 @@ notes: |
|
|
|
40
40
|
label="Username"
|
|
41
41
|
description="The unique name that identifies you throughout the site."
|
|
42
42
|
validator={value => {
|
|
43
|
-
let feedback = { isValid: true };
|
|
44
43
|
if (value.length < 3) {
|
|
45
|
-
|
|
44
|
+
return {
|
|
46
45
|
isValid: false,
|
|
47
46
|
validationMessage: 'Username must be at least 3 characters in length.',
|
|
48
47
|
};
|
|
49
48
|
}
|
|
50
|
-
return
|
|
49
|
+
return { isValid: true };
|
|
51
50
|
}}
|
|
52
51
|
/>
|
|
53
52
|
```
|
package/src/index.d.ts
CHANGED
|
@@ -9,6 +9,28 @@ export { default as Button, ButtonGroup, ButtonToolbar } from './Button';
|
|
|
9
9
|
export { default as Chip, CHIP_PGN_CLASS } from './Chip';
|
|
10
10
|
export { default as ChipCarousel } from './ChipCarousel';
|
|
11
11
|
export { default as Container, ContainerSize } from './Container';
|
|
12
|
+
export {
|
|
13
|
+
default as Form,
|
|
14
|
+
RadioControl,
|
|
15
|
+
CheckboxControl,
|
|
16
|
+
SwitchControl,
|
|
17
|
+
FormSwitchSet,
|
|
18
|
+
FormControl,
|
|
19
|
+
FormControlDecoratorGroup,
|
|
20
|
+
FormControlFeedback,
|
|
21
|
+
FormCheck,
|
|
22
|
+
FormFile,
|
|
23
|
+
FormRadio,
|
|
24
|
+
FormRadioSet,
|
|
25
|
+
FormRadioSetContext,
|
|
26
|
+
FormGroup,
|
|
27
|
+
FormLabel,
|
|
28
|
+
useCheckboxSetValues,
|
|
29
|
+
FormText,
|
|
30
|
+
FormAutosuggest,
|
|
31
|
+
FormAutosuggestOption,
|
|
32
|
+
InputGroup,
|
|
33
|
+
} from './Form';
|
|
12
34
|
export { default as Hyperlink, HYPER_LINK_EXTERNAL_LINK_ALT_TEXT, HYPER_LINK_EXTERNAL_LINK_TITLE } from './Hyperlink';
|
|
13
35
|
export { default as Icon } from './Icon';
|
|
14
36
|
export { default as IconButton, IconButtonWithTooltip } from './IconButton';
|
|
@@ -61,28 +83,6 @@ export const
|
|
|
61
83
|
export const Fade: any; // from './Fade';
|
|
62
84
|
/** @deprecated */
|
|
63
85
|
export const Fieldset: any; // from './Fieldset';
|
|
64
|
-
export const
|
|
65
|
-
Form: any,
|
|
66
|
-
RadioControl: any,
|
|
67
|
-
CheckboxControl: any,
|
|
68
|
-
SwitchControl: any,
|
|
69
|
-
FormSwitchSet: any,
|
|
70
|
-
FormControl: any,
|
|
71
|
-
FormControlDecoratorGroup: any,
|
|
72
|
-
FormControlFeedback: any,
|
|
73
|
-
FormCheck: any,
|
|
74
|
-
FormFile: any,
|
|
75
|
-
FormRadio: any,
|
|
76
|
-
FormRadioSet: any,
|
|
77
|
-
FormRadioSetContext: any,
|
|
78
|
-
FormGroup: any,
|
|
79
|
-
FormLabel: any,
|
|
80
|
-
useCheckboxSetValues: any,
|
|
81
|
-
FormText: any,
|
|
82
|
-
FormAutosuggest: any,
|
|
83
|
-
FormAutosuggestOption: any,
|
|
84
|
-
InputGroup: any;
|
|
85
|
-
// from './Form';
|
|
86
86
|
export const IconButtonToggle: any; // from './IconButtonToggle';
|
|
87
87
|
/** @deprecated Replaced by `Form.Control`. */
|
|
88
88
|
export const Input: any; // from './Input';
|
package/src/index.js
CHANGED
|
@@ -9,6 +9,28 @@ export { default as Button, ButtonGroup, ButtonToolbar } from './Button';
|
|
|
9
9
|
export { default as Chip, CHIP_PGN_CLASS } from './Chip';
|
|
10
10
|
export { default as ChipCarousel } from './ChipCarousel';
|
|
11
11
|
export { default as Container } from './Container';
|
|
12
|
+
export {
|
|
13
|
+
default as Form,
|
|
14
|
+
RadioControl,
|
|
15
|
+
CheckboxControl,
|
|
16
|
+
SwitchControl,
|
|
17
|
+
FormSwitchSet,
|
|
18
|
+
FormControl,
|
|
19
|
+
FormControlDecoratorGroup,
|
|
20
|
+
FormControlFeedback,
|
|
21
|
+
FormCheck,
|
|
22
|
+
FormFile,
|
|
23
|
+
FormRadio,
|
|
24
|
+
FormRadioSet,
|
|
25
|
+
FormRadioSetContext,
|
|
26
|
+
FormGroup,
|
|
27
|
+
FormLabel,
|
|
28
|
+
useCheckboxSetValues,
|
|
29
|
+
FormText,
|
|
30
|
+
FormAutosuggest,
|
|
31
|
+
FormAutosuggestOption,
|
|
32
|
+
InputGroup,
|
|
33
|
+
} from './Form';
|
|
12
34
|
export { default as Hyperlink, HYPER_LINK_EXTERNAL_LINK_ALT_TEXT, HYPER_LINK_EXTERNAL_LINK_TITLE } from './Hyperlink';
|
|
13
35
|
export { default as Icon } from './Icon';
|
|
14
36
|
export { default as IconButton, IconButtonWithTooltip } from './IconButton';
|
|
@@ -61,28 +83,6 @@ export {
|
|
|
61
83
|
export { default as Fade } from './Fade';
|
|
62
84
|
/** @deprecated */
|
|
63
85
|
export { default as Fieldset } from './Fieldset';
|
|
64
|
-
export {
|
|
65
|
-
default as Form,
|
|
66
|
-
RadioControl,
|
|
67
|
-
CheckboxControl,
|
|
68
|
-
SwitchControl,
|
|
69
|
-
FormSwitchSet,
|
|
70
|
-
FormControl,
|
|
71
|
-
FormControlDecoratorGroup,
|
|
72
|
-
FormControlFeedback,
|
|
73
|
-
FormCheck,
|
|
74
|
-
FormFile,
|
|
75
|
-
FormRadio,
|
|
76
|
-
FormRadioSet,
|
|
77
|
-
FormRadioSetContext,
|
|
78
|
-
FormGroup,
|
|
79
|
-
FormLabel,
|
|
80
|
-
useCheckboxSetValues,
|
|
81
|
-
FormText,
|
|
82
|
-
FormAutosuggest,
|
|
83
|
-
FormAutosuggestOption,
|
|
84
|
-
InputGroup,
|
|
85
|
-
} from './Form';
|
|
86
86
|
export { default as IconButtonToggle } from './IconButtonToggle';
|
|
87
87
|
/** @deprecated Replaced by `Form.Control`. */
|
|
88
88
|
export { default as Input } from './Input';
|
|
@@ -36,7 +36,7 @@ export const isEveryPropDefined = (props, otherPropNames) => otherPropNames
|
|
|
36
36
|
* Returns a PropType entry with the given propType that is required if otherPropName
|
|
37
37
|
* is truthy.
|
|
38
38
|
* @param {func} propType - target PropType
|
|
39
|
-
* @param {string} otherPropName - string name for prop that, if true, marks the
|
|
39
|
+
* @param {string | string[]} otherPropName - string name for prop that, if true, marks the
|
|
40
40
|
* associated prop as required
|
|
41
41
|
* @return {func} - PropType based on propType that is required if otherPropName is
|
|
42
42
|
* set to true.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|