@festo-ui/react 9.0.1-dev.809 → 9.0.1-dev.817
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/components/accordion/Accordion.d.ts +3 -3
- package/dist/components/accordion/Accordion.js +2 -1
- package/dist/components/accordion/accordion-header/AccordionHeader.js +1 -0
- package/dist/components/accordion/accordion-item/AccordionItem.d.ts +1 -1
- package/dist/components/accordion/accordion-item/AccordionItem.js +2 -1
- package/dist/components/accordion/accordion-item/accordion-item-body/AccordionItemBody.js +1 -0
- package/dist/components/accordion/accordion-item/accordion-item-header/AccordionItemHeader.js +1 -0
- package/dist/components/bottom-sheet/BottomSheet.d.ts +2 -3
- package/dist/components/bottom-sheet/BottomSheet.js +7 -4
- package/dist/components/breadcrumb/Breadcrumb.d.ts +3 -4
- package/dist/components/breadcrumb/Breadcrumb.js +10 -5
- package/dist/components/button/Button.js +1 -0
- package/dist/components/card/Card.d.ts +3 -5
- package/dist/components/card/Card.js +6 -4
- package/dist/components/card/CardBody.d.ts +3 -3
- package/dist/components/card/CardBody.js +6 -4
- package/dist/components/card/CardHeader.d.ts +3 -3
- package/dist/components/card/CardHeader.js +6 -4
- package/dist/components/card/CardNotification.d.ts +2 -3
- package/dist/components/card/CardNotification.js +6 -2
- package/dist/components/chips/chip/Chip.d.ts +4 -5
- package/dist/components/chips/chip/Chip.js +11 -4
- package/dist/components/chips/chip-container/ChipContainer.d.ts +3 -3
- package/dist/components/chips/chip-container/ChipContainer.js +6 -2
- package/dist/components/loading-indicator/LoadingIndicator.d.ts +2 -2
- package/dist/components/loading-indicator/LoadingIndicator.js +1 -0
- package/dist/components/mobile-flyout/MobileFlyout.js +1 -0
- package/dist/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.d.ts +1 -0
- package/dist/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.js +3 -2
- package/dist/components/mobile-flyout/mobile-flyout-page/MobileFlyoutPage.js +4 -3
- package/dist/components/modals/AlertModal.d.ts +1 -1
- package/dist/components/modals/AlertModal.js +5 -4
- package/dist/components/modals/ConfirmModal.d.ts +1 -1
- package/dist/components/modals/ConfirmModal.js +5 -4
- package/dist/components/modals/CustomModal.js +1 -0
- package/dist/components/modals/Modal.js +1 -0
- package/dist/components/modals/ModalBase.js +1 -0
- package/dist/components/modals/ModalFooter.d.ts +2 -2
- package/dist/components/modals/ModalFooter.js +3 -1
- package/dist/components/modals/Prompt.d.ts +2 -3
- package/dist/components/modals/Prompt.js +9 -6
- package/dist/components/modals/image-gallery/ImageGallery.css +6 -6
- package/dist/components/modals/image-gallery/ImageGallery.d.ts +1 -1
- package/dist/components/modals/image-gallery/ImageGallery.js +1 -0
- package/dist/components/modals/image-gallery/ImageGallerySwiper.js +1 -1
- package/dist/components/pagination/Pagination.d.ts +3 -4
- package/dist/components/pagination/Pagination.js +17 -13
- package/dist/components/popovers/legend/Legend.d.ts +3 -2
- package/dist/components/popovers/legend/Legend.js +5 -2
- package/dist/components/popovers/popover/Popover.css +1 -1
- package/dist/components/popovers/popover/Popover.d.ts +4 -4
- package/dist/components/popovers/popover/Popover.js +14 -5
- package/dist/components/popovers/popover-menu/PopoverMenu.d.ts +4 -2
- package/dist/components/popovers/popover-menu/PopoverMenu.js +5 -3
- package/dist/components/popovers/popover-menu/popover-menu-item/PopoverMenuItem.d.ts +3 -2
- package/dist/components/popovers/popover-menu/popover-menu-item/PopoverMenuItem.js +7 -3
- package/dist/components/popovers/tooltip/Tooltip.d.ts +3 -2
- package/dist/components/popovers/tooltip/Tooltip.js +5 -4
- package/dist/components/progress/Progress.d.ts +2 -3
- package/dist/components/progress/Progress.js +6 -2
- package/dist/components/search-input/ClearButton.d.ts +1 -2
- package/dist/components/search-input/ClearButton.js +5 -4
- package/dist/components/search-input/SearchInput.d.ts +3 -4
- package/dist/components/search-input/SearchInput.js +9 -5
- package/dist/components/snackbar/Snackbar.d.ts +4 -4
- package/dist/components/snackbar/Snackbar.js +11 -7
- package/dist/components/snackbar/SnackbarProvider.d.ts +3 -3
- package/dist/components/snackbar/SnackbarProvider.js +7 -4
- package/dist/components/stepper-horizontal/StepperHorizontal.d.ts +2 -2
- package/dist/components/stepper-horizontal/StepperHorizontal.js +3 -2
- package/dist/components/stepper-horizontal/step-horizontal/StepHorizontal.js +2 -1
- package/dist/components/stepper-vertical/StepperVertical.js +1 -0
- package/dist/components/stepper-vertical/step-vertical/StepVertical.js +1 -0
- package/dist/components/tab/Tabs.js +2 -1
- package/dist/components/tab/tab-pane/TabPane.d.ts +3 -4
- package/dist/components/tab/tab-pane/TabPane.js +6 -2
- package/dist/components/table-header-cell/TableHeaderCell.d.ts +2 -1
- package/dist/components/table-header-cell/TableHeaderCell.js +1 -0
- package/dist/forms/checkbox/Checkbox.d.ts +3 -6
- package/dist/forms/checkbox/Checkbox.js +5 -2
- package/dist/forms/combobox/ComboBox.d.ts +6 -7
- package/dist/forms/combobox/ComboBox.js +2 -3
- package/dist/forms/multi-select/{MultiSelect_module.css → MultiSelect.css} +2 -2
- package/dist/forms/multi-select/MultiSelect.d.ts +2 -2
- package/dist/forms/multi-select/MultiSelect.js +4 -3
- package/dist/forms/radio/RadioButton.d.ts +4 -4
- package/dist/forms/radio/RadioButton.js +11 -10
- package/dist/forms/radio/RadioGroup.d.ts +4 -4
- package/dist/forms/radio/RadioGroup.js +1 -0
- package/dist/forms/segment/Segment.d.ts +4 -5
- package/dist/forms/segment/Segment.js +10 -8
- package/dist/forms/segment/segment-control/SegmentControl.d.ts +4 -8
- package/dist/forms/segment/segment-control/SegmentControl.js +8 -6
- package/dist/forms/select/Select.d.ts +6 -6
- package/dist/forms/select/Select.js +1 -0
- package/dist/forms/slider/Slider.d.ts +4 -7
- package/dist/forms/slider/Slider.js +11 -6
- package/dist/forms/switch/Switch.d.ts +4 -6
- package/dist/forms/switch/Switch.js +12 -6
- package/dist/forms/text-area/TextArea.d.ts +6 -15
- package/dist/forms/text-area/TextArea.js +42 -25
- package/dist/forms/text-input/TextInput.d.ts +5 -4
- package/dist/forms/text-input/TextInput.js +7 -2
- package/dist/forms/time-picker/TimePicker.d.ts +7 -6
- package/dist/forms/time-picker/TimePicker.js +4 -2
- package/dist/forms/time-picker/time-picker-dropdown/TimePickerDropdown.js +1 -0
- package/dist/forms/time-picker/time-picker-dropdown/TimePickerInput.js +1 -0
- package/dist/utils/types.d.ts +0 -13
- package/package.json +2 -9
- package/dist/forms/multi-select/MultiSelect.module.js +0 -8
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "./Snackbar.css";
|
|
3
3
|
import classnames from "classnames";
|
|
4
|
-
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { forwardRef, useEffect, useRef, useState } from "react";
|
|
5
5
|
import { CSSTransition } from "react-transition-group";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { useForkRef } from "../../utils/useForkRef.js";
|
|
7
|
+
const Snackbar = /*#__PURE__*/ forwardRef(({ data, onAction, onClose, first = false, className, ...props }, ref)=>{
|
|
8
8
|
const [show, setShow] = useState(true);
|
|
9
9
|
const nodeRef = useRef(null);
|
|
10
|
+
const handleRef = useForkRef(ref, nodeRef);
|
|
10
11
|
useEffect(()=>{
|
|
11
12
|
let disappearAfter = 5000;
|
|
12
13
|
if (data?.disappearAfter !== null) {
|
|
@@ -34,8 +35,9 @@ function Snackbar(props) {
|
|
|
34
35
|
classNames: classes,
|
|
35
36
|
appear: true,
|
|
36
37
|
children: /*#__PURE__*/ jsx("div", {
|
|
37
|
-
ref:
|
|
38
|
-
className: classes,
|
|
38
|
+
ref: handleRef,
|
|
39
|
+
className: classnames(classes, className),
|
|
40
|
+
...props,
|
|
39
41
|
children: /*#__PURE__*/ jsxs("div", {
|
|
40
42
|
className: classnames({
|
|
41
43
|
'fwe-snackbar': true,
|
|
@@ -45,7 +47,8 @@ function Snackbar(props) {
|
|
|
45
47
|
'fwe-snackbar-warning': data?.type === 'warning',
|
|
46
48
|
'fwe-snackbar-error': data?.type === 'error',
|
|
47
49
|
'fwe-snackbar-shadow': data?.darkBackground
|
|
48
|
-
}
|
|
50
|
+
}),
|
|
51
|
+
"data-testid": data?.['data-testid'],
|
|
49
52
|
children: [
|
|
50
53
|
/*#__PURE__*/ jsx("span", {
|
|
51
54
|
children: data?.text
|
|
@@ -74,5 +77,6 @@ function Snackbar(props) {
|
|
|
74
77
|
})
|
|
75
78
|
})
|
|
76
79
|
});
|
|
77
|
-
}
|
|
80
|
+
});
|
|
81
|
+
Snackbar.displayName = 'Snackbar';
|
|
78
82
|
export { Snackbar };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
import { type SnackbarConfig, type SnackbarData } from './Snackbar';
|
|
3
|
-
export interface SnackbarProviderProps extends
|
|
3
|
+
export interface SnackbarProviderProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
4
4
|
readonly config?: SnackbarConfig;
|
|
5
5
|
}
|
|
6
|
-
export declare
|
|
6
|
+
export declare const SnackbarProvider: (props: SnackbarProviderProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
7
7
|
export declare const addSnackbar: (snackData: SnackbarData, onAction?: () => void, onClose?: () => void) => string | number;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import classnames from "classnames";
|
|
3
|
-
import { useCallback, useMemo, useState } from "react";
|
|
3
|
+
import { forwardRef, useCallback, useMemo, useState } from "react";
|
|
4
4
|
import { Snackbar } from "./Snackbar.js";
|
|
5
5
|
import { SnackbarContext } from "./SnackbarContext.js";
|
|
6
6
|
let addSnackbarFunction;
|
|
7
|
-
|
|
7
|
+
const SnackbarProvider = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
8
8
|
const { config = {
|
|
9
9
|
darkBackground: true
|
|
10
|
-
}, children, className } = props;
|
|
10
|
+
}, children, className, ...rest } = props;
|
|
11
11
|
const [snacks, setSnacks] = useState([]);
|
|
12
12
|
const addSnackbar = useCallback((snackData, onAction, onClose)=>{
|
|
13
13
|
const key = snackData.key ?? Date.now() + Math.random();
|
|
@@ -49,6 +49,8 @@ function SnackbarProvider(props) {
|
|
|
49
49
|
children,
|
|
50
50
|
/*#__PURE__*/ jsx("div", {
|
|
51
51
|
className: classnames('fwe-snackbar-container', className),
|
|
52
|
+
ref: ref,
|
|
53
|
+
...rest,
|
|
52
54
|
children: snacks.map((snack)=>/*#__PURE__*/ jsx(Snackbar, {
|
|
53
55
|
data: snack.data,
|
|
54
56
|
onAction: ()=>snack.onAction ? snack.onAction() : void 0,
|
|
@@ -58,9 +60,10 @@ function SnackbarProvider(props) {
|
|
|
58
60
|
})
|
|
59
61
|
]
|
|
60
62
|
});
|
|
61
|
-
}
|
|
63
|
+
});
|
|
62
64
|
const SnackbarProvider_addSnackbar = (snackData, onAction, onClose)=>{
|
|
63
65
|
if (!addSnackbarFunction) throw new Error('SnackbarProvider is not mounted.');
|
|
64
66
|
return addSnackbarFunction(snackData, onAction, onClose);
|
|
65
67
|
};
|
|
68
|
+
SnackbarProvider.displayName = 'SnackbarProvider';
|
|
66
69
|
export { SnackbarProvider, SnackbarProvider_addSnackbar as addSnackbar };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './StepperHorizontal.scss';
|
|
2
2
|
import React, { type ComponentPropsWithoutRef } from 'react';
|
|
3
|
-
export interface StepperHorizontalProps extends Omit<ComponentPropsWithoutRef<'
|
|
3
|
+
export interface StepperHorizontalProps extends Omit<ComponentPropsWithoutRef<'div'>, 'onChange'> {
|
|
4
4
|
stepIndex?: number;
|
|
5
5
|
onChange?: (stepIndex: number) => void;
|
|
6
6
|
}
|
|
7
|
-
export declare const StepperHorizontal: (props: StepperHorizontalProps & React.RefAttributes<
|
|
7
|
+
export declare const StepperHorizontal: (props: StepperHorizontalProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -14,9 +14,10 @@ const StepperHorizontal = /*#__PURE__*/ forwardRef(({ children, className, stepI
|
|
|
14
14
|
children: [
|
|
15
15
|
/*#__PURE__*/ jsx("div", {
|
|
16
16
|
className: classnames('fwe-stepper-horizontal', className),
|
|
17
|
+
ref: ref,
|
|
18
|
+
...props,
|
|
17
19
|
children: stepComponents?.map((step, i)=>/*#__PURE__*/ jsx("button", {
|
|
18
20
|
type: "button",
|
|
19
|
-
ref: ref,
|
|
20
21
|
className: classnames('fwe-step-container fr-step-container', {
|
|
21
22
|
'fwe-step-done': stepIndex > i,
|
|
22
23
|
'fwe-step-active': i === stepIndex
|
|
@@ -25,7 +26,6 @@ const StepperHorizontal = /*#__PURE__*/ forwardRef(({ children, className, stepI
|
|
|
25
26
|
disabled: stepIndex <= i,
|
|
26
27
|
"aria-label": `Step ${i + 1}: ${step.props.title}`,
|
|
27
28
|
"aria-current": i === stepIndex ? 'step' : void 0,
|
|
28
|
-
...props,
|
|
29
29
|
children: /*#__PURE__*/ jsxs("div", {
|
|
30
30
|
className: "fwe-step",
|
|
31
31
|
children: [
|
|
@@ -45,4 +45,5 @@ const StepperHorizontal = /*#__PURE__*/ forwardRef(({ children, className, stepI
|
|
|
45
45
|
]
|
|
46
46
|
});
|
|
47
47
|
});
|
|
48
|
+
StepperHorizontal.displayName = 'StepperHorizontal';
|
|
48
49
|
export { StepperHorizontal };
|
|
@@ -6,11 +6,12 @@ const StepHorizontal = /*#__PURE__*/ forwardRef(({ children, className, isActive
|
|
|
6
6
|
ref: ref,
|
|
7
7
|
className: classnames('overflow-hidden', {
|
|
8
8
|
hidden: !isActive
|
|
9
|
-
}),
|
|
9
|
+
}, className),
|
|
10
10
|
...props,
|
|
11
11
|
children: /*#__PURE__*/ jsx("div", {
|
|
12
12
|
className: "fr-moving-container",
|
|
13
13
|
children: children
|
|
14
14
|
})
|
|
15
15
|
}));
|
|
16
|
+
StepHorizontal.displayName = 'StepHorizontal';
|
|
16
17
|
export { StepHorizontal };
|
|
@@ -124,7 +124,7 @@ const Tabs = /*#__PURE__*/ forwardRef(({ config, children, className, onChange,
|
|
|
124
124
|
})
|
|
125
125
|
]
|
|
126
126
|
}) : /*#__PURE__*/ jsxs("div", {
|
|
127
|
-
className:
|
|
127
|
+
className: classnames('fr-tab-bar', className),
|
|
128
128
|
role: "tablist",
|
|
129
129
|
ref: combinedRef,
|
|
130
130
|
...props,
|
|
@@ -190,4 +190,5 @@ const Tabs = /*#__PURE__*/ forwardRef(({ config, children, className, onChange,
|
|
|
190
190
|
})
|
|
191
191
|
});
|
|
192
192
|
});
|
|
193
|
+
Tabs.displayName = 'Tabs';
|
|
193
194
|
export { Tabs };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import './TabPane.scss';
|
|
2
|
-
import type
|
|
2
|
+
import type React from 'react';
|
|
3
3
|
import type { Tab } from '../interfaces';
|
|
4
|
-
export interface TabPaneProps extends
|
|
5
|
-
readonly id?: string;
|
|
4
|
+
export interface TabPaneProps extends React.ComponentPropsWithoutRef<'div'>, Tab {
|
|
6
5
|
readonly isVisible?: boolean;
|
|
7
6
|
readonly tabId?: string;
|
|
8
7
|
}
|
|
9
|
-
export declare
|
|
8
|
+
export declare const TabPane: (props: TabPaneProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import "./TabPane.css";
|
|
3
3
|
import classnames from "classnames";
|
|
4
|
-
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
const TabPane = /*#__PURE__*/ forwardRef(({ isVisible = false, children, className, tabId, id, ...props }, ref)=>{
|
|
5
6
|
const tabPaneClasses = classnames({
|
|
6
7
|
'fr-show': isVisible
|
|
7
8
|
}, {
|
|
@@ -12,7 +13,10 @@ function TabPane({ isVisible = false, children, className, tabId, id }) {
|
|
|
12
13
|
role: "tabpanel",
|
|
13
14
|
"aria-labelledby": tabId,
|
|
14
15
|
className: tabPaneClasses,
|
|
16
|
+
ref: ref,
|
|
17
|
+
...props,
|
|
15
18
|
children: children
|
|
16
19
|
});
|
|
17
|
-
}
|
|
20
|
+
});
|
|
21
|
+
TabPane.displayName = 'TabPane';
|
|
18
22
|
export { TabPane };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { type ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export interface TableHeaderCellProps extends ComponentPropsWithoutRef<'th'> {
|
|
2
3
|
readonly active?: boolean;
|
|
3
4
|
readonly ascending: boolean;
|
|
4
5
|
}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import './Checkbox.scss';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { type ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
export interface CheckboxProps extends Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'onChange' | 'checked' | 'defaultChecked'> {
|
|
4
4
|
readonly checked?: boolean;
|
|
5
5
|
readonly defaultChecked?: boolean;
|
|
6
6
|
readonly onChange?: (value: boolean, e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
|
-
readonly name?: string;
|
|
8
7
|
readonly large?: boolean;
|
|
9
8
|
readonly valid?: boolean;
|
|
10
9
|
readonly labelPosition?: 'before' | 'after' | 'below';
|
|
11
|
-
readonly required?: boolean;
|
|
12
|
-
readonly disabled?: boolean;
|
|
13
10
|
readonly indeterminate?: boolean;
|
|
14
11
|
}
|
|
15
|
-
export declare
|
|
12
|
+
export declare const Checkbox: (props: CheckboxProps & import("react").RefAttributes<HTMLLabelElement>) => React.ReactElement | null;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "./Checkbox.css";
|
|
3
3
|
import classnames from "classnames";
|
|
4
|
+
import { forwardRef } from "react";
|
|
4
5
|
import { useControlled } from "../../utils/useControlled.js";
|
|
5
|
-
|
|
6
|
+
const Checkbox = /*#__PURE__*/ forwardRef(({ id, checked: checkedProp, defaultChecked, onChange, name, large = false, valid = true, labelPosition = 'after', required, disabled = false, indeterminate = false, children, className, ...props }, ref)=>{
|
|
6
7
|
const [isChecked, setChecked] = useControlled({
|
|
7
8
|
controlled: checkedProp,
|
|
8
9
|
default: defaultChecked ?? false
|
|
@@ -30,6 +31,7 @@ function Checkbox({ id, checked: checkedProp, defaultChecked, onChange, name, la
|
|
|
30
31
|
return /*#__PURE__*/ jsxs("label", {
|
|
31
32
|
className: containerClasses,
|
|
32
33
|
htmlFor: id,
|
|
34
|
+
ref: ref,
|
|
33
35
|
children: [
|
|
34
36
|
/*#__PURE__*/ jsx("input", {
|
|
35
37
|
name: name,
|
|
@@ -76,5 +78,6 @@ function Checkbox({ id, checked: checkedProp, defaultChecked, onChange, name, la
|
|
|
76
78
|
})
|
|
77
79
|
]
|
|
78
80
|
});
|
|
79
|
-
}
|
|
81
|
+
});
|
|
82
|
+
Checkbox.displayName = 'Checkbox';
|
|
80
83
|
export { Checkbox };
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import './ComboBox.scss';
|
|
2
2
|
import { type Ref } from 'react';
|
|
3
|
-
import type { ComponentBase } from '../../utils/types';
|
|
4
3
|
export interface ComboBoxOption<T> {
|
|
5
4
|
readonly label: string;
|
|
6
5
|
readonly data: T;
|
|
7
6
|
readonly disabled?: boolean;
|
|
8
7
|
}
|
|
9
|
-
export interface ComboBoxProps<T> extends
|
|
10
|
-
readonly defaultValue?: T;
|
|
8
|
+
export interface ComboBoxProps<T> extends Omit<React.ComponentPropsWithoutRef<'div'>, 'onChange' | 'value' | 'defaultValue'> {
|
|
11
9
|
readonly value?: T;
|
|
10
|
+
readonly defaultValue?: T;
|
|
11
|
+
readonly name?: string;
|
|
12
|
+
readonly disabled?: boolean;
|
|
13
|
+
readonly required?: boolean;
|
|
12
14
|
readonly label?: string;
|
|
13
15
|
readonly options?: ComboBoxOption<T>[];
|
|
14
|
-
readonly required?: boolean;
|
|
15
|
-
readonly onChange?: (value: T) => void;
|
|
16
|
-
readonly disabled?: boolean;
|
|
17
|
-
readonly name?: string;
|
|
18
16
|
readonly hint?: string;
|
|
19
17
|
readonly error?: string;
|
|
20
18
|
readonly placeholder?: string;
|
|
19
|
+
readonly onChange?: (value: T) => void;
|
|
21
20
|
readonly onInputChange?: (value: string) => void;
|
|
22
21
|
readonly emptyMessage?: string;
|
|
23
22
|
}
|
|
@@ -106,8 +106,7 @@ function ComboBoxComponent({ defaultValue = '', value: controlled, label, option
|
|
|
106
106
|
}),
|
|
107
107
|
/*#__PURE__*/ jsx(ComboboxButton, {
|
|
108
108
|
className: "fr-combobox-button",
|
|
109
|
-
disabled: disabled
|
|
110
|
-
"aria-label": "Optionen anzeigen"
|
|
109
|
+
disabled: disabled
|
|
111
110
|
})
|
|
112
111
|
]
|
|
113
112
|
}),
|
|
@@ -148,7 +147,6 @@ function ComboBoxComponent({ defaultValue = '', value: controlled, label, option
|
|
|
148
147
|
}),
|
|
149
148
|
children: /*#__PURE__*/ jsx("span", {
|
|
150
149
|
className: "fwe-combobox-option-content",
|
|
151
|
-
"data-testid": "fwe-combobox-option-content",
|
|
152
150
|
children: getHighlightedLabel(option.label, query).map((part, index)=>/*#__PURE__*/ jsx("span", {
|
|
153
151
|
className: classnames({
|
|
154
152
|
'fwe-combobox-highlight': part.highlighted
|
|
@@ -172,4 +170,5 @@ function ComboBoxComponent({ defaultValue = '', value: controlled, label, option
|
|
|
172
170
|
});
|
|
173
171
|
}
|
|
174
172
|
const ComboBox = /*#__PURE__*/ forwardRef(ComboBoxComponent);
|
|
173
|
+
ComboBox.displayName = 'ComboBox';
|
|
175
174
|
export { ComboBox };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
.chip-container
|
|
1
|
+
.fr-multiselect-chip-container {
|
|
2
2
|
flex-wrap: nowrap;
|
|
3
3
|
gap: 8px;
|
|
4
4
|
display: flex;
|
|
5
5
|
overflow: hidden;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
.chip-ellipsis
|
|
8
|
+
.fr-multiselect-chip-ellipsis {
|
|
9
9
|
text-overflow: ellipsis;
|
|
10
10
|
white-space: nowrap;
|
|
11
11
|
overflow: hidden;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Ref } from 'react';
|
|
2
|
-
import type { ComponentBase } from '../../utils/types';
|
|
3
2
|
import type { SelectOption } from '../select/Select';
|
|
4
|
-
|
|
3
|
+
import './MultiSelect.scss';
|
|
4
|
+
export interface MultiSelectProps<T> extends Omit<React.ComponentPropsWithoutRef<'div'>, 'onChange' | 'value' | 'defaultValue'> {
|
|
5
5
|
readonly defaultValue?: T[];
|
|
6
6
|
readonly value?: T[];
|
|
7
7
|
readonly label?: string;
|
|
@@ -4,7 +4,7 @@ import classnames from "classnames";
|
|
|
4
4
|
import { forwardRef, useCallback, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { useControlled } from "../../utils/useControlled.js";
|
|
6
6
|
import { useId } from "../../utils/useId.js";
|
|
7
|
-
import
|
|
7
|
+
import "./MultiSelect.css";
|
|
8
8
|
function MultiSelectComponent({ defaultValue = [], value: controlled, label, options = [], onChange, disabled, name, id: idProp, hint, error, placeholder, className, ...props }, ref) {
|
|
9
9
|
const id = useId(idProp);
|
|
10
10
|
const labelId = `${id}-label`;
|
|
@@ -83,7 +83,7 @@ function MultiSelectComponent({ defaultValue = [], value: controlled, label, opt
|
|
|
83
83
|
disabled: disabled,
|
|
84
84
|
children: selectedOptions.length > 0 ? /*#__PURE__*/ jsxs("span", {
|
|
85
85
|
ref: chipsRef,
|
|
86
|
-
className:
|
|
86
|
+
className: "fr-multiselect-chip-container",
|
|
87
87
|
children: [
|
|
88
88
|
selectedOptions.map((o)=>/*#__PURE__*/ jsx("span", {
|
|
89
89
|
"data-option-chip": "true",
|
|
@@ -95,7 +95,7 @@ function MultiSelectComponent({ defaultValue = [], value: controlled, label, opt
|
|
|
95
95
|
flexShrink: 1 === selectedOptions.length ? 1 : 0
|
|
96
96
|
},
|
|
97
97
|
children: /*#__PURE__*/ jsx("span", {
|
|
98
|
-
className:
|
|
98
|
+
className: "fr-multiselect-chip-ellipsis",
|
|
99
99
|
children: o.label
|
|
100
100
|
})
|
|
101
101
|
}, String(o.data))),
|
|
@@ -188,4 +188,5 @@ function MultiSelectComponent({ defaultValue = [], value: controlled, label, opt
|
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
190
|
const MultiSelect = /*#__PURE__*/ forwardRef(MultiSelectComponent);
|
|
191
|
+
MultiSelect.displayName = 'MultiSelect';
|
|
191
192
|
export { MultiSelect };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export interface RadioButtonProps extends
|
|
1
|
+
import { type ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export interface RadioButtonProps extends Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'onChange' | 'checked' | 'defaultChecked' | 'value'> {
|
|
3
3
|
readonly id?: string;
|
|
4
4
|
readonly defaultChecked?: boolean;
|
|
5
5
|
readonly checked?: boolean;
|
|
6
|
-
readonly onChange?: (value: string) => void;
|
|
6
|
+
readonly onChange?: (value: string, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
7
|
readonly name?: string;
|
|
8
8
|
readonly value?: string;
|
|
9
9
|
readonly labelPosition?: 'before' | 'after' | 'below';
|
|
@@ -11,4 +11,4 @@ export interface RadioButtonProps extends ClassNamePropsWithChildren {
|
|
|
11
11
|
readonly disabled?: boolean;
|
|
12
12
|
readonly required?: boolean;
|
|
13
13
|
}
|
|
14
|
-
export declare
|
|
14
|
+
export declare const RadioButton: (props: RadioButtonProps & import("react").RefAttributes<HTMLLabelElement>) => React.ReactElement | null;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import classnames from "classnames";
|
|
3
|
-
import { useContext } from "react";
|
|
3
|
+
import { forwardRef, useContext } from "react";
|
|
4
4
|
import { useId } from "../../utils/useId.js";
|
|
5
5
|
import { RadioGroupContext } from "./RadioGroupContext.js";
|
|
6
|
-
|
|
7
|
-
const { id: idProps, onChange, value, name, defaultChecked: defaultCheckedProp, checked, labelPosition = 'after', large = false, disabled = false, required = false, children, className } = props;
|
|
6
|
+
const RadioButton = /*#__PURE__*/ forwardRef(({ id: idProps, onChange, value, name, defaultChecked: defaultCheckedProp, checked, labelPosition = 'after', large = false, disabled = false, required = false, children, className, ...props }, ref)=>{
|
|
8
7
|
const { disabled: groupDisabled, labelPosition: groupLabelPosition, large: groupLarge, name: groupName, value: groupValue, required: groupRequired, handleValueChange: onGroupValueChange, isControlled } = useContext(RadioGroupContext);
|
|
9
8
|
const innerLabelPosition = groupLabelPosition ?? labelPosition;
|
|
10
9
|
const classes = classnames('fwe-radio', {
|
|
@@ -15,21 +14,22 @@ function RadioButton(props) {
|
|
|
15
14
|
'fwe-radio-lg': large || groupLarge
|
|
16
15
|
}, className);
|
|
17
16
|
const controlledChecked = void 0 !== checked || isControlled && void 0 !== groupValue ? Boolean(checked || groupValue === value) : void 0;
|
|
18
|
-
|
|
17
|
+
function getDefaultChecked() {
|
|
19
18
|
if (void 0 !== controlledChecked) return;
|
|
20
19
|
if (void 0 !== defaultCheckedProp) return defaultCheckedProp;
|
|
21
20
|
if (!isControlled && void 0 !== groupValue) return groupValue === value;
|
|
22
|
-
}
|
|
21
|
+
}
|
|
23
22
|
const defaultChecked = getDefaultChecked();
|
|
24
23
|
function handleChange(event) {
|
|
25
24
|
const newValue = event.target.value;
|
|
26
25
|
if (newValue) onGroupValueChange?.(newValue);
|
|
27
|
-
onChange?.(newValue);
|
|
26
|
+
onChange?.(newValue, event);
|
|
28
27
|
}
|
|
29
28
|
const id = useId(idProps);
|
|
30
29
|
return /*#__PURE__*/ jsxs("label", {
|
|
31
30
|
className: classes,
|
|
32
31
|
htmlFor: id,
|
|
32
|
+
ref: ref,
|
|
33
33
|
children: [
|
|
34
34
|
/*#__PURE__*/ jsxs("div", {
|
|
35
35
|
className: "fwe-radio-check",
|
|
@@ -43,12 +43,12 @@ function RadioButton(props) {
|
|
|
43
43
|
value: value,
|
|
44
44
|
onChange: handleChange,
|
|
45
45
|
disabled: disabled || groupDisabled,
|
|
46
|
-
required: required || groupRequired
|
|
46
|
+
required: required || groupRequired,
|
|
47
|
+
...props
|
|
47
48
|
}),
|
|
48
49
|
/*#__PURE__*/ jsx("div", {
|
|
49
50
|
className: "fwe-radio-checkmark"
|
|
50
|
-
})
|
|
51
|
-
' '
|
|
51
|
+
})
|
|
52
52
|
]
|
|
53
53
|
}),
|
|
54
54
|
/*#__PURE__*/ jsx("div", {
|
|
@@ -57,5 +57,6 @@ function RadioButton(props) {
|
|
|
57
57
|
})
|
|
58
58
|
]
|
|
59
59
|
});
|
|
60
|
-
}
|
|
60
|
+
});
|
|
61
|
+
RadioButton.displayName = 'RadioButton';
|
|
61
62
|
export { RadioButton };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type ComponentPropsWithoutRef } from 'react';
|
|
2
|
-
export interface RadioGroupProps extends ComponentPropsWithoutRef<'div'> {
|
|
2
|
+
export interface RadioGroupProps extends Omit<ComponentPropsWithoutRef<'div'>, 'value' | 'defaultValue'> {
|
|
3
3
|
readonly name?: string;
|
|
4
|
+
readonly required?: boolean;
|
|
5
|
+
readonly disabled?: boolean;
|
|
6
|
+
readonly value?: string;
|
|
4
7
|
readonly defaultValue?: string;
|
|
5
8
|
readonly onValueChange?: (value: string) => void;
|
|
6
|
-
readonly value?: string;
|
|
7
9
|
readonly labelPosition?: 'before' | 'after' | 'below';
|
|
8
10
|
readonly large?: boolean;
|
|
9
|
-
readonly disabled?: boolean;
|
|
10
|
-
readonly required?: boolean;
|
|
11
11
|
}
|
|
12
12
|
export declare const RadioGroup: (props: RadioGroupProps & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ClassNamePropsWithChildren } from '../../utils/types';
|
|
1
|
+
import React, { type ChangeEvent, type ComponentPropsWithoutRef, type PropsWithChildren } from 'react';
|
|
3
2
|
export interface SegmentConfiguration {
|
|
4
3
|
readonly outline?: boolean;
|
|
5
4
|
readonly iconOnly?: boolean;
|
|
6
5
|
}
|
|
7
|
-
export interface SegmentProps extends
|
|
6
|
+
export interface SegmentProps extends PropsWithChildren, Omit<ComponentPropsWithoutRef<'fieldset'>, 'onChange' | 'defaultValue' | 'required' | 'disabled'> {
|
|
8
7
|
readonly legend: string;
|
|
9
8
|
readonly config?: SegmentConfiguration;
|
|
10
|
-
readonly onChange?: (event:
|
|
9
|
+
readonly onChange?: (value: any, event: ChangeEvent<HTMLInputElement>) => void;
|
|
11
10
|
readonly value?: any;
|
|
12
11
|
}
|
|
13
|
-
export declare
|
|
12
|
+
export declare const Segment: (props: SegmentProps & React.RefAttributes<HTMLFieldSetElement>) => React.ReactElement | null;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import classnames from "classnames";
|
|
3
|
-
import react from "react";
|
|
3
|
+
import react, { Children, forwardRef, isValidElement } from "react";
|
|
4
4
|
import { useControlled } from "../../utils/useControlled.js";
|
|
5
5
|
const defaultConfig = {
|
|
6
6
|
outline: true,
|
|
7
7
|
iconOnly: true
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
const { children, legend, config, onChange, className, value: valueProps } = props;
|
|
9
|
+
const Segment = /*#__PURE__*/ forwardRef(({ children, legend, config, onChange, className, value: valueProps, ...props }, ref)=>{
|
|
11
10
|
const innerConfig = {
|
|
12
11
|
...defaultConfig,
|
|
13
12
|
...config
|
|
@@ -15,8 +14,8 @@ function Segment(props) {
|
|
|
15
14
|
let useIcon = false;
|
|
16
15
|
let useIconAndText = false;
|
|
17
16
|
let tmpValue = '';
|
|
18
|
-
|
|
19
|
-
if (!/*#__PURE__*/
|
|
17
|
+
Children.forEach(children, (child, index)=>{
|
|
18
|
+
if (!/*#__PURE__*/ isValidElement(child)) return null;
|
|
20
19
|
if (0 === index && null !== child.props.icon) if (innerConfig.iconOnly) useIcon = true;
|
|
21
20
|
else useIconAndText = true;
|
|
22
21
|
if (child.props.checked) tmpValue = child.props.value;
|
|
@@ -26,8 +25,8 @@ function Segment(props) {
|
|
|
26
25
|
controlled: valueProps,
|
|
27
26
|
default: tmpValue
|
|
28
27
|
});
|
|
29
|
-
const handleChange = (
|
|
30
|
-
if (onChange) onChange(
|
|
28
|
+
const handleChange = (_value, event)=>{
|
|
29
|
+
if (onChange) onChange(_value, event);
|
|
31
30
|
setValue(_value);
|
|
32
31
|
};
|
|
33
32
|
return /*#__PURE__*/ jsxs("fieldset", {
|
|
@@ -36,6 +35,8 @@ function Segment(props) {
|
|
|
36
35
|
'fwe-segment-icon': useIcon,
|
|
37
36
|
'fwe-segment-icon-text': useIconAndText
|
|
38
37
|
}, className),
|
|
38
|
+
ref: ref,
|
|
39
|
+
...props,
|
|
39
40
|
children: [
|
|
40
41
|
/*#__PURE__*/ jsx("legend", {
|
|
41
42
|
className: "fwe-sr-only fwe-d-inline-block",
|
|
@@ -54,5 +55,6 @@ function Segment(props) {
|
|
|
54
55
|
})
|
|
55
56
|
]
|
|
56
57
|
});
|
|
57
|
-
}
|
|
58
|
+
});
|
|
59
|
+
Segment.displayName = 'Segment';
|
|
58
60
|
export { Segment };
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
export interface SegmentControlProps extends ClassNameProps {
|
|
1
|
+
import { type ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export interface SegmentControlProps extends Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'onChange' | 'value'> {
|
|
4
3
|
readonly label: string;
|
|
5
|
-
readonly name: string;
|
|
6
4
|
readonly value: any;
|
|
7
5
|
readonly checked?: boolean;
|
|
8
|
-
readonly disabled?: boolean;
|
|
9
6
|
readonly icon?: React.ReactNode;
|
|
10
|
-
readonly onChange?: (event: React.ChangeEvent<HTMLInputElement
|
|
11
|
-
readonly id?: string;
|
|
7
|
+
readonly onChange?: (value: any, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
12
8
|
readonly iconOnly?: boolean;
|
|
13
9
|
}
|
|
14
|
-
export declare
|
|
10
|
+
export declare const SegmentControl: (props: SegmentControlProps & import("react").RefAttributes<HTMLLabelElement>) => React.ReactElement | null;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import classnames from "classnames";
|
|
3
|
-
import { useRef } from "react";
|
|
3
|
+
import { forwardRef, useRef } from "react";
|
|
4
4
|
import { IconWrapper } from "../../../components/icon-wrapper/IconWrapper.js";
|
|
5
|
-
|
|
6
|
-
const { label, checked, disabled, name, value, icon, onChange, id, className, iconOnly } = props;
|
|
5
|
+
const SegmentControl = /*#__PURE__*/ forwardRef(({ label, checked, disabled, name, value, icon, onChange, id, className, iconOnly, ...props }, ref)=>{
|
|
7
6
|
const componentId = useRef(id ?? (Math.random() * Date.now()).toString().replace('.', '-'));
|
|
8
7
|
let viewMode = 'text';
|
|
9
8
|
if (icon) viewMode = iconOnly ? 'icon' : 'icon-text';
|
|
10
9
|
const handleChange = (event)=>{
|
|
11
|
-
if (onChange) onChange(
|
|
10
|
+
if (onChange) onChange(value, event);
|
|
12
11
|
};
|
|
13
12
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
14
13
|
children: [
|
|
@@ -20,11 +19,13 @@ function SegmentControl(props) {
|
|
|
20
19
|
value: value,
|
|
21
20
|
checked: checked,
|
|
22
21
|
disabled: disabled,
|
|
23
|
-
onChange: (e)=>handleChange(e)
|
|
22
|
+
onChange: (e)=>handleChange(e),
|
|
23
|
+
...props
|
|
24
24
|
}),
|
|
25
25
|
/*#__PURE__*/ jsxs("label", {
|
|
26
26
|
className: classnames('fwe-segment-label', className),
|
|
27
27
|
htmlFor: componentId.current,
|
|
28
|
+
ref: ref,
|
|
28
29
|
children: [
|
|
29
30
|
'icon' === viewMode && /*#__PURE__*/ jsxs(Fragment, {
|
|
30
31
|
children: [
|
|
@@ -53,5 +54,6 @@ function SegmentControl(props) {
|
|
|
53
54
|
})
|
|
54
55
|
]
|
|
55
56
|
});
|
|
56
|
-
}
|
|
57
|
+
});
|
|
58
|
+
SegmentControl.displayName = 'SegmentControl';
|
|
57
59
|
export { SegmentControl };
|