@festo-ui/react 4.0.3-pre-20221213.1 → 5.0.0-dev.46
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/index.css +3 -3202
- package/index.d.ts +50 -48
- package/index.js +50 -4797
- package/lib/components/accordion/Accordion.d.ts +9 -9
- package/lib/components/accordion/Accordion.js +38 -0
- package/lib/components/accordion/AccordionContext.d.ts +11 -11
- package/lib/components/accordion/AccordionContext.js +3 -0
- package/lib/components/accordion/accordion-header/AccordionHeader.d.ts +4 -4
- package/lib/components/accordion/accordion-header/AccordionHeader.js +17 -0
- package/lib/components/accordion/accordion-item/AccordionItem.d.ts +9 -9
- package/lib/components/accordion/accordion-item/AccordionItem.js +64 -0
- package/lib/components/accordion/accordion-item/AccordionItemContext.d.ts +8 -8
- package/lib/components/accordion/accordion-item/AccordionItemContext.js +3 -0
- package/lib/components/accordion/accordion-item/accordion-item-body/AccordionItemBody.d.ts +4 -4
- package/lib/components/accordion/accordion-item/accordion-item-body/AccordionItemBody.js +71 -0
- package/lib/components/accordion/accordion-item/accordion-item-header/AccordionItemHeader.d.ts +4 -4
- package/lib/components/accordion/accordion-item/accordion-item-header/AccordionItemHeader.js +41 -0
- package/lib/components/breadcrumb/Breadcrumb.d.ts +14 -14
- package/lib/components/breadcrumb/Breadcrumb.js +45 -0
- package/lib/components/buttons/button/Button.d.ts +12 -12
- package/lib/components/buttons/button/Button.js +37 -0
- package/lib/components/card/Card.d.ts +4 -4
- package/lib/components/card/Card.js +13 -0
- package/lib/components/card/CardBody.d.ts +7 -7
- package/lib/components/card/CardBody.js +18 -0
- package/lib/components/card/CardHeader.d.ts +9 -9
- package/lib/components/card/CardHeader.js +23 -0
- package/lib/components/card/CardNotification.d.ts +9 -9
- package/lib/components/card/CardNotification.js +26 -0
- package/lib/components/chips/chip/Chip.d.ts +19 -19
- package/lib/components/chips/chip/Chip.js +46 -0
- package/lib/components/chips/chip/DeleteIcon.d.ts +2 -0
- package/lib/components/chips/chip/DeleteIcon.js +7 -0
- package/lib/components/chips/chip-container/ChipContainer.d.ts +8 -8
- package/lib/components/chips/chip-container/ChipContainer.js +17 -0
- package/lib/components/link-button/LinkButton.d.ts +10 -10
- package/lib/components/link-button/LinkButton.js +26 -0
- package/lib/components/loading-indicator/LoadingIndicator.d.ts +7 -7
- package/lib/components/loading-indicator/LoadingIndicator.js +40 -0
- package/lib/components/modals/AlertModal.d.ts +14 -14
- package/lib/components/modals/AlertModal.js +76 -0
- package/lib/components/modals/ConfirmModal.d.ts +13 -13
- package/lib/components/modals/ConfirmModal.js +56 -0
- package/lib/components/modals/Modal.d.ts +11 -11
- package/lib/components/modals/Modal.js +76 -0
- package/lib/components/modals/ModalFooter.d.ts +4 -4
- package/lib/components/modals/ModalFooter.js +18 -0
- package/lib/components/modals/Prompt.d.ts +16 -16
- package/lib/components/modals/Prompt.js +65 -0
- package/lib/components/pagination/Pagination.d.ts +17 -17
- package/lib/components/pagination/Pagination.js +107 -0
- package/lib/components/popovers/legend/Legend.d.ts +12 -12
- package/lib/components/popovers/legend/Legend.js +25 -0
- package/lib/components/popovers/popover/Popover.d.ts +18 -18
- package/lib/components/popovers/popover/Popover.js +109 -0
- package/lib/components/popovers/popover-menu/PopoverMenu.d.ts +15 -15
- package/lib/components/popovers/popover-menu/PopoverMenu.js +54 -0
- package/lib/components/popovers/tooltip/Tooltip.d.ts +10 -10
- package/lib/components/popovers/tooltip/Tooltip.js +64 -0
- package/lib/components/progress/Progress.d.ts +9 -9
- package/lib/components/progress/Progress.js +32 -0
- package/lib/components/search-input/ClearButton.d.ts +2 -0
- package/lib/components/search-input/ClearButton.js +10 -0
- package/lib/components/search-input/SearchInput.d.ts +15 -0
- package/lib/components/search-input/SearchInput.js +75 -0
- package/lib/components/search-input/SearchSuggestion.d.ts +17 -0
- package/lib/components/search-input/SearchSuggestion.js +32 -0
- package/lib/components/search-input/useSearchInput.d.ts +13 -0
- package/lib/components/search-input/useSearchInput.js +94 -0
- package/lib/components/snackbar/Snackbar.d.ts +23 -23
- package/lib/components/snackbar/Snackbar.js +87 -0
- package/lib/components/snackbar/SnackbarContext.d.ts +8 -8
- package/lib/components/snackbar/SnackbarContext.js +2 -0
- package/lib/components/snackbar/SnackbarProvider.d.ts +8 -8
- package/lib/components/snackbar/SnackbarProvider.js +58 -0
- package/lib/components/snackbar/useSnackbar.d.ts +3 -3
- package/lib/components/snackbar/useSnackbar.js +3 -0
- package/lib/components/stepper-horizontal/StepperHorizontal.d.ts +7 -7
- package/lib/components/stepper-horizontal/StepperHorizontal.js +62 -0
- package/lib/components/stepper-horizontal/step-horizontal/StepHorizontal.d.ts +7 -7
- package/lib/components/stepper-horizontal/step-horizontal/StepHorizontal.js +23 -0
- package/lib/components/stepper-vertical/StepperVertical.d.ts +7 -7
- package/lib/components/stepper-vertical/StepperVertical.js +37 -0
- package/lib/components/stepper-vertical/step-vertical/StepVertical.d.ts +12 -12
- package/lib/components/stepper-vertical/step-vertical/StepVertical.js +77 -0
- package/lib/components/tab/Tabs.d.ts +23 -23
- package/lib/components/tab/Tabs.js +229 -0
- package/lib/components/tab/interfaces.d.ts +5 -0
- package/lib/components/tab/interfaces.js +1 -0
- package/lib/components/tab/tab-pane/TabPane.d.ts +11 -13
- package/lib/components/tab/tab-pane/TabPane.js +23 -0
- package/lib/components/tab/useTabScroll.d.ts +24 -24
- package/lib/components/tab/useTabScroll.js +233 -0
- package/lib/components/table-header-cell/TableHeaderCell.d.ts +7 -7
- package/lib/components/table-header-cell/TableHeaderCell.js +21 -0
- package/lib/forms/checkbox/Checkbox.d.ts +16 -16
- package/lib/forms/checkbox/Checkbox.js +88 -0
- package/lib/forms/color-indicator/ColorIndicator.d.ts +12 -12
- package/lib/forms/color-indicator/ColorIndicator.js +122 -0
- package/lib/forms/color-picker/ColorHelper.d.ts +9 -9
- package/lib/forms/color-picker/ColorHelper.js +142 -0
- package/lib/forms/color-picker/ColorPicker.d.ts +15 -15
- package/lib/forms/color-picker/ColorPicker.js +539 -0
- package/lib/forms/date-picker/DatePicker.d.ts +22 -21
- package/lib/forms/date-picker/DatePicker.js +124 -0
- package/lib/forms/date-range-picker/DateRangePicker.d.ts +20 -20
- package/lib/forms/date-range-picker/DateRangePicker.js +135 -0
- package/lib/forms/radio/RadioButton.d.ts +15 -15
- package/lib/forms/radio/RadioButton.js +56 -0
- package/lib/forms/radio/RadioGroup.d.ts +13 -13
- package/lib/forms/radio/RadioGroup.js +35 -0
- package/lib/forms/radio/RadioGroupContext.d.ts +12 -12
- package/lib/forms/radio/RadioGroupContext.js +3 -0
- package/lib/forms/segment/Segment.d.ts +14 -14
- package/lib/forms/segment/Segment.js +77 -0
- package/lib/forms/segment/segment-control/SegmentControl.d.ts +15 -15
- package/lib/forms/segment/segment-control/SegmentControl.js +64 -0
- package/lib/forms/select/Select.d.ts +26 -26
- package/lib/forms/select/Select.js +281 -0
- package/lib/forms/select/select-option/SelectOption.d.ts +10 -10
- package/lib/forms/select/select-option/SelectOption.js +16 -0
- package/lib/forms/slider/Slider.d.ts +18 -17
- package/lib/forms/slider/Slider.js +92 -0
- package/lib/forms/switch/Switch.d.ts +13 -12
- package/lib/forms/switch/Switch.js +51 -0
- package/lib/forms/text-area/TextArea.d.ts +22 -21
- package/lib/forms/text-area/TextArea.js +108 -0
- package/lib/forms/text-editor/TextEditor.d.ts +29 -29
- package/lib/forms/text-editor/TextEditor.js +255 -0
- package/lib/forms/text-editor/TextEditorButton.d.ts +14 -14
- package/lib/forms/text-editor/TextEditorButton.js +82 -0
- package/lib/forms/text-input/TextInput.d.ts +21 -21
- package/lib/forms/text-input/TextInput.js +75 -0
- package/lib/forms/time-picker/TimePicker.d.ts +18 -18
- package/lib/forms/time-picker/TimePicker.js +161 -0
- package/lib/forms/time-picker/time-picker-dropdown/TimePickerDropdown.d.ts +12 -12
- package/lib/forms/time-picker/time-picker-dropdown/TimePickerDropdown.js +213 -0
- package/lib/helper/index.d.ts +2 -2
- package/lib/helper/index.js +7 -0
- package/lib/helper/setRef.d.ts +2 -2
- package/lib/helper/setRef.js +7 -0
- package/lib/helper/types.d.ts +7 -7
- package/lib/helper/types.js +1 -0
- package/lib/helper/useControlled.d.ts +6 -6
- package/lib/helper/useControlled.js +18 -0
- package/lib/helper/useForkRef.d.ts +2 -2
- package/lib/helper/useForkRef.js +20 -0
- package/lib/helper/useId.d.ts +1 -0
- package/lib/helper/useId.js +21 -0
- package/lib/helper/useOnClickOutside.d.ts +2 -2
- package/lib/helper/useOnClickOutside.js +18 -0
- package/node/index.js +370 -0
- package/node/lib/components/accordion/Accordion.js +46 -0
- package/node/lib/components/accordion/AccordionContext.js +10 -0
- package/node/lib/components/accordion/accordion-header/AccordionHeader.js +25 -0
- package/node/lib/components/accordion/accordion-item/AccordionItem.js +71 -0
- package/node/lib/components/accordion/accordion-item/AccordionItemContext.js +10 -0
- package/node/lib/components/accordion/accordion-item/accordion-item-body/AccordionItemBody.js +78 -0
- package/node/lib/components/accordion/accordion-item/accordion-item-header/AccordionItemHeader.js +49 -0
- package/node/lib/components/breadcrumb/Breadcrumb.js +52 -0
- package/node/lib/components/buttons/button/Button.js +44 -0
- package/node/lib/components/card/Card.js +21 -0
- package/node/lib/components/card/CardBody.js +25 -0
- package/node/lib/components/card/CardHeader.js +30 -0
- package/node/lib/components/card/CardNotification.js +33 -0
- package/node/lib/components/chips/chip/Chip.js +54 -0
- package/node/lib/components/chips/chip/DeleteIcon.js +13 -0
- package/node/lib/components/chips/chip-container/ChipContainer.js +25 -0
- package/node/lib/components/link-button/LinkButton.js +33 -0
- package/node/lib/components/loading-indicator/LoadingIndicator.js +48 -0
- package/node/lib/components/modals/AlertModal.js +82 -0
- package/node/lib/components/modals/ConfirmModal.js +62 -0
- package/node/lib/components/modals/Modal.js +84 -0
- package/node/lib/components/modals/ModalFooter.js +26 -0
- package/node/lib/components/modals/Prompt.js +72 -0
- package/node/lib/components/pagination/Pagination.js +116 -0
- package/node/lib/components/popovers/legend/Legend.js +32 -0
- package/node/lib/components/popovers/popover/Popover.js +117 -0
- package/node/lib/components/popovers/popover-menu/PopoverMenu.js +61 -0
- package/node/lib/components/popovers/tooltip/Tooltip.js +70 -0
- package/node/lib/components/progress/Progress.js +40 -0
- package/node/lib/components/search-input/ClearButton.js +16 -0
- package/node/lib/components/search-input/SearchInput.js +82 -0
- package/node/lib/components/search-input/SearchSuggestion.js +39 -0
- package/node/lib/components/search-input/useSearchInput.js +101 -0
- package/node/lib/components/snackbar/Snackbar.js +94 -0
- package/node/lib/components/snackbar/SnackbarContext.js +10 -0
- package/node/lib/components/snackbar/SnackbarProvider.js +65 -0
- package/node/lib/components/snackbar/useSnackbar.js +11 -0
- package/node/lib/components/stepper-horizontal/StepperHorizontal.js +70 -0
- package/node/lib/components/stepper-horizontal/step-horizontal/StepHorizontal.js +31 -0
- package/node/lib/components/stepper-vertical/StepperVertical.js +47 -0
- package/node/lib/components/stepper-vertical/step-vertical/StepVertical.js +84 -0
- package/node/lib/components/tab/Tabs.js +237 -0
- package/node/lib/components/tab/interfaces.js +5 -0
- package/node/lib/components/tab/tab-pane/TabPane.js +31 -0
- package/node/lib/components/tab/useTabScroll.js +236 -0
- package/node/lib/components/table-header-cell/TableHeaderCell.js +29 -0
- package/node/lib/forms/checkbox/Checkbox.js +97 -0
- package/node/lib/forms/color-indicator/ColorIndicator.js +130 -0
- package/node/lib/forms/color-picker/ColorHelper.js +149 -0
- package/node/lib/forms/color-picker/ColorPicker.js +549 -0
- package/node/lib/forms/date-picker/DatePicker.js +131 -0
- package/node/lib/forms/date-range-picker/DateRangePicker.js +142 -0
- package/node/lib/forms/radio/RadioButton.js +63 -0
- package/node/lib/forms/radio/RadioGroup.js +43 -0
- package/node/lib/forms/radio/RadioGroupContext.js +10 -0
- package/node/lib/forms/segment/Segment.js +84 -0
- package/node/lib/forms/segment/segment-control/SegmentControl.js +72 -0
- package/node/lib/forms/select/Select.js +289 -0
- package/node/lib/forms/select/select-option/SelectOption.js +26 -0
- package/node/lib/forms/slider/Slider.js +101 -0
- package/node/lib/forms/switch/Switch.js +58 -0
- package/node/lib/forms/text-area/TextArea.js +117 -0
- package/node/lib/forms/text-editor/TextEditor.js +261 -0
- package/node/lib/forms/text-editor/TextEditorButton.js +88 -0
- package/node/lib/forms/text-input/TextInput.js +84 -0
- package/node/lib/forms/time-picker/TimePicker.js +169 -0
- package/node/lib/forms/time-picker/time-picker-dropdown/TimePickerDropdown.js +222 -0
- package/node/lib/helper/index.js +15 -0
- package/node/lib/helper/setRef.js +13 -0
- package/node/lib/helper/types.js +5 -0
- package/node/lib/helper/useControlled.js +24 -0
- package/node/lib/helper/useForkRef.js +26 -0
- package/node/lib/helper/useId.js +27 -0
- package/node/lib/helper/useOnClickOutside.js +24 -0
- package/package.json +20 -10
- package/README.md +0 -17
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
function SegmentControl(props) {
|
|
7
|
+
const {
|
|
8
|
+
label,
|
|
9
|
+
checked,
|
|
10
|
+
disabled,
|
|
11
|
+
name,
|
|
12
|
+
value,
|
|
13
|
+
icon,
|
|
14
|
+
onChange,
|
|
15
|
+
iconOnly,
|
|
16
|
+
id,
|
|
17
|
+
className
|
|
18
|
+
} = props;
|
|
19
|
+
const componentId = useRef(id ?? (Math.random() * Date.now()).toString().replace('.', '-'));
|
|
20
|
+
let viewMode = 'text';
|
|
21
|
+
if (icon) {
|
|
22
|
+
viewMode = iconOnly ? 'icon' : 'icon-text';
|
|
23
|
+
}
|
|
24
|
+
const prefix = 'fwe-icon-';
|
|
25
|
+
let innerIcon = icon;
|
|
26
|
+
if (icon && icon.indexOf(prefix) === -1) {
|
|
27
|
+
innerIcon = prefix + icon;
|
|
28
|
+
}
|
|
29
|
+
const handleChange = event => {
|
|
30
|
+
if (onChange) {
|
|
31
|
+
onChange(event, value);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
35
|
+
children: [/*#__PURE__*/_jsx("input", {
|
|
36
|
+
className: "fwe-segment-input",
|
|
37
|
+
type: "radio",
|
|
38
|
+
id: componentId.current,
|
|
39
|
+
name: name,
|
|
40
|
+
value: value,
|
|
41
|
+
checked: checked,
|
|
42
|
+
disabled: disabled,
|
|
43
|
+
onChange: e => handleChange(e)
|
|
44
|
+
}), /*#__PURE__*/_jsxs("label", {
|
|
45
|
+
className: classNames('fwe-segment-label', className),
|
|
46
|
+
htmlFor: componentId.current,
|
|
47
|
+
children: [viewMode === 'icon' && /*#__PURE__*/_jsxs(_Fragment, {
|
|
48
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
49
|
+
className: "fwe-sr-only",
|
|
50
|
+
children: label
|
|
51
|
+
}), /*#__PURE__*/_jsx("i", {
|
|
52
|
+
"aria-hidden": "true",
|
|
53
|
+
className: classNames('fwe-icon', innerIcon)
|
|
54
|
+
})]
|
|
55
|
+
}), viewMode === 'text' && label, viewMode === 'icon-text' && /*#__PURE__*/_jsxs(_Fragment, {
|
|
56
|
+
children: [/*#__PURE__*/_jsx("i", {
|
|
57
|
+
"aria-hidden": "true",
|
|
58
|
+
className: classNames('fwe-icon', innerIcon)
|
|
59
|
+
}), label]
|
|
60
|
+
})]
|
|
61
|
+
})]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export default SegmentControl;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import React, { ComponentPropsWithoutRef } from 'react';
|
|
2
|
-
import './Select.scss';
|
|
3
|
-
import { SelectOptionType } from './select-option/SelectOption';
|
|
4
|
-
interface Configuration {
|
|
5
|
-
hideLabel?: boolean;
|
|
6
|
-
scroll?: {
|
|
7
|
-
enabled?: boolean;
|
|
8
|
-
viewportSize?: number;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export interface SelectProps extends Omit<ComponentPropsWithoutRef<'div'>, 'onChange'> {
|
|
12
|
-
defaultValue?: any;
|
|
13
|
-
value?: any;
|
|
14
|
-
label?: string;
|
|
15
|
-
options?: SelectOptionType[];
|
|
16
|
-
required?: boolean;
|
|
17
|
-
onChange?: (value: any) => void;
|
|
18
|
-
config?: Configuration;
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
name?: string;
|
|
21
|
-
id?: string;
|
|
22
|
-
hint?: string;
|
|
23
|
-
error?: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export default Select;
|
|
1
|
+
import React, { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import './Select.scss';
|
|
3
|
+
import { SelectOptionType } from './select-option/SelectOption';
|
|
4
|
+
interface Configuration {
|
|
5
|
+
hideLabel?: boolean;
|
|
6
|
+
scroll?: {
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
viewportSize?: number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface SelectProps extends Omit<ComponentPropsWithoutRef<'div'>, 'onChange'> {
|
|
12
|
+
defaultValue?: any;
|
|
13
|
+
value?: any;
|
|
14
|
+
label?: string;
|
|
15
|
+
options?: SelectOptionType[];
|
|
16
|
+
required?: boolean;
|
|
17
|
+
onChange?: (value: any) => void;
|
|
18
|
+
config?: Configuration;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
name?: string;
|
|
21
|
+
id?: string;
|
|
22
|
+
hint?: string;
|
|
23
|
+
error?: string;
|
|
24
|
+
}
|
|
25
|
+
declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLDivElement>>;
|
|
26
|
+
export default Select;
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef, useCallback, forwardRef } from 'react';
|
|
2
|
+
import OutsideClickHandler from 'react-outside-click-handler';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { SelectOption } from './select-option/SelectOption';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
function calcVirtualScrollHeight(config, itemLength) {
|
|
9
|
+
const defaultHeight = 48;
|
|
10
|
+
let height = defaultHeight;
|
|
11
|
+
if (itemLength === 2) {
|
|
12
|
+
height = defaultHeight * 2;
|
|
13
|
+
} else if (itemLength >= 3) {
|
|
14
|
+
height = defaultHeight * 3;
|
|
15
|
+
}
|
|
16
|
+
if (config?.scroll?.viewportSize != null && config.scroll.viewportSize !== undefined) {
|
|
17
|
+
if (itemLength >= config.scroll.viewportSize) {
|
|
18
|
+
height = config.scroll.viewportSize * defaultHeight;
|
|
19
|
+
} else if (itemLength < config.scroll.viewportSize) {
|
|
20
|
+
height = itemLength * defaultHeight;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return height;
|
|
24
|
+
}
|
|
25
|
+
const Select = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
26
|
+
let {
|
|
27
|
+
defaultValue,
|
|
28
|
+
value,
|
|
29
|
+
label,
|
|
30
|
+
options,
|
|
31
|
+
onChange,
|
|
32
|
+
required = false,
|
|
33
|
+
config,
|
|
34
|
+
disabled,
|
|
35
|
+
className,
|
|
36
|
+
name,
|
|
37
|
+
id,
|
|
38
|
+
children,
|
|
39
|
+
hint,
|
|
40
|
+
error,
|
|
41
|
+
...props
|
|
42
|
+
} = _ref;
|
|
43
|
+
const [optionsWrapper, setOptionsWrapper] = useState({
|
|
44
|
+
isFocused: false,
|
|
45
|
+
action: ''
|
|
46
|
+
});
|
|
47
|
+
const controlled = value !== undefined;
|
|
48
|
+
const [innerValue, setInnerValue] = useState(controlled ? value : defaultValue);
|
|
49
|
+
const buttonEl = useRef(null);
|
|
50
|
+
const childrenList = [];
|
|
51
|
+
React.Children.forEach(children, element => {
|
|
52
|
+
if ( /*#__PURE__*/React.isValidElement(element)) {
|
|
53
|
+
childrenList.push({
|
|
54
|
+
...element,
|
|
55
|
+
props: {
|
|
56
|
+
...element.props,
|
|
57
|
+
className: 'fwe-select-option-content'
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
const usedOptions = options ?? childrenList.map(child => child.props.option);
|
|
63
|
+
const listItemRef = useRef(Array.from({
|
|
64
|
+
length: usedOptions.length
|
|
65
|
+
}, () => /*#__PURE__*/React.createRef()));
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (controlled) {
|
|
68
|
+
setInnerValue(value);
|
|
69
|
+
}
|
|
70
|
+
}, [value, controlled]);
|
|
71
|
+
const getSelectedOptionLabel = useCallback(() => {
|
|
72
|
+
if (innerValue !== undefined) {
|
|
73
|
+
return usedOptions.find(option => option.data === innerValue)?.label;
|
|
74
|
+
}
|
|
75
|
+
return undefined;
|
|
76
|
+
}, [usedOptions, innerValue]);
|
|
77
|
+
const scroll = config?.scroll;
|
|
78
|
+
function handleButtonFocus(blur) {
|
|
79
|
+
if (buttonEl && buttonEl.current) {
|
|
80
|
+
if (blur) {
|
|
81
|
+
buttonEl.current.blur();
|
|
82
|
+
} else {
|
|
83
|
+
buttonEl.current.focus();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const focusNextElement = nextIndex => {
|
|
88
|
+
if (listItemRef && listItemRef.current) {
|
|
89
|
+
const nextItem = listItemRef.current[nextIndex].current;
|
|
90
|
+
if (nextItem !== null) {
|
|
91
|
+
nextItem.focus();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if (optionsWrapper.isFocused) {
|
|
97
|
+
if (optionsWrapper.action === 'key') {
|
|
98
|
+
const index = usedOptions.findIndex(option => option.label === getSelectedOptionLabel());
|
|
99
|
+
if (index >= 0) {
|
|
100
|
+
focusNextElement(index);
|
|
101
|
+
}
|
|
102
|
+
} else if (optionsWrapper.action === 'click') {
|
|
103
|
+
handleButtonFocus(true);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}, [optionsWrapper, usedOptions, innerValue, getSelectedOptionLabel]);
|
|
107
|
+
const handleOptionChange = newOption => {
|
|
108
|
+
if (!controlled) {
|
|
109
|
+
setInnerValue(newOption.data);
|
|
110
|
+
}
|
|
111
|
+
if (onChange) {
|
|
112
|
+
onChange(newOption.data);
|
|
113
|
+
}
|
|
114
|
+
setOptionsWrapper(prevOptionsWrapper => ({
|
|
115
|
+
...prevOptionsWrapper,
|
|
116
|
+
isFocused: false
|
|
117
|
+
}));
|
|
118
|
+
if (buttonEl && buttonEl.current) {
|
|
119
|
+
buttonEl.current.focus();
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
const handleListKeyDown = (event, option, index) => {
|
|
123
|
+
const arrowKeys = ['ArrowDown', 'ArrowUp'];
|
|
124
|
+
const validKeys = ['Enter', ' '];
|
|
125
|
+
if (arrowKeys.concat(validKeys).includes(event.key)) {
|
|
126
|
+
event.preventDefault();
|
|
127
|
+
}
|
|
128
|
+
if (event.key === 'ArrowDown') {
|
|
129
|
+
focusNextElement((index + 1) % usedOptions.length);
|
|
130
|
+
}
|
|
131
|
+
if (event.key === 'ArrowUp') {
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
let nextIndex = (index - 1) % usedOptions.length;
|
|
134
|
+
if (nextIndex < 0) {
|
|
135
|
+
nextIndex += usedOptions.length;
|
|
136
|
+
}
|
|
137
|
+
focusNextElement(nextIndex);
|
|
138
|
+
}
|
|
139
|
+
if (validKeys.includes(event.key)) {
|
|
140
|
+
handleOptionChange(option);
|
|
141
|
+
event.preventDefault();
|
|
142
|
+
}
|
|
143
|
+
if (event.key === 'Escape') {
|
|
144
|
+
setOptionsWrapper(prevOptionsWrapper => ({
|
|
145
|
+
...prevOptionsWrapper,
|
|
146
|
+
isFocused: false
|
|
147
|
+
}));
|
|
148
|
+
handleButtonFocus();
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const handleKeyPress = event => {
|
|
152
|
+
const validKeys = ['Enter', ' ', 'ArrowUp', 'ArrowDown'];
|
|
153
|
+
if (validKeys.includes(event.key)) {
|
|
154
|
+
event.preventDefault();
|
|
155
|
+
if (!disabled) {
|
|
156
|
+
setOptionsWrapper(prevOptionsWrapper => ({
|
|
157
|
+
action: 'key',
|
|
158
|
+
isFocused: !prevOptionsWrapper.isFocused
|
|
159
|
+
}));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
const handleClick = e => {
|
|
164
|
+
e.stopPropagation();
|
|
165
|
+
if (!disabled) {
|
|
166
|
+
setOptionsWrapper(prevOptionsWrapper => ({
|
|
167
|
+
action: '',
|
|
168
|
+
isFocused: !prevOptionsWrapper.isFocused
|
|
169
|
+
}));
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
const selectedOptionLabel = getSelectedOptionLabel();
|
|
173
|
+
const selectClassName = classNames('fwe-select', {
|
|
174
|
+
'fwe-focus': optionsWrapper.isFocused
|
|
175
|
+
}, {
|
|
176
|
+
'fwe-empty': selectedOptionLabel === undefined && !optionsWrapper.isFocused
|
|
177
|
+
}, {
|
|
178
|
+
'fwe-required': required
|
|
179
|
+
}, {
|
|
180
|
+
'fwe-disabled': disabled
|
|
181
|
+
}, {
|
|
182
|
+
'fwe-invalid': error
|
|
183
|
+
});
|
|
184
|
+
function renderOptions() {
|
|
185
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
186
|
+
children: [options && options.map((option, i) => /*#__PURE__*/_jsx("li", {
|
|
187
|
+
ref: listItemRef.current[i],
|
|
188
|
+
role: "option",
|
|
189
|
+
"aria-selected": option.label === selectedOptionLabel,
|
|
190
|
+
onClick: () => handleOptionChange(option),
|
|
191
|
+
className: classNames('fwe-select-option', {
|
|
192
|
+
'fwe-empty': !option.label
|
|
193
|
+
}),
|
|
194
|
+
onKeyDown: e => handleListKeyDown(e, option, i),
|
|
195
|
+
tabIndex: 0,
|
|
196
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
197
|
+
className: "fwe-select-option-content",
|
|
198
|
+
children: option.label
|
|
199
|
+
})
|
|
200
|
+
}, option.data)), childrenList.map((child, i) => {
|
|
201
|
+
const {
|
|
202
|
+
option,
|
|
203
|
+
...propsWithoutOption
|
|
204
|
+
} = child.props;
|
|
205
|
+
return /*#__PURE__*/_jsx("li", {
|
|
206
|
+
ref: listItemRef.current[i],
|
|
207
|
+
role: "option",
|
|
208
|
+
"aria-selected": option.label === selectedOptionLabel,
|
|
209
|
+
onClick: () => handleOptionChange(option),
|
|
210
|
+
className: classNames('fwe-select-option', {
|
|
211
|
+
'fwe-empty': !option.label
|
|
212
|
+
}),
|
|
213
|
+
onKeyDown: e => handleListKeyDown(e, option, i),
|
|
214
|
+
tabIndex: 0,
|
|
215
|
+
children: /*#__PURE__*/_jsx(SelectOption, {
|
|
216
|
+
...propsWithoutOption
|
|
217
|
+
})
|
|
218
|
+
}, option.data);
|
|
219
|
+
})]
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
return /*#__PURE__*/_jsx(OutsideClickHandler, {
|
|
223
|
+
onOutsideClick: () => setOptionsWrapper({
|
|
224
|
+
action: '',
|
|
225
|
+
isFocused: false
|
|
226
|
+
}),
|
|
227
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
228
|
+
ref: ref,
|
|
229
|
+
className: classNames('fwe-select-wrapper', className),
|
|
230
|
+
...props,
|
|
231
|
+
children: [/*#__PURE__*/_jsx("select", {
|
|
232
|
+
defaultValue: defaultValue,
|
|
233
|
+
value: innerValue,
|
|
234
|
+
name: name,
|
|
235
|
+
id: id,
|
|
236
|
+
"aria-label": label,
|
|
237
|
+
disabled: disabled,
|
|
238
|
+
required: required,
|
|
239
|
+
children: usedOptions.map(option => /*#__PURE__*/_jsx("option", {
|
|
240
|
+
value: option.data,
|
|
241
|
+
children: option.label
|
|
242
|
+
}, option.data))
|
|
243
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
244
|
+
role: "button",
|
|
245
|
+
tabIndex: 0,
|
|
246
|
+
className: selectClassName,
|
|
247
|
+
onClick: e => handleClick(e),
|
|
248
|
+
ref: buttonEl,
|
|
249
|
+
onKeyDown: handleKeyPress,
|
|
250
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
251
|
+
className: "fwe-select-content",
|
|
252
|
+
children: selectedOptionLabel
|
|
253
|
+
})
|
|
254
|
+
}), /*#__PURE__*/_jsx("label", {
|
|
255
|
+
className: classNames('fwe-select-label', {
|
|
256
|
+
'fwe-sr-only': config?.hideLabel
|
|
257
|
+
}),
|
|
258
|
+
htmlFor: id,
|
|
259
|
+
children: label || ''
|
|
260
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
261
|
+
className: "fwe-select-underline"
|
|
262
|
+
}), hint && !error && /*#__PURE__*/_jsx("div", {
|
|
263
|
+
className: "fwe-select-description",
|
|
264
|
+
children: hint
|
|
265
|
+
}), error && /*#__PURE__*/_jsxs("div", {
|
|
266
|
+
className: "fwe-select-invalid",
|
|
267
|
+
children: [" ", error, " "]
|
|
268
|
+
}), /*#__PURE__*/_jsx("ul", {
|
|
269
|
+
className: `fwe-select-options-container${optionsWrapper.isFocused ? '' : ' fwe-d-none'}`,
|
|
270
|
+
children: scroll?.enabled ? /*#__PURE__*/_jsx("div", {
|
|
271
|
+
className: "fr-select-scroll",
|
|
272
|
+
style: {
|
|
273
|
+
height: calcVirtualScrollHeight(config, usedOptions.length)
|
|
274
|
+
},
|
|
275
|
+
children: renderOptions()
|
|
276
|
+
}) : renderOptions()
|
|
277
|
+
})]
|
|
278
|
+
})
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
export default Select;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface SelectOptionType {
|
|
3
|
-
label: string;
|
|
4
|
-
data: any;
|
|
5
|
-
}
|
|
6
|
-
interface SelectOptionProps extends React.ComponentPropsWithoutRef<'span'> {
|
|
7
|
-
option: SelectOptionType;
|
|
8
|
-
}
|
|
9
|
-
export declare const SelectOption: React.ForwardRefExoticComponent<SelectOptionProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
-
export default SelectOption;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SelectOptionType {
|
|
3
|
+
label: string;
|
|
4
|
+
data: any;
|
|
5
|
+
}
|
|
6
|
+
interface SelectOptionProps extends React.ComponentPropsWithoutRef<'span'> {
|
|
7
|
+
option: SelectOptionType;
|
|
8
|
+
}
|
|
9
|
+
export declare const SelectOption: React.ForwardRefExoticComponent<SelectOptionProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export default SelectOption;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
export const SelectOption = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
4
|
+
let {
|
|
5
|
+
children,
|
|
6
|
+
className,
|
|
7
|
+
...props
|
|
8
|
+
} = _ref;
|
|
9
|
+
return /*#__PURE__*/_jsx("span", {
|
|
10
|
+
ref: ref,
|
|
11
|
+
className: className,
|
|
12
|
+
...props,
|
|
13
|
+
children: children
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
export default SelectOption;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ClassNameProps } from '../../helper/types';
|
|
3
|
-
import './Slider.scss';
|
|
4
|
-
interface SliderProps extends ClassNameProps {
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
min: number;
|
|
7
|
-
max: number;
|
|
8
|
-
step?: number;
|
|
9
|
-
value: number;
|
|
10
|
-
onChangeCommitted?: (value: number) => void;
|
|
11
|
-
label?: string;
|
|
12
|
-
large?: boolean;
|
|
13
|
-
showValue?: boolean;
|
|
14
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: number) => void;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ClassNameProps } from '../../helper/types';
|
|
3
|
+
import './Slider.scss';
|
|
4
|
+
interface SliderProps extends ClassNameProps {
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
min: number;
|
|
7
|
+
max: number;
|
|
8
|
+
step?: number;
|
|
9
|
+
value: number;
|
|
10
|
+
onChangeCommitted?: (value: number) => void;
|
|
11
|
+
label?: string;
|
|
12
|
+
large?: boolean;
|
|
13
|
+
showValue?: boolean;
|
|
14
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: number) => void;
|
|
15
|
+
id?: string;
|
|
16
|
+
}
|
|
17
|
+
declare function Slider({ disabled, label, large, max, min, onChange, onChangeCommitted, step, value, showValue, className, id: idProps, }: SliderProps): JSX.Element;
|
|
18
|
+
export default Slider;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import useId from '../../helper/useId';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
function Slider(_ref) {
|
|
7
|
+
let {
|
|
8
|
+
disabled = false,
|
|
9
|
+
label,
|
|
10
|
+
large = false,
|
|
11
|
+
max,
|
|
12
|
+
min,
|
|
13
|
+
onChange,
|
|
14
|
+
onChangeCommitted,
|
|
15
|
+
step,
|
|
16
|
+
value,
|
|
17
|
+
showValue = true,
|
|
18
|
+
className,
|
|
19
|
+
id: idProps
|
|
20
|
+
} = _ref;
|
|
21
|
+
const id = useId(idProps);
|
|
22
|
+
const [innerValue, setInnerValue] = useState(value);
|
|
23
|
+
const [left, setLeft] = useState(null);
|
|
24
|
+
const labelEl = useRef(null);
|
|
25
|
+
const classes = classNames('fwe-slider', {
|
|
26
|
+
'fwe-slider-lg': large
|
|
27
|
+
}, {
|
|
28
|
+
'fr-slider-label': label !== null && showValue
|
|
29
|
+
}, className);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setInnerValue(value);
|
|
32
|
+
}, [value]);
|
|
33
|
+
const updateValuePosition = useCallback(() => {
|
|
34
|
+
if (labelEl.current) {
|
|
35
|
+
const {
|
|
36
|
+
width
|
|
37
|
+
} = labelEl.current.getBoundingClientRect();
|
|
38
|
+
const diff = max - min;
|
|
39
|
+
setLeft((innerValue - min) / diff * (width - 16));
|
|
40
|
+
}
|
|
41
|
+
}, [innerValue, max, min]);
|
|
42
|
+
const handleAfterChange = () => {
|
|
43
|
+
if (onChangeCommitted) {
|
|
44
|
+
onChangeCommitted(innerValue);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const handleChange = e => {
|
|
48
|
+
const newValue = Number.parseFloat(e.target.value);
|
|
49
|
+
setInnerValue(newValue);
|
|
50
|
+
if (onChange) {
|
|
51
|
+
onChange(e, newValue);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
function handleResize() {
|
|
56
|
+
updateValuePosition();
|
|
57
|
+
}
|
|
58
|
+
window.addEventListener('resize', handleResize);
|
|
59
|
+
handleResize();
|
|
60
|
+
|
|
61
|
+
// Remove event listener on cleanup
|
|
62
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
63
|
+
}, [updateValuePosition]);
|
|
64
|
+
return /*#__PURE__*/_jsxs("label", {
|
|
65
|
+
ref: labelEl,
|
|
66
|
+
className: classes,
|
|
67
|
+
htmlFor: id,
|
|
68
|
+
children: [label && /*#__PURE__*/_jsx("span", {
|
|
69
|
+
children: label
|
|
70
|
+
}), /*#__PURE__*/_jsx("input", {
|
|
71
|
+
id: id,
|
|
72
|
+
className: "fwe-slider-input",
|
|
73
|
+
type: "range",
|
|
74
|
+
disabled: disabled,
|
|
75
|
+
min: min,
|
|
76
|
+
max: max,
|
|
77
|
+
step: step,
|
|
78
|
+
onChange: handleChange,
|
|
79
|
+
value: innerValue,
|
|
80
|
+
onKeyUp: handleAfterChange,
|
|
81
|
+
onMouseUp: handleAfterChange,
|
|
82
|
+
onTouchEnd: handleAfterChange
|
|
83
|
+
}), showValue && left !== null && /*#__PURE__*/_jsx("span", {
|
|
84
|
+
className: "fr-slider-value",
|
|
85
|
+
style: {
|
|
86
|
+
left: `${left}px`
|
|
87
|
+
},
|
|
88
|
+
children: innerValue
|
|
89
|
+
})]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
export default Slider;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ClassNameProps } from '../../helper/types';
|
|
3
|
-
export interface SwitchProps extends ClassNameProps {
|
|
4
|
-
labelPosition?: 'before' | 'after' | 'below';
|
|
5
|
-
large?: boolean;
|
|
6
|
-
title: string;
|
|
7
|
-
value: boolean;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
onChange?: (value: boolean) => void;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ClassNameProps } from '../../helper/types';
|
|
3
|
+
export interface SwitchProps extends ClassNameProps {
|
|
4
|
+
labelPosition?: 'before' | 'after' | 'below';
|
|
5
|
+
large?: boolean;
|
|
6
|
+
title: string;
|
|
7
|
+
value: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
onChange?: (value: boolean) => void;
|
|
10
|
+
id?: string;
|
|
11
|
+
}
|
|
12
|
+
declare function Switch({ labelPosition, large, title, value, disabled, onChange, className, id: idProps, }: SwitchProps): JSX.Element;
|
|
13
|
+
export default Switch;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import useId from '../../helper/useId';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
function Switch(_ref) {
|
|
7
|
+
let {
|
|
8
|
+
labelPosition = 'before',
|
|
9
|
+
large = false,
|
|
10
|
+
title,
|
|
11
|
+
value,
|
|
12
|
+
disabled = false,
|
|
13
|
+
onChange,
|
|
14
|
+
className,
|
|
15
|
+
id: idProps
|
|
16
|
+
} = _ref;
|
|
17
|
+
const id = useId(idProps);
|
|
18
|
+
const labelClassName = classNames('fwe-switch', {
|
|
19
|
+
[`fwe-switch-label-${labelPosition}`]: true
|
|
20
|
+
}, {
|
|
21
|
+
'fwe-switch-lg': large
|
|
22
|
+
}, className);
|
|
23
|
+
const [currentValue, setCurrentValue] = useState(value);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
setCurrentValue(value);
|
|
26
|
+
}, [value]);
|
|
27
|
+
const handleChange = () => {
|
|
28
|
+
const newValue = !currentValue;
|
|
29
|
+
setCurrentValue(newValue);
|
|
30
|
+
if (onChange) {
|
|
31
|
+
onChange(newValue);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return /*#__PURE__*/_jsxs("label", {
|
|
35
|
+
className: labelClassName,
|
|
36
|
+
htmlFor: id,
|
|
37
|
+
children: [/*#__PURE__*/_jsx("input", {
|
|
38
|
+
type: "checkbox",
|
|
39
|
+
disabled: disabled,
|
|
40
|
+
checked: currentValue,
|
|
41
|
+
onChange: () => handleChange(),
|
|
42
|
+
id: id
|
|
43
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
44
|
+
className: "fwe-switch-track"
|
|
45
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
46
|
+
className: "fwe-switch-label-content",
|
|
47
|
+
children: title
|
|
48
|
+
})]
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export default Switch;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ClassNameProps } from '../../helper/types';
|
|
3
|
-
import './TextArea.scss';
|
|
4
|
-
interface TextAreaProps extends ClassNameProps {
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
required?: boolean;
|
|
7
|
-
readonly?: boolean;
|
|
8
|
-
onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
9
|
-
onFocus?: (event: React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
10
|
-
onInput?: (event: React.FormEvent<HTMLTextAreaElement>) => void;
|
|
11
|
-
onBlur?: (event: React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
12
|
-
label: string;
|
|
13
|
-
hint?: string;
|
|
14
|
-
error?: string;
|
|
15
|
-
value?: string;
|
|
16
|
-
defaultValue?: string;
|
|
17
|
-
rows?: number;
|
|
18
|
-
maxLength: number;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ClassNameProps } from '../../helper/types';
|
|
3
|
+
import './TextArea.scss';
|
|
4
|
+
interface TextAreaProps extends ClassNameProps {
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
readonly?: boolean;
|
|
8
|
+
onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
9
|
+
onFocus?: (event: React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
10
|
+
onInput?: (event: React.FormEvent<HTMLTextAreaElement>) => void;
|
|
11
|
+
onBlur?: (event: React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
12
|
+
label: string;
|
|
13
|
+
hint?: string;
|
|
14
|
+
error?: string;
|
|
15
|
+
value?: string;
|
|
16
|
+
defaultValue?: string;
|
|
17
|
+
rows?: number;
|
|
18
|
+
maxLength: number;
|
|
19
|
+
id?: string;
|
|
20
|
+
}
|
|
21
|
+
declare function TextArea({ disabled, onBlur, onChange, onFocus, onInput, readonly, required, label, error, hint, value, rows, maxLength, className, id: idProps, defaultValue, }: TextAreaProps): JSX.Element;
|
|
22
|
+
export default TextArea;
|