@react-ui-org/react-ui 0.60.0 → 0.62.0
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/.env.playwright +9 -0
- package/.env.playwright.dist +9 -0
- package/.eslintrc-ts +40 -0
- package/.nvmrc +1 -1
- package/README.md +18 -1
- package/dist/react-ui.css +16 -16
- package/dist/react-ui.development.css +249 -177
- package/dist/react-ui.development.js +477 -477
- package/dist/react-ui.js +1 -1
- package/jest.config-ts.js +34 -0
- package/package.json +53 -37
- package/playwright-ct.config.ts +68 -0
- package/src/components/Alert/Alert.jsx +2 -2
- package/src/components/Button/Button.jsx +5 -5
- package/src/components/Button/README.md +1 -1
- package/src/components/ButtonGroup/ButtonGroup.jsx +1 -1
- package/src/components/Card/CardFooter.jsx +1 -1
- package/src/components/CheckboxField/CheckboxField.jsx +3 -3
- package/src/components/FileInputField/FileInputField.jsx +13 -5
- package/src/components/FormLayout/FormLayout.jsx +1 -1
- package/src/components/FormLayout/FormLayoutCustomField.jsx +4 -4
- package/src/components/FormLayout/README.md +10 -10
- package/src/components/Grid/Grid.jsx +1 -1
- package/src/components/Grid/GridSpan.jsx +1 -1
- package/src/components/InputGroup/InputGroup.jsx +24 -4
- package/src/components/InputGroup/InputGroup.module.scss +2 -1
- package/src/components/InputGroup/README.md +69 -14
- package/src/components/Modal/Modal.jsx +12 -7
- package/src/components/Modal/ModalBody.jsx +1 -1
- package/src/components/Modal/ModalContent.jsx +1 -1
- package/src/components/Popover/Popover.jsx +5 -5
- package/src/components/Radio/README.md +4 -4
- package/src/components/Radio/Radio.jsx +3 -3
- package/src/components/ScrollView/ScrollView.jsx +3 -3
- package/src/components/SelectField/README.md +5 -5
- package/src/components/SelectField/SelectField.jsx +9 -6
- package/src/components/Table/Table.jsx +1 -1
- package/src/components/Table/_components/TableBodyCell/TableBodyCell.jsx +1 -1
- package/src/components/Table/_components/TableHeaderCell/TableHeaderCell.jsx +1 -1
- package/src/components/Tabs/TabsItem.jsx +3 -3
- package/src/components/Text/Text.jsx +1 -1
- package/src/components/TextArea/TextArea.jsx +3 -3
- package/src/components/TextField/TextField.jsx +11 -8
- package/src/components/Toggle/README.md +9 -9
- package/src/components/Toggle/Toggle.jsx +3 -3
- package/src/components/Toolbar/Toolbar.jsx +1 -1
- package/src/components/Toolbar/ToolbarGroup.jsx +1 -1
- package/src/components/Toolbar/ToolbarItem.jsx +1 -1
- package/src/providers/globalProps/GlobalPropsProvider.jsx +1 -1
- package/src/providers/translations/TranslationsProvider.jsx +1 -1
- package/src/styles/settings/_breakpoints.scss +2 -0
- package/tsconfig.json +27 -0
|
@@ -60,13 +60,14 @@ See [API](#api) for all available options.
|
|
|
60
60
|
Make sure your inputs fit their container, especially on small screens.
|
|
61
61
|
|
|
62
62
|
- In the background, InputGroup uses the [`fieldset`][fieldset] element. Not
|
|
63
|
-
only it
|
|
64
|
-
use of its built-in features like disabling all nested inputs or pairing
|
|
65
|
-
group with a form outside. Consult [the MDN docs][fieldset] to learn more.
|
|
63
|
+
only does it improve the [accessibility] of the group, it also allows you to
|
|
64
|
+
make use of its built-in features like disabling all nested inputs or pairing
|
|
65
|
+
the group with a form outside. Consult [the MDN docs][fieldset] to learn more.
|
|
66
66
|
|
|
67
67
|
- InputGroup currently **supports grouping of**
|
|
68
68
|
[TextField](/components/TextField), [SelectField](/components/SelectField),
|
|
69
|
-
and [Button](/components/Button)
|
|
69
|
+
[FileInputField](/components/FileInputField), and [Button](/components/Button)
|
|
70
|
+
components.
|
|
70
71
|
|
|
71
72
|
- To group [Buttons](/components/Button) only, use the
|
|
72
73
|
[ButtonGroup](/components/ButtonGroup) component which is designed
|
|
@@ -104,7 +105,7 @@ You can set the `size` property directly on InputGroup to be shared for all
|
|
|
104
105
|
fields and buttons inside the group. This property is then passed over to
|
|
105
106
|
individual elements. At the same time, it **cannot be overridden** on the
|
|
106
107
|
fields' or buttons' level. While technically possible, from the design point of
|
|
107
|
-
view it's undesirable to group elements of totally different types or sizes.
|
|
108
|
+
view, it's undesirable to group elements of totally different types or sizes.
|
|
108
109
|
|
|
109
110
|
## Invisible Label
|
|
110
111
|
|
|
@@ -136,9 +137,9 @@ the input.
|
|
|
136
137
|
|
|
137
138
|
## Horizontal layout
|
|
138
139
|
|
|
139
|
-
The default vertical layout is
|
|
140
|
-
are situations where horizontal layout suits better — and that's why
|
|
141
|
-
supports this kind of layout as well.
|
|
140
|
+
The default vertical layout is straightforward to use and work with. However,
|
|
141
|
+
there are situations where horizontal layout suits better — and that's why
|
|
142
|
+
React UI supports this kind of layout as well.
|
|
142
143
|
|
|
143
144
|
```docoff-react-preview
|
|
144
145
|
<InputGroup
|
|
@@ -150,6 +151,57 @@ supports this kind of layout as well.
|
|
|
150
151
|
</InputGroup>
|
|
151
152
|
```
|
|
152
153
|
|
|
154
|
+
## Help Text
|
|
155
|
+
|
|
156
|
+
You may provide one or more additional help texts to clarify how the input group
|
|
157
|
+
should be filled.
|
|
158
|
+
|
|
159
|
+
These messages are not semantically tied to the `children` elements, the
|
|
160
|
+
connection should be expressed in textual form in the actual message.
|
|
161
|
+
|
|
162
|
+
⚠️ Help texts passed to input elements' `helpText` prop are ignored within
|
|
163
|
+
InputGroup.
|
|
164
|
+
|
|
165
|
+
```docoff-react-preview
|
|
166
|
+
React.createElement(() => {
|
|
167
|
+
const [fruit, setFruit] = React.useState('apple');
|
|
168
|
+
const options = [
|
|
169
|
+
{
|
|
170
|
+
label: 'Apple',
|
|
171
|
+
value: 'apple',
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
label: 'Pear',
|
|
175
|
+
value: 'pear',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
label: 'Cherry',
|
|
179
|
+
value: 'cherry',
|
|
180
|
+
},
|
|
181
|
+
];
|
|
182
|
+
return (
|
|
183
|
+
<InputGroup
|
|
184
|
+
label="Your favourite fruit"
|
|
185
|
+
helpTexts={[
|
|
186
|
+
"Choose one or more kinds of fruit to feel happy.",
|
|
187
|
+
]}
|
|
188
|
+
>
|
|
189
|
+
<SelectField
|
|
190
|
+
label="Your favourite fruit"
|
|
191
|
+
onChange={(e) => setFruit(e.target.value)}
|
|
192
|
+
options={options}
|
|
193
|
+
value={fruit}
|
|
194
|
+
/>
|
|
195
|
+
<TextField
|
|
196
|
+
label="Variety"
|
|
197
|
+
placeholder="Eg. Golden delicious"
|
|
198
|
+
/>
|
|
199
|
+
<Button label="Submit" />
|
|
200
|
+
</InputGroup>
|
|
201
|
+
);
|
|
202
|
+
})
|
|
203
|
+
```
|
|
204
|
+
|
|
153
205
|
## States
|
|
154
206
|
|
|
155
207
|
### Disabled State
|
|
@@ -169,12 +221,15 @@ Validation states visually present the result of validation of the grouped
|
|
|
169
221
|
inputs. Input group's validation state is taken from its child inputs. You
|
|
170
222
|
should always **provide validation messages for states other than valid**
|
|
171
223
|
directly through `validationTexts` prop so users know what happened and what
|
|
172
|
-
action they should take or what options they have.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
224
|
+
action they should take or what options they have.
|
|
225
|
+
|
|
226
|
+
These messages are not semantically tied to the `children` elements, the
|
|
227
|
+
connection should be expressed in textual form in the actual message. The
|
|
228
|
+
individual `children` elements must not show any `validationText`, they only
|
|
229
|
+
show their respective `validationState`.
|
|
230
|
+
|
|
231
|
+
⚠️ Validation messages passed to input elements' `validationText` prop are
|
|
232
|
+
ignored within InputGroup.
|
|
178
233
|
|
|
179
234
|
👉 While there is a `required` property to visually denote the whole input group
|
|
180
235
|
is required, there is no functional effect as there is no such HTML attribute
|
|
@@ -76,7 +76,12 @@ export const Modal = ({
|
|
|
76
76
|
useModalScrollPrevention(preventScrollUnderneath);
|
|
77
77
|
|
|
78
78
|
const onCancel = useCallback(
|
|
79
|
-
(e) =>
|
|
79
|
+
(e) => {
|
|
80
|
+
if (e.target !== internalDialogRef.current) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
dialogOnCancelHandler(e, closeButtonRef, restProps.onCancel);
|
|
84
|
+
},
|
|
80
85
|
[closeButtonRef, restProps.onCancel],
|
|
81
86
|
);
|
|
82
87
|
const onClick = useCallback(
|
|
@@ -121,7 +126,7 @@ export const Modal = ({
|
|
|
121
126
|
onMouseDown,
|
|
122
127
|
};
|
|
123
128
|
|
|
124
|
-
if (portalId ===
|
|
129
|
+
if (portalId === undefined) {
|
|
125
130
|
return preRender(
|
|
126
131
|
children,
|
|
127
132
|
color,
|
|
@@ -152,14 +157,14 @@ Modal.defaultProps = {
|
|
|
152
157
|
allowCloseOnEscapeKey: true,
|
|
153
158
|
allowPrimaryActionOnEnterKey: true,
|
|
154
159
|
autoFocus: true,
|
|
155
|
-
children:
|
|
156
|
-
closeButtonRef:
|
|
160
|
+
children: undefined,
|
|
161
|
+
closeButtonRef: undefined,
|
|
157
162
|
color: undefined,
|
|
158
|
-
dialogRef:
|
|
159
|
-
portalId:
|
|
163
|
+
dialogRef: undefined,
|
|
164
|
+
portalId: undefined,
|
|
160
165
|
position: 'center',
|
|
161
166
|
preventScrollUnderneath: window.document.body,
|
|
162
|
-
primaryButtonRef:
|
|
167
|
+
primaryButtonRef: undefined,
|
|
163
168
|
size: 'medium',
|
|
164
169
|
};
|
|
165
170
|
|
|
@@ -43,7 +43,7 @@ export const Popover = React.forwardRef((props, ref) => {
|
|
|
43
43
|
getRootAlignmentClassName(placement, styles),
|
|
44
44
|
)}
|
|
45
45
|
ref={ref}
|
|
46
|
-
style={placementStyle ? cleanPlacementStyle(placementStyle) :
|
|
46
|
+
style={placementStyle ? cleanPlacementStyle(placementStyle) : undefined}
|
|
47
47
|
>
|
|
48
48
|
{children}
|
|
49
49
|
<span className={styles.arrow} />
|
|
@@ -51,7 +51,7 @@ export const Popover = React.forwardRef((props, ref) => {
|
|
|
51
51
|
</>
|
|
52
52
|
);
|
|
53
53
|
|
|
54
|
-
if (portalId ===
|
|
54
|
+
if (portalId === undefined) {
|
|
55
55
|
return PopoverEl;
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -60,9 +60,9 @@ export const Popover = React.forwardRef((props, ref) => {
|
|
|
60
60
|
|
|
61
61
|
Popover.defaultProps = {
|
|
62
62
|
placement: 'bottom',
|
|
63
|
-
placementStyle:
|
|
64
|
-
popoverTargetId:
|
|
65
|
-
portalId:
|
|
63
|
+
placementStyle: undefined,
|
|
64
|
+
popoverTargetId: undefined,
|
|
65
|
+
portalId: undefined,
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
Popover.propTypes = {
|
|
@@ -405,10 +405,10 @@ to improve its accessibility.
|
|
|
405
405
|
Head to [Forms Theming](/docs/customize/theming/forms) to see shared form theming
|
|
406
406
|
options. On top of that, the following options are available for Radio.
|
|
407
407
|
|
|
408
|
-
| Custom Property | Description
|
|
409
|
-
|
|
410
|
-
| `--rui-FormField--check__input--radio__border-radius` | Input corner radius
|
|
411
|
-
| `--rui-FormField--check__input--radio--checked__background-image`
|
|
408
|
+
| Custom Property | Description |
|
|
409
|
+
|--------------------------------------------------------------------|--------------------------------------------------|
|
|
410
|
+
| `--rui-FormField--check__input--radio__border-radius` | Input corner radius |
|
|
411
|
+
| `--rui-FormField--check__input--radio--checked__background-image` | Checked input background image (inline, URL, …) |
|
|
412
412
|
|
|
413
413
|
[accessibility]: https://www.w3.org/WAI/tutorials/forms/grouping/
|
|
414
414
|
[fieldset]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset
|
|
@@ -113,14 +113,14 @@ export const Radio = ({
|
|
|
113
113
|
|
|
114
114
|
Radio.defaultProps = {
|
|
115
115
|
disabled: false,
|
|
116
|
-
helpText:
|
|
116
|
+
helpText: undefined,
|
|
117
117
|
id: undefined,
|
|
118
118
|
isLabelVisible: true,
|
|
119
119
|
layout: 'vertical',
|
|
120
120
|
renderAsRequired: false,
|
|
121
121
|
required: false,
|
|
122
|
-
validationState:
|
|
123
|
-
validationText:
|
|
122
|
+
validationState: undefined,
|
|
123
|
+
validationText: undefined,
|
|
124
124
|
value: undefined,
|
|
125
125
|
};
|
|
126
126
|
|
|
@@ -297,7 +297,7 @@ ScrollView.defaultProps = {
|
|
|
297
297
|
arrows: false,
|
|
298
298
|
arrowsScrollStep: 200,
|
|
299
299
|
autoScroll: 'off',
|
|
300
|
-
children:
|
|
300
|
+
children: undefined,
|
|
301
301
|
debounce: 50,
|
|
302
302
|
direction: 'vertical',
|
|
303
303
|
endShadowBackground: 'linear-gradient(var(--rui-local-end-shadow-direction), rgba(255 255 255 / 1), rgba(255 255 255 / 0))',
|
|
@@ -305,10 +305,10 @@ ScrollView.defaultProps = {
|
|
|
305
305
|
endShadowSize: '2em',
|
|
306
306
|
id: undefined,
|
|
307
307
|
nextArrowColor: undefined,
|
|
308
|
-
nextArrowElement:
|
|
308
|
+
nextArrowElement: undefined,
|
|
309
309
|
nextArrowInitialOffset: '-0.5rem',
|
|
310
310
|
prevArrowColor: undefined,
|
|
311
|
-
prevArrowElement:
|
|
311
|
+
prevArrowElement: undefined,
|
|
312
312
|
prevArrowInitialOffset: '-0.5rem',
|
|
313
313
|
scrollbar: true,
|
|
314
314
|
shadows: true,
|
|
@@ -779,11 +779,11 @@ If you provide [ref], it is forwarded to the native HTML `<select>` element.
|
|
|
779
779
|
Head to [Forms Theming](/docs/customize/theming/forms) to see shared form theming
|
|
780
780
|
options. On top of that, the following options are available for SelectField.
|
|
781
781
|
|
|
782
|
-
| Custom Property
|
|
783
|
-
|
|
784
|
-
| `--rui-FormField--box--select__caret__border-style`
|
|
785
|
-
| `--rui-FormField--box--select__caret__background`
|
|
786
|
-
| `--rui-FormField--box--select__option--disabled__color` | Text color of disabled SelectField options
|
|
782
|
+
| Custom Property | Description |
|
|
783
|
+
|---------------------------------------------------------|--------------------------------------------------------------|
|
|
784
|
+
| `--rui-FormField--box--select__caret__border-style` | SelectField arrow border style (e.g. `solid`) |
|
|
785
|
+
| `--rui-FormField--box--select__caret__background` | SelectField arrow background (including `url()` or gradient) |
|
|
786
|
+
| `--rui-FormField--box--select__option--disabled__color` | Text color of disabled SelectField options |
|
|
787
787
|
|
|
788
788
|
[React common props]: https://react.dev/reference/react-dom/components/common#common-props
|
|
789
789
|
[ref]: https://reactjs.org/docs/refs-and-the-dom.html
|
|
@@ -109,7 +109,7 @@ export const SelectField = React.forwardRef((props, ref) => {
|
|
|
109
109
|
<div className={styles.bottomLine} />
|
|
110
110
|
)}
|
|
111
111
|
</div>
|
|
112
|
-
{helpText && (
|
|
112
|
+
{(helpText && !inputGroupContext) && (
|
|
113
113
|
<div
|
|
114
114
|
className={styles.helpText}
|
|
115
115
|
id={id && `${id}__helpText`}
|
|
@@ -133,15 +133,15 @@ export const SelectField = React.forwardRef((props, ref) => {
|
|
|
133
133
|
SelectField.defaultProps = {
|
|
134
134
|
disabled: false,
|
|
135
135
|
fullWidth: false,
|
|
136
|
-
helpText:
|
|
136
|
+
helpText: undefined,
|
|
137
137
|
id: undefined,
|
|
138
138
|
isLabelVisible: true,
|
|
139
139
|
layout: 'vertical',
|
|
140
140
|
renderAsRequired: false,
|
|
141
141
|
required: false,
|
|
142
142
|
size: 'medium',
|
|
143
|
-
validationState:
|
|
144
|
-
validationText:
|
|
143
|
+
validationState: undefined,
|
|
144
|
+
validationText: undefined,
|
|
145
145
|
variant: 'outline',
|
|
146
146
|
};
|
|
147
147
|
|
|
@@ -156,6 +156,9 @@ SelectField.propTypes = {
|
|
|
156
156
|
fullWidth: PropTypes.bool,
|
|
157
157
|
/**
|
|
158
158
|
* Optional help text.
|
|
159
|
+
*
|
|
160
|
+
* Help text is never rendered when the component is placed into `InputGroup`.
|
|
161
|
+
* If a help text is needed, it must be defined on the `InputGroup` component instead.
|
|
159
162
|
*/
|
|
160
163
|
helpText: PropTypes.node,
|
|
161
164
|
/**
|
|
@@ -249,8 +252,8 @@ SelectField.propTypes = {
|
|
|
249
252
|
/**
|
|
250
253
|
* Validation message to be displayed.
|
|
251
254
|
*
|
|
252
|
-
* Validation text is never rendered when the component is placed into `InputGroup`.
|
|
253
|
-
*
|
|
255
|
+
* Validation text is never rendered when the component is placed into `InputGroup`.
|
|
256
|
+
* If a validation text is needed, it must be defined on the `InputGroup` component instead.
|
|
254
257
|
*/
|
|
255
258
|
validationText: PropTypes.node,
|
|
256
259
|
/**
|
|
@@ -45,11 +45,11 @@ export const TabsItem = ({
|
|
|
45
45
|
);
|
|
46
46
|
|
|
47
47
|
TabsItem.defaultProps = {
|
|
48
|
-
afterLabel:
|
|
49
|
-
beforeLabel:
|
|
48
|
+
afterLabel: undefined,
|
|
49
|
+
beforeLabel: undefined,
|
|
50
50
|
id: undefined,
|
|
51
51
|
isActive: false,
|
|
52
|
-
onClick:
|
|
52
|
+
onClick: undefined,
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
TabsItem.propTypes = {
|
|
@@ -93,14 +93,14 @@ export const TextArea = React.forwardRef((props, ref) => {
|
|
|
93
93
|
TextArea.defaultProps = {
|
|
94
94
|
disabled: false,
|
|
95
95
|
fullWidth: false,
|
|
96
|
-
helpText:
|
|
96
|
+
helpText: undefined,
|
|
97
97
|
id: undefined,
|
|
98
98
|
isLabelVisible: true,
|
|
99
99
|
layout: 'vertical',
|
|
100
100
|
required: false,
|
|
101
101
|
size: 'medium',
|
|
102
|
-
validationState:
|
|
103
|
-
validationText:
|
|
102
|
+
validationState: undefined,
|
|
103
|
+
validationText: undefined,
|
|
104
104
|
variant: 'outline',
|
|
105
105
|
};
|
|
106
106
|
|
|
@@ -32,7 +32,7 @@ export const TextField = React.forwardRef((props, ref) => {
|
|
|
32
32
|
} = props;
|
|
33
33
|
const formLayoutContext = useContext(FormLayoutContext);
|
|
34
34
|
const inputGroupContext = useContext(InputGroupContext);
|
|
35
|
-
const hasSmallInput = (inputSize !==
|
|
35
|
+
const hasSmallInput = (inputSize !== undefined) && (inputSize <= SMALL_INPUT_SIZE);
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
38
|
<label
|
|
@@ -84,7 +84,7 @@ export const TextField = React.forwardRef((props, ref) => {
|
|
|
84
84
|
<div className={styles.bottomLine} />
|
|
85
85
|
)}
|
|
86
86
|
</div>
|
|
87
|
-
{helpText && (
|
|
87
|
+
{(helpText && !inputGroupContext) && (
|
|
88
88
|
<div
|
|
89
89
|
className={styles.helpText}
|
|
90
90
|
id={id && `${id}__helpText`}
|
|
@@ -108,16 +108,16 @@ export const TextField = React.forwardRef((props, ref) => {
|
|
|
108
108
|
TextField.defaultProps = {
|
|
109
109
|
disabled: false,
|
|
110
110
|
fullWidth: false,
|
|
111
|
-
helpText:
|
|
111
|
+
helpText: undefined,
|
|
112
112
|
id: undefined,
|
|
113
|
-
inputSize:
|
|
113
|
+
inputSize: undefined,
|
|
114
114
|
isLabelVisible: true,
|
|
115
115
|
layout: 'vertical',
|
|
116
116
|
required: false,
|
|
117
117
|
size: 'medium',
|
|
118
118
|
type: 'text',
|
|
119
|
-
validationState:
|
|
120
|
-
validationText:
|
|
119
|
+
validationState: undefined,
|
|
120
|
+
validationText: undefined,
|
|
121
121
|
variant: 'outline',
|
|
122
122
|
};
|
|
123
123
|
|
|
@@ -132,6 +132,9 @@ TextField.propTypes = {
|
|
|
132
132
|
fullWidth: PropTypes.bool,
|
|
133
133
|
/**
|
|
134
134
|
* Optional help text.
|
|
135
|
+
*
|
|
136
|
+
* Help text is never rendered when the component is placed into `InputGroup`.
|
|
137
|
+
* If a help text is needed, it must be defined on the `InputGroup` component instead.
|
|
135
138
|
*/
|
|
136
139
|
helpText: PropTypes.node,
|
|
137
140
|
/**
|
|
@@ -185,8 +188,8 @@ TextField.propTypes = {
|
|
|
185
188
|
/**
|
|
186
189
|
* Validation message to be displayed.
|
|
187
190
|
*
|
|
188
|
-
* Validation text is never rendered when the component is placed into `InputGroup`.
|
|
189
|
-
*
|
|
191
|
+
* Validation text is never rendered when the component is placed into `InputGroup`.
|
|
192
|
+
* If a validation text is needed, it must be defined on the `InputGroup` component instead.
|
|
190
193
|
*/
|
|
191
194
|
validationText: PropTypes.node,
|
|
192
195
|
/**
|
|
@@ -277,15 +277,15 @@ If you provide [ref], it is forwarded to the native HTML `<input>` element.
|
|
|
277
277
|
Head to [Forms Theming](/docs/customize/theming/forms) to see shared form theming
|
|
278
278
|
options. On top of that, the following options are available for Toggle.
|
|
279
279
|
|
|
280
|
-
| Custom Property
|
|
281
|
-
|
|
282
|
-
| `--rui-FormField--check__input--toggle__width`
|
|
283
|
-
| `--rui-FormField--check__input--toggle__border-radius`
|
|
284
|
-
| `--rui-FormField--check__input--toggle__background-size`
|
|
285
|
-
| `--rui-FormField--check__input--toggle--default__background-image`
|
|
286
|
-
| `--rui-FormField--check__input--toggle--default__background-position` | Background position of unchecked input
|
|
287
|
-
| `--rui-FormField--check__input--toggle--checked__background-image`
|
|
288
|
-
| `--rui-FormField--check__input--toggle--checked__background-position` | Background position of checked input
|
|
280
|
+
| Custom Property | Description |
|
|
281
|
+
|-----------------------------------------------------------------------|--------------------------------------------------------|
|
|
282
|
+
| `--rui-FormField--check__input--toggle__width` | Input width (height is shared with other check fields) |
|
|
283
|
+
| `--rui-FormField--check__input--toggle__border-radius` | Input corner radius |
|
|
284
|
+
| `--rui-FormField--check__input--toggle__background-size` | Input background size |
|
|
285
|
+
| `--rui-FormField--check__input--toggle--default__background-image` | Background image of unchecked input |
|
|
286
|
+
| `--rui-FormField--check__input--toggle--default__background-position` | Background position of unchecked input |
|
|
287
|
+
| `--rui-FormField--check__input--toggle--checked__background-image` | Background image of checked input |
|
|
288
|
+
| `--rui-FormField--check__input--toggle--checked__background-position` | Background position of checked input |
|
|
289
289
|
|
|
290
290
|
[checkbox-attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#additional_attributes
|
|
291
291
|
[React common props]: https://react.dev/reference/react-dom/components/common#common-props
|
|
@@ -81,14 +81,14 @@ export const Toggle = React.forwardRef((props, ref) => {
|
|
|
81
81
|
|
|
82
82
|
Toggle.defaultProps = {
|
|
83
83
|
disabled: false,
|
|
84
|
-
helpText:
|
|
84
|
+
helpText: undefined,
|
|
85
85
|
id: undefined,
|
|
86
86
|
isLabelVisible: true,
|
|
87
87
|
labelPosition: 'after',
|
|
88
88
|
renderAsRequired: false,
|
|
89
89
|
required: false,
|
|
90
|
-
validationState:
|
|
91
|
-
validationText:
|
|
90
|
+
validationState: undefined,
|
|
91
|
+
validationText: undefined,
|
|
92
92
|
};
|
|
93
93
|
|
|
94
94
|
Toggle.propTypes = {
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es5",
|
|
4
|
+
"lib": [
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.iterable",
|
|
7
|
+
"esnext"
|
|
8
|
+
],
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"allowSyntheticDefaultImports": true,
|
|
13
|
+
"strict": false,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"noFallthroughCasesInSwitch": true,
|
|
16
|
+
"module": "esnext",
|
|
17
|
+
"moduleResolution": "node",
|
|
18
|
+
"resolveJsonModule": true,
|
|
19
|
+
"isolatedModules": true,
|
|
20
|
+
"noEmit": false,
|
|
21
|
+
"jsx": "react-jsx"
|
|
22
|
+
},
|
|
23
|
+
"include": [
|
|
24
|
+
"src",
|
|
25
|
+
"tests"
|
|
26
|
+
]
|
|
27
|
+
}
|