rsuite 6.0.0-canary-20250319 → 6.0.0-canary-20250320
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/Form/styles/index.css +0 -13
- package/Form/styles/index.less +0 -16
- package/FormControl/styles/index.css +10 -15
- package/FormControl/styles/index.less +11 -13
- package/FormControlLabel/styles/index.css +1 -1
- package/FormControlLabel/styles/index.less +1 -1
- package/FormGroup/styles/index.css +14 -20
- package/FormGroup/styles/index.less +15 -4
- package/FormStack/package.json +7 -0
- package/FormStack/styles/index.css +27 -0
- package/FormStack/styles/index.less +15 -0
- package/cjs/CustomProvider/types.d.ts +2 -0
- package/cjs/Form/Form.d.ts +10 -1
- package/cjs/Form/Form.js +32 -21
- package/cjs/FormControl/FormControl.d.ts +3 -2
- package/cjs/FormControl/FormControl.js +4 -2
- package/cjs/FormControlLabel/FormControlLabel.d.ts +2 -2
- package/cjs/FormControlLabel/FormControlLabel.js +4 -2
- package/cjs/FormErrorMessage/FormErrorMessage.d.ts +3 -2
- package/cjs/FormErrorMessage/FormErrorMessage.js +4 -2
- package/cjs/FormGroup/FormGroup.d.ts +2 -2
- package/cjs/FormGroup/FormGroup.js +5 -2
- package/cjs/FormHelpText/FormHelpText.d.ts +2 -2
- package/cjs/FormHelpText/FormHelpText.js +6 -3
- package/cjs/FormStack/FormStack.d.ts +27 -0
- package/cjs/FormStack/FormStack.js +50 -0
- package/cjs/FormStack/index.d.ts +4 -0
- package/cjs/FormStack/index.js +11 -0
- package/cjs/Schema/Schema.d.ts +1 -0
- package/cjs/Schema/Schema.js +8 -0
- package/cjs/Stack/Stack.d.ts +3 -2
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +6 -0
- package/dist/rsuite-no-reset-rtl.css +76 -76
- package/dist/rsuite-no-reset-rtl.min.css +1 -1
- package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
- package/dist/rsuite-no-reset.css +76 -76
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite-no-reset.min.css.map +1 -1
- package/dist/rsuite-rtl.css +76 -76
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +76 -76
- package/dist/rsuite.js +30 -19
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.css.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/CustomProvider/types.d.ts +2 -0
- package/esm/Form/Form.d.ts +10 -1
- package/esm/Form/Form.js +30 -21
- package/esm/FormControl/FormControl.d.ts +3 -2
- package/esm/FormControl/FormControl.js +4 -2
- package/esm/FormControlLabel/FormControlLabel.d.ts +2 -2
- package/esm/FormControlLabel/FormControlLabel.js +4 -2
- package/esm/FormErrorMessage/FormErrorMessage.d.ts +3 -2
- package/esm/FormErrorMessage/FormErrorMessage.js +4 -2
- package/esm/FormGroup/FormGroup.d.ts +2 -2
- package/esm/FormGroup/FormGroup.js +5 -2
- package/esm/FormHelpText/FormHelpText.d.ts +2 -2
- package/esm/FormHelpText/FormHelpText.js +6 -3
- package/esm/FormStack/FormStack.d.ts +27 -0
- package/esm/FormStack/FormStack.js +45 -0
- package/esm/FormStack/index.d.ts +4 -0
- package/esm/FormStack/index.js +8 -0
- package/esm/Schema/Schema.d.ts +1 -0
- package/esm/Schema/Schema.js +1 -0
- package/esm/Stack/Stack.d.ts +3 -2
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/package.json +1 -1
- package/styles/index.less +4 -3
|
@@ -42,6 +42,7 @@ import type { FormControlLabelProps } from '../FormControlLabel';
|
|
|
42
42
|
import type { FormErrorMessageProps } from '../FormErrorMessage';
|
|
43
43
|
import type { FormGroupProps } from '../FormGroup';
|
|
44
44
|
import type { FormHelpTextProps } from '../FormHelpText';
|
|
45
|
+
import type { FormStackProps } from '../FormStack';
|
|
45
46
|
import type { GridProps } from '../Grid';
|
|
46
47
|
import type { HeaderProps } from '../Header';
|
|
47
48
|
import type { HeadingProps } from '../Heading';
|
|
@@ -155,6 +156,7 @@ export interface ReactSuiteComponents {
|
|
|
155
156
|
FormErrorMessage: ComponentProps<FormErrorMessageProps>;
|
|
156
157
|
FormGroup: ComponentProps<FormGroupProps>;
|
|
157
158
|
FormHelpText: ComponentProps<FormHelpTextProps>;
|
|
159
|
+
FormStack: ComponentProps<FormStackProps>;
|
|
158
160
|
Grid: ComponentProps<GridProps>;
|
|
159
161
|
Header: ComponentProps<HeaderProps>;
|
|
160
162
|
Heading: ComponentProps<HeadingProps>;
|
package/esm/Form/Form.d.ts
CHANGED
|
@@ -102,10 +102,19 @@ declare const Form: import("../internals/types").InternalRefForwardingComponent<
|
|
|
102
102
|
[x: string]: string | undefined;
|
|
103
103
|
}>> | undefined;
|
|
104
104
|
}, never> & {
|
|
105
|
+
Stack: import("../internals/types").InternalRefForwardingComponent<"span", import("../FormStack").FormStackProps, never> & Record<string, never>;
|
|
105
106
|
Control: FormControlComponent;
|
|
106
|
-
|
|
107
|
+
Label: import("../internals/types").InternalRefForwardingComponent<"label", import("../FormControlLabel").FormControlLabelProps, never> & Record<string, never>;
|
|
107
108
|
ErrorMessage: import("../internals/types").InternalRefForwardingComponent<"div", import("../FormErrorMessage").FormErrorMessageProps, never> & Record<string, never>;
|
|
108
109
|
Group: import("../internals/types").InternalRefForwardingComponent<"div", import("../FormGroup").FormGroupProps, never> & Record<string, never>;
|
|
110
|
+
Text: import("../internals/types").InternalRefForwardingComponent<"span", import("../FormHelpText").FormHelpTextProps, never> & Record<string, never>;
|
|
111
|
+
/**
|
|
112
|
+
* @deprecated Use `Form.Label` instead
|
|
113
|
+
*/
|
|
114
|
+
ControlLabel: import("../internals/types").InternalRefForwardingComponent<"label", import("../FormControlLabel").FormControlLabelProps, never> & Record<string, never>;
|
|
115
|
+
/**
|
|
116
|
+
* @deprecated Use `Form.Text` instead
|
|
117
|
+
*/
|
|
109
118
|
HelpText: import("../internals/types").InternalRefForwardingComponent<"span", import("../FormHelpText").FormHelpTextProps, never> & Record<string, never>;
|
|
110
119
|
};
|
|
111
120
|
export default Form;
|
package/esm/Form/Form.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
4
|
import FormControl from "../FormControl/index.js";
|
|
5
5
|
import FormControlLabel from "../FormControlLabel/index.js";
|
|
6
6
|
import FormErrorMessage from "../FormErrorMessage/index.js";
|
|
7
7
|
import FormGroup from "../FormGroup/index.js";
|
|
8
8
|
import FormHelpText from "../FormHelpText/index.js";
|
|
9
|
+
import FormStack from "../FormStack/index.js";
|
|
10
|
+
import Box from "../internals/Box/index.js";
|
|
9
11
|
import useSchemaModel from "./hooks/useSchemaModel.js";
|
|
10
12
|
import useFormValidate from "./hooks/useFormValidate.js";
|
|
11
13
|
import useFormValue from "./hooks/useFormValue.js";
|
|
12
|
-
import useFormClassNames from "./hooks/useFormClassNames.js";
|
|
13
14
|
import useFormRef from "./hooks/useFormRef.js";
|
|
14
15
|
import { forwardRef } from "../internals/utils/index.js";
|
|
15
16
|
import { SchemaModel } from 'schema-typed';
|
|
@@ -18,10 +19,19 @@ import { FormValueProvider, FormProvider } from "./FormContext.js";
|
|
|
18
19
|
import { useCustom } from "../CustomProvider/index.js";
|
|
19
20
|
const defaultSchema = SchemaModel({});
|
|
20
21
|
const Subcomponents = {
|
|
22
|
+
Stack: FormStack,
|
|
21
23
|
Control: FormControl,
|
|
22
|
-
|
|
24
|
+
Label: FormControlLabel,
|
|
23
25
|
ErrorMessage: FormErrorMessage,
|
|
24
26
|
Group: FormGroup,
|
|
27
|
+
Text: FormHelpText,
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Use `Form.Label` instead
|
|
30
|
+
*/
|
|
31
|
+
ControlLabel: FormControlLabel,
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use `Form.Text` instead
|
|
34
|
+
*/
|
|
25
35
|
HelpText: FormHelpText
|
|
26
36
|
};
|
|
27
37
|
|
|
@@ -35,18 +45,16 @@ const Form = forwardRef((props, ref) => {
|
|
|
35
45
|
} = useCustom('Form', props);
|
|
36
46
|
const {
|
|
37
47
|
checkTrigger = 'change',
|
|
38
|
-
classPrefix = 'form',
|
|
39
48
|
errorFromContext = true,
|
|
40
49
|
formDefaultValue = {},
|
|
41
50
|
formValue: controlledFormValue,
|
|
42
51
|
formError: controlledFormError,
|
|
43
|
-
fluid,
|
|
44
52
|
nestedField = false,
|
|
45
|
-
|
|
53
|
+
fluid,
|
|
54
|
+
layout,
|
|
46
55
|
model: formModel = defaultSchema,
|
|
47
56
|
readOnly,
|
|
48
57
|
plaintext,
|
|
49
|
-
className,
|
|
50
58
|
children,
|
|
51
59
|
disabled,
|
|
52
60
|
onSubmit,
|
|
@@ -90,15 +98,6 @@ const Form = forwardRef((props, ref) => {
|
|
|
90
98
|
resetErrors,
|
|
91
99
|
cleanErrorForField
|
|
92
100
|
} = useFormValidate(controlledFormError, formValidateProps);
|
|
93
|
-
const classes = useFormClassNames({
|
|
94
|
-
classPrefix,
|
|
95
|
-
className,
|
|
96
|
-
fluid,
|
|
97
|
-
layout,
|
|
98
|
-
readOnly,
|
|
99
|
-
plaintext,
|
|
100
|
-
disabled
|
|
101
|
-
});
|
|
102
101
|
const submit = useEventCallback(event => {
|
|
103
102
|
// Check the form before submitting
|
|
104
103
|
if (check()) {
|
|
@@ -172,16 +171,26 @@ const Form = forwardRef((props, ref) => {
|
|
|
172
171
|
checkFieldForNextValue,
|
|
173
172
|
checkFieldAsyncForNextValue
|
|
174
173
|
};
|
|
175
|
-
|
|
174
|
+
const formChild = useMemo(() => {
|
|
175
|
+
return fluid || layout ? /*#__PURE__*/React.createElement(FormStack, {
|
|
176
|
+
fluid: fluid,
|
|
177
|
+
layout: layout
|
|
178
|
+
}, children) : children;
|
|
179
|
+
}, [fluid, children, layout]);
|
|
180
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
181
|
+
as: "form",
|
|
182
|
+
"data-rs": "form",
|
|
183
|
+
"data-disabled": disabled,
|
|
184
|
+
"data-readonly": readOnly,
|
|
185
|
+
"data-plaintext": plaintext,
|
|
176
186
|
ref: formRef,
|
|
177
187
|
onSubmit: handleSubmit,
|
|
178
|
-
onReset: handleReset
|
|
179
|
-
|
|
180
|
-
}), /*#__PURE__*/React.createElement(FormProvider, {
|
|
188
|
+
onReset: handleReset
|
|
189
|
+
}, rest), /*#__PURE__*/React.createElement(FormProvider, {
|
|
181
190
|
value: formContextValue
|
|
182
191
|
}, /*#__PURE__*/React.createElement(FormValueProvider, {
|
|
183
192
|
value: formValue
|
|
184
|
-
},
|
|
193
|
+
}, formChild)));
|
|
185
194
|
}, Subcomponents);
|
|
186
195
|
Form.displayName = 'Form';
|
|
187
196
|
export default Form;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Input from '../Input';
|
|
3
|
+
import { BoxProps } from '../internals/Box';
|
|
3
4
|
import type { CheckType } from 'schema-typed';
|
|
4
|
-
import type { PlacementCorners, FormControlBaseProps,
|
|
5
|
+
import type { PlacementCorners, FormControlBaseProps, CheckTriggerType } from '../internals/types';
|
|
5
6
|
/**
|
|
6
7
|
* Props that FormControl passes to its accepter
|
|
7
8
|
*/
|
|
8
9
|
export type FormControlAccepterProps<ValueType = any> = FormControlBaseProps<ValueType>;
|
|
9
|
-
export interface FormControlProps<ValueType = any> extends
|
|
10
|
+
export interface FormControlProps<ValueType = any> extends BoxProps, Omit<React.HTMLAttributes<HTMLFormElement>, 'value' | 'onChange'> {
|
|
10
11
|
/** Proxied components */
|
|
11
12
|
accepter?: React.ElementType;
|
|
12
13
|
/**
|
|
@@ -7,6 +7,7 @@ import FormContext, { FormValueContext } from "../Form/FormContext.js";
|
|
|
7
7
|
import useRegisterModel from "./hooks/useRegisterModel.js";
|
|
8
8
|
import useField from "./hooks/useField.js";
|
|
9
9
|
import Toggle from "../Toggle/index.js";
|
|
10
|
+
import Box from "../internals/Box/index.js";
|
|
10
11
|
import { forwardRef } from "../internals/utils/index.js";
|
|
11
12
|
import { useStyles } from "../internals/hooks/index.js";
|
|
12
13
|
import { useFormGroup } from "../FormGroup/index.js";
|
|
@@ -40,7 +41,7 @@ const FormControl = forwardRef((props, ref) => {
|
|
|
40
41
|
checkFieldAsyncForNextValue
|
|
41
42
|
} = useContext(FormContext);
|
|
42
43
|
const {
|
|
43
|
-
as
|
|
44
|
+
as,
|
|
44
45
|
accepter: AccepterComponent = Input,
|
|
45
46
|
classPrefix = 'form-control',
|
|
46
47
|
checkAsync,
|
|
@@ -128,7 +129,8 @@ const FormControl = forwardRef((props, ref) => {
|
|
|
128
129
|
// need to distinguish between undefined and null
|
|
129
130
|
[valueKey]: fieldValue === undefined ? defaultValue : fieldValue
|
|
130
131
|
};
|
|
131
|
-
return /*#__PURE__*/React.createElement(
|
|
132
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
133
|
+
as: as,
|
|
132
134
|
className: classes,
|
|
133
135
|
ref: ref,
|
|
134
136
|
"data-testid": "form-control-wrapper"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
export interface FormControlLabelProps extends
|
|
2
|
+
import { BoxProps } from '../internals/Box';
|
|
3
|
+
export interface FormControlLabelProps extends BoxProps, React.LabelHTMLAttributes<HTMLLabelElement> {
|
|
4
4
|
/** Attribute of the html label tag, defaults to the controlId of the FormGroup */
|
|
5
5
|
htmlFor?: string;
|
|
6
6
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import Box from "../internals/Box/index.js";
|
|
4
5
|
import { useStyles } from "../internals/hooks/index.js";
|
|
5
6
|
import { forwardRef } from "../internals/utils/index.js";
|
|
6
7
|
import { useCustom } from "../CustomProvider/index.js";
|
|
@@ -18,7 +19,7 @@ const FormControlLabel = forwardRef((props, ref) => {
|
|
|
18
19
|
controlId
|
|
19
20
|
} = useFormGroup();
|
|
20
21
|
const {
|
|
21
|
-
as
|
|
22
|
+
as = 'label',
|
|
22
23
|
classPrefix = 'form-control-label',
|
|
23
24
|
htmlFor = controlId,
|
|
24
25
|
className,
|
|
@@ -30,7 +31,8 @@ const FormControlLabel = forwardRef((props, ref) => {
|
|
|
30
31
|
merge
|
|
31
32
|
} = useStyles(classPrefix);
|
|
32
33
|
const classes = merge(className, withPrefix());
|
|
33
|
-
return /*#__PURE__*/React.createElement(
|
|
34
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
35
|
+
as: as,
|
|
34
36
|
id: id,
|
|
35
37
|
htmlFor: htmlFor
|
|
36
38
|
}, rest, {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { BoxProps } from '../internals/Box';
|
|
2
|
+
import type { PlacementCorners } from '../internals/types';
|
|
3
|
+
export interface FormErrorMessageProps extends BoxProps {
|
|
3
4
|
/** Show error messages */
|
|
4
5
|
show?: boolean;
|
|
5
6
|
/** The placement of error messages */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import Box from "../internals/Box/index.js";
|
|
4
5
|
import { useStyles } from "../internals/hooks/index.js";
|
|
5
6
|
import { forwardRef, kebabPlace } from "../internals/utils/index.js";
|
|
6
7
|
import { useCustom } from "../CustomProvider/index.js";
|
|
@@ -13,7 +14,7 @@ const FormErrorMessage = forwardRef((props, ref) => {
|
|
|
13
14
|
propsWithDefaults
|
|
14
15
|
} = useCustom('FormErrorMessage', props);
|
|
15
16
|
const {
|
|
16
|
-
as
|
|
17
|
+
as,
|
|
17
18
|
classPrefix = 'form-error-message',
|
|
18
19
|
className,
|
|
19
20
|
show,
|
|
@@ -28,7 +29,8 @@ const FormErrorMessage = forwardRef((props, ref) => {
|
|
|
28
29
|
} = useStyles(classPrefix);
|
|
29
30
|
const classes = withPrefix('show');
|
|
30
31
|
const wrapperClasses = merge(className, prefix('wrapper'));
|
|
31
|
-
return show ? /*#__PURE__*/React.createElement(
|
|
32
|
+
return show ? /*#__PURE__*/React.createElement(Box, _extends({
|
|
33
|
+
as: as,
|
|
32
34
|
ref: ref,
|
|
33
35
|
"data-placement": kebabPlace(placement),
|
|
34
36
|
className: wrapperClasses
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export interface FormGroupProps extends
|
|
1
|
+
import { BoxProps } from '../internals/Box';
|
|
2
|
+
export interface FormGroupProps extends BoxProps {
|
|
3
3
|
/**
|
|
4
4
|
* Sets id on `<Form.Control>` and `htmlFor` on `<Form.ControlLabel>`.
|
|
5
5
|
* And generate ʻaria-labelledby` and ʻaria-describedby` for `<Form.Control>`.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import React, { useMemo } from 'react';
|
|
4
|
+
import Box from "../internals/Box/index.js";
|
|
4
5
|
import { forwardRef } from "../internals/utils/index.js";
|
|
5
6
|
import { useStyles, useUniqueId } from "../internals/hooks/index.js";
|
|
6
7
|
import { useCustom } from "../CustomProvider/index.js";
|
|
@@ -41,7 +42,7 @@ const FormGroup = forwardRef((props, ref) => {
|
|
|
41
42
|
propsWithDefaults
|
|
42
43
|
} = useCustom('FormGroup', props);
|
|
43
44
|
const {
|
|
44
|
-
as
|
|
45
|
+
as,
|
|
45
46
|
classPrefix = 'form-group',
|
|
46
47
|
controlId: controlIdProp,
|
|
47
48
|
className,
|
|
@@ -58,7 +59,9 @@ const FormGroup = forwardRef((props, ref) => {
|
|
|
58
59
|
}), [controlId]);
|
|
59
60
|
return /*#__PURE__*/React.createElement(FormGroupContext.Provider, {
|
|
60
61
|
value: contextValue
|
|
61
|
-
}, /*#__PURE__*/React.createElement(
|
|
62
|
+
}, /*#__PURE__*/React.createElement(Box, _extends({
|
|
63
|
+
as: as
|
|
64
|
+
}, rest, {
|
|
62
65
|
ref: ref,
|
|
63
66
|
className: classes,
|
|
64
67
|
role: "group"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
export interface FormHelpTextProps extends
|
|
2
|
+
import { BoxProps } from '../internals/Box';
|
|
3
|
+
export interface FormHelpTextProps extends BoxProps, React.HTMLAttributes<HTMLSpanElement> {
|
|
4
4
|
/** Whether to show through the Tooltip component */
|
|
5
5
|
tooltip?: boolean;
|
|
6
6
|
}
|
|
@@ -4,6 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import HelpOutlineIcon from '@rsuite/icons/HelpOutline';
|
|
5
5
|
import Tooltip from "../Tooltip/index.js";
|
|
6
6
|
import Whisper from "../Whisper/index.js";
|
|
7
|
+
import Box from "../internals/Box/index.js";
|
|
7
8
|
import { forwardRef } from "../internals/utils/index.js";
|
|
8
9
|
import { useStyles } from "../internals/hooks/index.js";
|
|
9
10
|
import { useFormGroup } from "../FormGroup/index.js";
|
|
@@ -20,7 +21,7 @@ const FormHelpText = forwardRef((props, ref) => {
|
|
|
20
21
|
propsWithDefaults
|
|
21
22
|
} = useCustom('FormHelpText', props);
|
|
22
23
|
const {
|
|
23
|
-
as
|
|
24
|
+
as = 'span',
|
|
24
25
|
classPrefix = 'form-help-text',
|
|
25
26
|
className,
|
|
26
27
|
tooltip,
|
|
@@ -42,7 +43,8 @@ const FormHelpText = forwardRef((props, ref) => {
|
|
|
42
43
|
speaker: /*#__PURE__*/React.createElement(Tooltip, _extends({
|
|
43
44
|
id: id
|
|
44
45
|
}, rest), children)
|
|
45
|
-
}, /*#__PURE__*/React.createElement(
|
|
46
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
47
|
+
as: as,
|
|
46
48
|
role: "img",
|
|
47
49
|
"aria-label": "help",
|
|
48
50
|
className: classes
|
|
@@ -50,7 +52,8 @@ const FormHelpText = forwardRef((props, ref) => {
|
|
|
50
52
|
"aria-hidden": true
|
|
51
53
|
})));
|
|
52
54
|
}
|
|
53
|
-
return /*#__PURE__*/React.createElement(
|
|
55
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
56
|
+
as: as,
|
|
54
57
|
id: id
|
|
55
58
|
}, rest, {
|
|
56
59
|
ref: ref,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BoxProps } from '../internals/Box';
|
|
2
|
+
export interface FormStackProps extends BoxProps {
|
|
3
|
+
/**
|
|
4
|
+
* Set the layout of the elements within the form.
|
|
5
|
+
* 'horizontal': Left and right columns layout.
|
|
6
|
+
* 'vertical': Top and bottom layout.
|
|
7
|
+
* 'inline': Elements are placed inline.
|
|
8
|
+
*/
|
|
9
|
+
layout?: 'horizontal' | 'vertical' | 'inline';
|
|
10
|
+
/**
|
|
11
|
+
* The fluid property allows the form elements to fill 100% of the container width.
|
|
12
|
+
* Only valid in vertical layouts.
|
|
13
|
+
*/
|
|
14
|
+
fluid?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Define the spacing between immediate children.
|
|
17
|
+
* Can be a number, string, or an array of numbers/strings for responsive spacing.
|
|
18
|
+
*/
|
|
19
|
+
spacing?: number | string | (number | string)[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The `<Form.Stack>` component is a quick layout component through Flexbox,
|
|
23
|
+
* supporting vertical and horizontal stacking, custom spacing and line wrapping.
|
|
24
|
+
* @see https://rsuitejs.com/components/form/
|
|
25
|
+
*/
|
|
26
|
+
declare const FormStack: import("../internals/types").InternalRefForwardingComponent<"span", FormStackProps, never> & Record<string, never>;
|
|
27
|
+
export default FormStack;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import Box from "../internals/Box/index.js";
|
|
5
|
+
import { forwardRef, mergeStyles, getCssValue } from "../internals/utils/index.js";
|
|
6
|
+
import { useStyles } from "../internals/hooks/index.js";
|
|
7
|
+
import { useCustom } from "../CustomProvider/index.js";
|
|
8
|
+
/**
|
|
9
|
+
* The `<Form.Stack>` component is a quick layout component through Flexbox,
|
|
10
|
+
* supporting vertical and horizontal stacking, custom spacing and line wrapping.
|
|
11
|
+
* @see https://rsuitejs.com/components/form/
|
|
12
|
+
*/
|
|
13
|
+
const FormStack = forwardRef((props, ref) => {
|
|
14
|
+
const {
|
|
15
|
+
propsWithDefaults
|
|
16
|
+
} = useCustom('FormStack', props);
|
|
17
|
+
const {
|
|
18
|
+
as,
|
|
19
|
+
classPrefix = 'form-stack',
|
|
20
|
+
className,
|
|
21
|
+
children,
|
|
22
|
+
layout = 'vertical',
|
|
23
|
+
fluid,
|
|
24
|
+
spacing,
|
|
25
|
+
style,
|
|
26
|
+
...rest
|
|
27
|
+
} = propsWithDefaults;
|
|
28
|
+
const {
|
|
29
|
+
withPrefix,
|
|
30
|
+
merge,
|
|
31
|
+
cssVar
|
|
32
|
+
} = useStyles(classPrefix);
|
|
33
|
+
const classes = merge(className, withPrefix(layout, {
|
|
34
|
+
fluid
|
|
35
|
+
}));
|
|
36
|
+
const styles = mergeStyles(style, cssVar('spacing', spacing, getCssValue));
|
|
37
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
38
|
+
as: as,
|
|
39
|
+
ref: ref,
|
|
40
|
+
style: styles,
|
|
41
|
+
className: classes
|
|
42
|
+
}, rest), children);
|
|
43
|
+
});
|
|
44
|
+
FormStack.displayName = 'FormStack';
|
|
45
|
+
export default FormStack;
|
package/esm/Schema/Schema.d.ts
CHANGED
package/esm/Schema/Schema.js
CHANGED
package/esm/Stack/Stack.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { CSSProperties } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { BoxProps } from '../internals/Box';
|
|
3
|
+
import type { ResponsiveValue } from '../internals/types';
|
|
3
4
|
interface DeprecatedStackProps {
|
|
4
5
|
/**
|
|
5
6
|
* Define the alignment of the children in the stack on the inline axis
|
|
@@ -12,7 +13,7 @@ interface DeprecatedStackProps {
|
|
|
12
13
|
*/
|
|
13
14
|
alignItems?: CSSProperties['alignItems'];
|
|
14
15
|
}
|
|
15
|
-
export interface StackProps extends
|
|
16
|
+
export interface StackProps extends BoxProps, DeprecatedStackProps {
|
|
16
17
|
/** Define the alignment of the children in the stack on the cross axis */
|
|
17
18
|
align?: CSSProperties['alignItems'];
|
|
18
19
|
/** The direction of the children in the stack */
|
package/esm/index.d.ts
CHANGED
package/esm/index.js
CHANGED
|
@@ -54,6 +54,7 @@ export * from "./Steps/index.js";
|
|
|
54
54
|
// Form
|
|
55
55
|
// --------------------------------------------------------
|
|
56
56
|
export * from "./Form/index.js";
|
|
57
|
+
export * from "./FormStack/index.js";
|
|
57
58
|
export * from "./FormGroup/index.js";
|
|
58
59
|
export * from "./FormErrorMessage/index.js";
|
|
59
60
|
export * from "./FormControlLabel/index.js";
|
package/package.json
CHANGED
package/styles/index.less
CHANGED
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
@import '../CheckTreePicker/styles/index';
|
|
24
24
|
@import '../Container/styles/index';
|
|
25
25
|
@import '../Content/styles/index';
|
|
26
|
-
@import '../FormControlLabel/styles/index';
|
|
27
26
|
@import '../DatePicker/styles/index';
|
|
28
27
|
@import '../DateRangePicker/styles/index';
|
|
29
28
|
@import '../Divider/styles/index';
|
|
@@ -32,12 +31,14 @@
|
|
|
32
31
|
@import '../FlexboxGrid/styles/index';
|
|
33
32
|
@import '../Footer/styles/index';
|
|
34
33
|
@import '../Form/styles/index';
|
|
35
|
-
@import '../
|
|
34
|
+
@import '../FormStack/styles/index';
|
|
36
35
|
@import '../FormGroup/styles/index';
|
|
36
|
+
@import '../FormControl/styles/index';
|
|
37
|
+
@import '../FormControlLabel/styles/index';
|
|
37
38
|
@import '../FormErrorMessage/styles/index';
|
|
39
|
+
@import '../FormHelpText/styles/index';
|
|
38
40
|
@import '../Grid/styles/index';
|
|
39
41
|
@import '../Header/styles/index';
|
|
40
|
-
@import '../FormHelpText/styles/index';
|
|
41
42
|
@import '../IconButton/styles/index';
|
|
42
43
|
@import '../Image/styles/index';
|
|
43
44
|
@import '../Input/styles/index';
|