-
Notifications
You must be signed in to change notification settings - Fork 247
Expand file tree
/
Copy pathWrappedInputComponents.ts
More file actions
53 lines (47 loc) · 1.93 KB
/
WrappedInputComponents.ts
File metadata and controls
53 lines (47 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import {
TextInput as TextInputComponent,
Select as SelectComponent,
CheckBox as CheckBoxComponent,
ToggleSwitch as ToggleSwitchComponent,
RadioButton as RadioButtonComponent,
EmailInput as EmailInputComponent,
PasswordInput as PasswordInputComponent,
SearchInput as SearchInputComponent,
TextAreaInput as TextAreaComponent,
NumberInput as NumberInputComponent,
TelephoneInput as TelephoneInputComponent,
UrlInput as UrlInputComponent,
MultiSelect as MultiSelectComponent,
MultiSelectFiltered as MultiSelectFilteredComponent,
Slider as SliderComponent,
} from '@rocket.chat/fuselage';
import {
withLabelId,
withAriaLabelledBy,
withAriaLabelledByAndId,
withVisuallyHiddenLabel,
} from './withLabelHelpers';
// TODO: Some inputs are still not supported due to requiring a different a11y approach
// with id
export const TextInput = withLabelId(TextInputComponent);
export const EmailInput = withLabelId(EmailInputComponent);
export const PasswordInput = withLabelId(PasswordInputComponent);
export const SearchInput = withLabelId(SearchInputComponent);
export const TextAreaInput = withLabelId(TextAreaComponent);
export const TelephoneInput = withLabelId(TelephoneInputComponent);
export const NumberInput = withLabelId(NumberInputComponent);
export const UrlInput = withLabelId(UrlInputComponent);
// with aria-labelledby
export const Select = withAriaLabelledBy(SelectComponent);
// with aria-labelledby + id for aria-controls
export const MultiSelect = withAriaLabelledByAndId(MultiSelectComponent);
export const MultiSelectFiltered = withAriaLabelledByAndId(
MultiSelectFilteredComponent,
);
export const Slider = withAriaLabelledBy(
SliderComponent,
) as typeof SliderComponent;
// with visually hidden label
export const CheckBox = withVisuallyHiddenLabel(CheckBoxComponent);
export const ToggleSwitch = withVisuallyHiddenLabel(ToggleSwitchComponent);
export const RadioButton = withVisuallyHiddenLabel(RadioButtonComponent);