@festo-ui/react 11.0.0 → 11.1.0-dev.1008
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-item/AccordionItem.css +3 -3
- package/dist/components/button/Button.js +2 -2
- package/dist/components/modals/AlertModal.js +2 -2
- package/dist/components/modals/ConfirmModal.js +1 -1
- package/dist/components/modals/ModalBase.js +1 -1
- package/dist/components/modals/Prompt.js +1 -1
- package/dist/components/pagination/Pagination.css +2 -2
- package/dist/components/pagination/Pagination.d.ts +1 -1
- package/dist/components/pagination/Pagination.js +54 -57
- package/dist/components/popovers/popover/Popover.d.ts +1 -0
- package/dist/components/popovers/popover/Popover.js +17 -3
- package/dist/components/search-input/SearchInput.js +2 -2
- package/dist/components/snackbar/Snackbar.d.ts +1 -1
- package/dist/components/snackbar/Snackbar.js +2 -2
- package/dist/forms/combobox/ComboBox.d.ts +2 -2
- package/dist/forms/combobox/ComboBox.js +2 -2
- package/dist/forms/multi-select/MultiSelect.d.ts +2 -2
- package/dist/forms/multi-select/MultiSelect.js +2 -2
- package/dist/forms/segment/Segment.d.ts +1 -1
- package/dist/forms/select/Select.css +8 -0
- package/dist/forms/select/Select.d.ts +2 -1
- package/dist/forms/select/Select.js +12 -2
- package/dist/forms/slider/Slider.d.ts +2 -2
- package/dist/forms/switch/Switch.d.ts +1 -1
- package/dist/forms/switch/Switch.js +1 -1
- package/dist/forms/text-area/TextArea.d.ts +1 -1
- package/dist/forms/text-input/TextInput.d.ts +1 -1
- package/dist/forms/text-input/TextInput.js +1 -0
- package/llm-doc/components.md +209 -154
- package/llm-doc/installation.md +3 -1
- package/llm-doc/patterns.md +22 -5
- package/package.json +1 -1
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
pointer-events: none;
|
|
31
31
|
content: "";
|
|
32
32
|
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgzMnYzMkgweiIvPjxwYXRoIGZpbGw9IiMzMzMiIGQ9Im0xNiAyMi04LjcwNy04LjcwNyAxLjQxNC0xLjQxNEwxNiAxOS4xNzJsNy4yOTMtNy4yOTMgMS40MTQgMS40MTRMMTYgMjJ6IiAvPjwvc3ZnPg==);
|
|
33
|
-
width:
|
|
34
|
-
height:
|
|
33
|
+
width: 24px;
|
|
34
|
+
height: 24px;
|
|
35
35
|
transition: transform .2s;
|
|
36
36
|
position: absolute;
|
|
37
|
-
top:
|
|
37
|
+
top: 23px;
|
|
38
38
|
right: 16px;
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -8,9 +8,9 @@ const Button = /*#__PURE__*/ forwardRef(({ icon, type = 'button', disabled = fal
|
|
|
8
8
|
}, {
|
|
9
9
|
'fwe-disabled': disabled
|
|
10
10
|
}, {
|
|
11
|
-
'fwe-btn-
|
|
11
|
+
'fwe-btn-primary': primary && !tertiary
|
|
12
12
|
}, {
|
|
13
|
-
'fwe-btn-
|
|
13
|
+
'fwe-btn-tertiary': tertiary && !primary
|
|
14
14
|
}, {
|
|
15
15
|
'fwe-btn-lg': large
|
|
16
16
|
}, {
|
|
@@ -33,7 +33,7 @@ const AlertModal = /*#__PURE__*/ forwardRef(({ title, subtitle, alertType, stron
|
|
|
33
33
|
type: "button",
|
|
34
34
|
"aria-label": "Cancel",
|
|
35
35
|
className: classnames('fwe-btn fwe-btn-lg', {
|
|
36
|
-
'fwe-btn-
|
|
36
|
+
'fwe-btn-tertiary': strong
|
|
37
37
|
}),
|
|
38
38
|
onClick: onCancel,
|
|
39
39
|
children: cancel
|
|
@@ -42,7 +42,7 @@ const AlertModal = /*#__PURE__*/ forwardRef(({ title, subtitle, alertType, stron
|
|
|
42
42
|
type: "button",
|
|
43
43
|
"aria-label": "Ok",
|
|
44
44
|
className: classnames('fwe-btn fwe-btn-lg', {
|
|
45
|
-
'fwe-btn-
|
|
45
|
+
'fwe-btn-primary': !strong
|
|
46
46
|
}),
|
|
47
47
|
onClick: onOk,
|
|
48
48
|
children: ok
|
|
@@ -36,7 +36,7 @@ const ConfirmModal = /*#__PURE__*/ forwardRef(({ title, subtitle, cancel, ok, on
|
|
|
36
36
|
ok && /*#__PURE__*/ jsx("button", {
|
|
37
37
|
type: "button",
|
|
38
38
|
"aria-label": "Ok",
|
|
39
|
-
className: "fwe-btn fwe-btn-
|
|
39
|
+
className: "fwe-btn fwe-btn-primary fwe-btn-lg",
|
|
40
40
|
onClick: onOk,
|
|
41
41
|
children: ok
|
|
42
42
|
})
|
|
@@ -66,6 +66,7 @@ const ModalBase = /*#__PURE__*/ forwardRef(({ isOpen, isLoading, closeOnBackdrop
|
|
|
66
66
|
/*#__PURE__*/ jsx(CSSTransition, {
|
|
67
67
|
classNames: "fr-modal-backdrop",
|
|
68
68
|
in: isOpen,
|
|
69
|
+
onExited: onCloseDone,
|
|
69
70
|
timeout: {
|
|
70
71
|
exit: 300
|
|
71
72
|
},
|
|
@@ -81,7 +82,6 @@ const ModalBase = /*#__PURE__*/ forwardRef(({ isOpen, isLoading, closeOnBackdrop
|
|
|
81
82
|
/*#__PURE__*/ jsx(CSSTransition, {
|
|
82
83
|
classNames: "fr-modal",
|
|
83
84
|
in: isOpen && !isLoading,
|
|
84
|
-
onExited: onCloseDone,
|
|
85
85
|
timeout: {
|
|
86
86
|
exit: 300,
|
|
87
87
|
enter: 100
|
|
@@ -49,7 +49,7 @@ const Prompt = /*#__PURE__*/ forwardRef(({ title, subtitle, hint, label, value,
|
|
|
49
49
|
ok && /*#__PURE__*/ jsx("button", {
|
|
50
50
|
type: "button",
|
|
51
51
|
"aria-label": "Ok",
|
|
52
|
-
className: "fwe-btn fwe-btn-
|
|
52
|
+
className: "fwe-btn fwe-btn-primary fwe-btn-lg",
|
|
53
53
|
onClick: ()=>onOk(innerValue),
|
|
54
54
|
children: ok
|
|
55
55
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './Pagination.scss';
|
|
2
|
-
export type PaginationType = 'SIMPLE' | 'NUMERIC' | 'DOTS';
|
|
2
|
+
export type PaginationType = 'basic' | 'numeric' | 'dots' | 'dots-lg' | 'SIMPLE' | 'NUMERIC' | 'DOTS';
|
|
3
3
|
export interface PaginationProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'onChange'> {
|
|
4
4
|
readonly type?: PaginationType;
|
|
5
5
|
readonly onChange?: (page: number, event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
@@ -2,7 +2,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import "./Pagination.css";
|
|
3
3
|
import classnames from "classnames";
|
|
4
4
|
import { forwardRef, useEffect, useState } from "react";
|
|
5
|
-
const Pagination = /*#__PURE__*/ forwardRef(({ pageMax, onChange, pageCurrent, defaultPageCurrent = 1, type = '
|
|
5
|
+
const Pagination = /*#__PURE__*/ forwardRef(({ pageMax, onChange, pageCurrent, defaultPageCurrent = 1, type = 'numeric', className, ...props }, ref)=>{
|
|
6
6
|
const controlled = void 0 !== pageCurrent;
|
|
7
7
|
const dotArray = Array.from(new Array(pageMax).keys());
|
|
8
8
|
const [innerPageCurrent, setInnerPageCurrent] = useState(controlled ? pageCurrent : defaultPageCurrent);
|
|
@@ -32,66 +32,63 @@ const Pagination = /*#__PURE__*/ forwardRef(({ pageMax, onChange, pageCurrent, d
|
|
|
32
32
|
const newPageCurrent = index + 1;
|
|
33
33
|
handleChange(newPageCurrent, event);
|
|
34
34
|
}
|
|
35
|
-
return /*#__PURE__*/
|
|
36
|
-
children:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
className: classnames('fwe-navigate-btn-down', {
|
|
46
|
-
'fwe-disabled': innerPageCurrent <= 1
|
|
47
|
-
}),
|
|
48
|
-
onClick: onBtnDown,
|
|
35
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
36
|
+
children: 'dots' === type || 'dots-lg' === type || 'DOTS' === type ? /*#__PURE__*/ jsx("div", {
|
|
37
|
+
...props,
|
|
38
|
+
className: classnames({
|
|
39
|
+
'fwe-d-none': pageMax < 2
|
|
40
|
+
}, className),
|
|
41
|
+
ref: ref,
|
|
42
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
43
|
+
className: "fwe-pagination",
|
|
44
|
+
children: dotArray.map((index)=>/*#__PURE__*/ jsx("button", {
|
|
49
45
|
type: "button",
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
46
|
+
className: classnames(`fwe-page-dot${'dots-lg' === type ? '-lg' : ''}`, {
|
|
47
|
+
'fwe-selected': index + 1 === innerPageCurrent
|
|
48
|
+
}),
|
|
49
|
+
onClick: (e)=>onDotClick(index, e),
|
|
50
|
+
"aria-label": `Go to page ${index + 1}`,
|
|
51
|
+
"aria-current": index + 1 === innerPageCurrent ? 'page' : void 0
|
|
52
|
+
}, index))
|
|
53
|
+
})
|
|
54
|
+
}) : /*#__PURE__*/ jsxs("div", {
|
|
55
|
+
...props,
|
|
56
|
+
className: classnames('fwe-pagination', {
|
|
57
|
+
'fwe-d-none': pageMax < 2
|
|
58
|
+
}, className),
|
|
59
|
+
ref: ref,
|
|
60
|
+
children: [
|
|
61
|
+
/*#__PURE__*/ jsx("button", {
|
|
62
|
+
className: classnames('fwe-navigate-btn-down', {
|
|
63
|
+
'fwe-disabled': innerPageCurrent <= 1
|
|
63
64
|
}),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
onClick: onBtnDown,
|
|
66
|
+
type: "button",
|
|
67
|
+
"aria-label": "navigate-btn-down"
|
|
68
|
+
}),
|
|
69
|
+
('numeric' === type || 'NUMERIC' === type) && /*#__PURE__*/ jsxs(Fragment, {
|
|
70
|
+
children: [
|
|
71
|
+
/*#__PURE__*/ jsx("span", {
|
|
72
|
+
className: "fwe-page-current",
|
|
73
|
+
children: innerPageCurrent
|
|
68
74
|
}),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
children: dotArray.map((index)=>/*#__PURE__*/ jsx("button", {
|
|
84
|
-
type: "button",
|
|
85
|
-
className: classnames('fwe-page-dot', {
|
|
86
|
-
'fwe-selected': index + 1 === innerPageCurrent
|
|
87
|
-
}),
|
|
88
|
-
onClick: (e)=>onDotClick(index, e),
|
|
89
|
-
"aria-label": `Go to page ${index + 1}`,
|
|
90
|
-
"aria-current": index + 1 === innerPageCurrent ? 'page' : void 0
|
|
91
|
-
}, index))
|
|
75
|
+
/*#__PURE__*/ jsx("span", {
|
|
76
|
+
className: "fwe-page-max",
|
|
77
|
+
children: pageMax
|
|
78
|
+
})
|
|
79
|
+
]
|
|
80
|
+
}),
|
|
81
|
+
/*#__PURE__*/ jsx("button", {
|
|
82
|
+
className: classnames('fwe-navigate-btn-up', {
|
|
83
|
+
'fwe-disabled': innerPageCurrent >= pageMax,
|
|
84
|
+
'fwe-ml-4': 'SIMPLE' === type
|
|
85
|
+
}),
|
|
86
|
+
onClick: onBtnUp,
|
|
87
|
+
type: "button",
|
|
88
|
+
"aria-label": "navigate-btn-up"
|
|
92
89
|
})
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
]
|
|
91
|
+
})
|
|
95
92
|
});
|
|
96
93
|
});
|
|
97
94
|
Pagination.displayName = 'Pagination';
|
|
@@ -13,6 +13,7 @@ export interface PopoverProps extends Omit<React.ComponentPropsWithoutRef<'div'>
|
|
|
13
13
|
readonly onChange?: (isOpen: boolean) => void;
|
|
14
14
|
readonly flip?: boolean;
|
|
15
15
|
readonly showArrow?: boolean;
|
|
16
|
+
readonly keepMounted?: boolean;
|
|
16
17
|
readonly onTriggerClick?: (event: MouseEvent) => void;
|
|
17
18
|
readonly stopPropagation?: boolean;
|
|
18
19
|
}
|
|
@@ -5,7 +5,7 @@ import classnames from "classnames";
|
|
|
5
5
|
import { forwardRef, useRef } from "react";
|
|
6
6
|
import { useControlled } from "../../../utils/useControlled.js";
|
|
7
7
|
import { useForkRef } from "../../../utils/useForkRef.js";
|
|
8
|
-
const Popover = /*#__PURE__*/ forwardRef(({ children, className, style, containerClassName, content, position, fallbackPositions, isOpen, openOnHover = false, openByDefault = false, onChange, flip: enableFlip = true, showArrow = true, onTriggerClick, stopPropagation = false, ...props }, ref)=>{
|
|
8
|
+
const Popover = /*#__PURE__*/ forwardRef(({ children, className, style, containerClassName, content, position, fallbackPositions, isOpen, openOnHover = false, openByDefault = false, onChange, flip: enableFlip = true, showArrow = true, keepMounted = false, onTriggerClick, stopPropagation = false, ...props }, ref)=>{
|
|
9
9
|
const [showPopover, setShowPopover] = useControlled({
|
|
10
10
|
controlled: isOpen,
|
|
11
11
|
default: openByDefault
|
|
@@ -50,6 +50,16 @@ const Popover = /*#__PURE__*/ forwardRef(({ children, className, style, containe
|
|
|
50
50
|
click,
|
|
51
51
|
hover
|
|
52
52
|
]);
|
|
53
|
+
function getPopoverProps() {
|
|
54
|
+
return {
|
|
55
|
+
onClick: (e)=>{
|
|
56
|
+
if (stopPropagation) {
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
e.stopPropagation();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
53
63
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
54
64
|
children: [
|
|
55
65
|
/*#__PURE__*/ jsx("div", {
|
|
@@ -75,11 +85,14 @@ const Popover = /*#__PURE__*/ forwardRef(({ children, className, style, containe
|
|
|
75
85
|
}),
|
|
76
86
|
children: children
|
|
77
87
|
}),
|
|
78
|
-
showPopover && /*#__PURE__*/ jsx(FloatingPortal, {
|
|
88
|
+
(showPopover || keepMounted) && /*#__PURE__*/ jsx(FloatingPortal, {
|
|
79
89
|
children: /*#__PURE__*/ jsxs("div", {
|
|
80
90
|
className: "fwe-popover-container",
|
|
81
91
|
ref: refs.setFloating,
|
|
82
|
-
style:
|
|
92
|
+
style: {
|
|
93
|
+
...floatingStyles,
|
|
94
|
+
display: showPopover ? void 0 : 'none'
|
|
95
|
+
},
|
|
83
96
|
...getFloatingProps(),
|
|
84
97
|
children: [
|
|
85
98
|
showArrow && /*#__PURE__*/ jsx(FloatingArrow, {
|
|
@@ -91,6 +104,7 @@ const Popover = /*#__PURE__*/ forwardRef(({ children, className, style, containe
|
|
|
91
104
|
}),
|
|
92
105
|
/*#__PURE__*/ jsx("div", {
|
|
93
106
|
className: classnames('fwe-popover', containerClassName),
|
|
107
|
+
...getPopoverProps(),
|
|
94
108
|
children: content
|
|
95
109
|
})
|
|
96
110
|
]
|
|
@@ -71,13 +71,13 @@ const SearchInput = /*#__PURE__*/ forwardRef(({ defaultValue, disabled, label, v
|
|
|
71
71
|
hasChildren && /*#__PURE__*/ jsx(ComboboxOptions, {
|
|
72
72
|
className: "fwe-search-suggestions",
|
|
73
73
|
as: "div",
|
|
74
|
-
portal: false,
|
|
75
74
|
anchor: {
|
|
76
75
|
to: 'bottom start',
|
|
77
76
|
gap: 4
|
|
78
77
|
},
|
|
79
78
|
style: {
|
|
80
|
-
minWidth: 'var(--input-width)'
|
|
79
|
+
minWidth: 'var(--input-width)',
|
|
80
|
+
zIndex: 1040
|
|
81
81
|
},
|
|
82
82
|
children: children
|
|
83
83
|
})
|
|
@@ -41,8 +41,8 @@ const Snackbar = /*#__PURE__*/ forwardRef(({ data, onAction, onClose, first = fa
|
|
|
41
41
|
children: /*#__PURE__*/ jsxs("div", {
|
|
42
42
|
className: classnames({
|
|
43
43
|
'fwe-snackbar': true,
|
|
44
|
-
'fwe-snackbar-
|
|
45
|
-
'fwe-snackbar-
|
|
44
|
+
'fwe-snackbar-light': data?.variant === 'light' || data?.variant === 'b',
|
|
45
|
+
'fwe-snackbar-strong': data?.variant === 'strong' || data?.variant === 'c',
|
|
46
46
|
'fwe-snackbar-info': data?.type === 'info',
|
|
47
47
|
'fwe-snackbar-warning': data?.type === 'warning',
|
|
48
48
|
'fwe-snackbar-error': data?.type === 'error',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './ComboBox.scss';
|
|
2
|
-
import { type Ref } from 'react';
|
|
2
|
+
import { type ReactNode, type Ref } from 'react';
|
|
3
3
|
export interface ComboBoxOption<T> {
|
|
4
4
|
readonly label: string;
|
|
5
5
|
readonly data: T;
|
|
@@ -11,7 +11,7 @@ export interface ComboBoxProps<T> extends Omit<React.ComponentPropsWithoutRef<'d
|
|
|
11
11
|
readonly name?: string;
|
|
12
12
|
readonly disabled?: boolean;
|
|
13
13
|
readonly required?: boolean;
|
|
14
|
-
readonly label?:
|
|
14
|
+
readonly label?: ReactNode;
|
|
15
15
|
readonly options?: ComboBoxOption<T>[];
|
|
16
16
|
readonly hint?: string;
|
|
17
17
|
readonly error?: string;
|
|
@@ -119,9 +119,9 @@ function ComboBoxComponent({ defaultValue = '', value: controlled, label, option
|
|
|
119
119
|
/*#__PURE__*/ jsxs(ComboboxOptions, {
|
|
120
120
|
className: "fwe-options-container",
|
|
121
121
|
as: "ul",
|
|
122
|
-
portal: false,
|
|
123
122
|
style: {
|
|
124
|
-
minWidth: 'var(--input-width)'
|
|
123
|
+
minWidth: 'var(--input-width)',
|
|
124
|
+
zIndex: 1040
|
|
125
125
|
},
|
|
126
126
|
anchor: {
|
|
127
127
|
to: 'bottom start',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { Ref } from 'react';
|
|
1
|
+
import type { ReactNode, Ref } from 'react';
|
|
2
2
|
import type { SelectOption } from '../select/Select';
|
|
3
3
|
import './MultiSelect.scss';
|
|
4
4
|
export interface MultiSelectProps<T> extends Omit<React.ComponentPropsWithoutRef<'div'>, 'onChange' | 'value' | 'defaultValue'> {
|
|
5
5
|
readonly defaultValue?: T[];
|
|
6
6
|
readonly value?: T[];
|
|
7
|
-
readonly label?:
|
|
7
|
+
readonly label?: ReactNode;
|
|
8
8
|
readonly options?: SelectOption<T>[];
|
|
9
9
|
readonly onChange?: (value: T[]) => void;
|
|
10
10
|
readonly disabled?: boolean;
|
|
@@ -122,9 +122,9 @@ function MultiSelectComponent({ defaultValue = [], value: controlled, label, opt
|
|
|
122
122
|
/*#__PURE__*/ jsx(ListboxOptions, {
|
|
123
123
|
className: "fwe-options-container fwe-options-container--multi-select",
|
|
124
124
|
as: "ul",
|
|
125
|
-
portal: false,
|
|
126
125
|
style: {
|
|
127
|
-
minWidth: 'var(--button-width)'
|
|
126
|
+
minWidth: 'var(--button-width)',
|
|
127
|
+
zIndex: 1040
|
|
128
128
|
},
|
|
129
129
|
anchor: {
|
|
130
130
|
to: 'bottom start',
|
|
@@ -4,7 +4,7 @@ export interface SegmentConfiguration {
|
|
|
4
4
|
readonly iconOnly?: boolean;
|
|
5
5
|
}
|
|
6
6
|
export interface SegmentProps extends PropsWithChildren, Omit<ComponentPropsWithoutRef<'fieldset'>, 'onChange' | 'defaultValue' | 'required' | 'disabled'> {
|
|
7
|
-
readonly legend:
|
|
7
|
+
readonly legend: React.ReactNode;
|
|
8
8
|
readonly config?: SegmentConfiguration;
|
|
9
9
|
readonly onChange?: (value: any, event: ChangeEvent<HTMLInputElement>) => void;
|
|
10
10
|
readonly value?: any;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
.fwe-select:focus:not(:disabled), .fwe-select[aria-expanded="true"]:not(:disabled) {
|
|
2
|
+
border-color: var(--fwe-hero);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
:is(.fwe-select:focus.fwe-invalid, .fwe-select:focus:user-invalid, .fwe-select[aria-expanded="true"].fwe-invalid, .fwe-select[aria-expanded="true"]:user-invalid) {
|
|
6
|
+
border-color: var(--fwe-red);
|
|
7
|
+
}
|
|
8
|
+
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import './Select.scss';
|
|
1
2
|
import { type ReactNode, type Ref } from 'react';
|
|
2
3
|
export interface SelectOption<T> {
|
|
3
4
|
readonly data: T;
|
|
@@ -10,7 +11,7 @@ export interface SelectProps<T> extends Omit<React.ComponentPropsWithoutRef<'div
|
|
|
10
11
|
readonly name?: string;
|
|
11
12
|
readonly disabled?: boolean;
|
|
12
13
|
readonly required?: boolean;
|
|
13
|
-
readonly label?:
|
|
14
|
+
readonly label?: ReactNode;
|
|
14
15
|
readonly options?: SelectOption<T>[];
|
|
15
16
|
readonly hint?: string;
|
|
16
17
|
readonly error?: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "./Select.css";
|
|
2
3
|
import { Listbox, ListboxButton, ListboxOption, ListboxOptions } from "@headlessui/react";
|
|
3
4
|
import classnames from "classnames";
|
|
4
5
|
import { forwardRef, useMemo } from "react";
|
|
@@ -38,6 +39,15 @@ function SelectComponent({ defaultValue = '', value: controlled, label, options
|
|
|
38
39
|
id: id,
|
|
39
40
|
"aria-labelledby": label ? labelId : void 0,
|
|
40
41
|
disabled: disabled,
|
|
42
|
+
onKeyDown: (event)=>{
|
|
43
|
+
if ('Enter' === event.key) {
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
event.currentTarget.dispatchEvent(new KeyboardEvent('keydown', {
|
|
46
|
+
key: 'ArrowDown',
|
|
47
|
+
bubbles: true
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
},
|
|
41
51
|
children: selectedOption ? selectedOption.label : placeholder ?? ''
|
|
42
52
|
}),
|
|
43
53
|
/*#__PURE__*/ jsx("label", {
|
|
@@ -49,9 +59,9 @@ function SelectComponent({ defaultValue = '', value: controlled, label, options
|
|
|
49
59
|
/*#__PURE__*/ jsx(ListboxOptions, {
|
|
50
60
|
className: "fwe-options-container",
|
|
51
61
|
as: "ul",
|
|
52
|
-
portal: false,
|
|
53
62
|
style: {
|
|
54
|
-
minWidth: 'var(--button-width)'
|
|
63
|
+
minWidth: 'var(--button-width)',
|
|
64
|
+
zIndex: 1040
|
|
55
65
|
},
|
|
56
66
|
anchor: {
|
|
57
67
|
to: 'bottom start',
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import './Slider.scss';
|
|
2
|
-
import { type ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
3
3
|
export interface SliderProps extends Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'onChange' | 'value' | 'defaultValue' | 'min' | 'max' | 'step'> {
|
|
4
4
|
readonly min: number;
|
|
5
5
|
readonly max: number;
|
|
6
6
|
readonly step?: number;
|
|
7
7
|
readonly value: number;
|
|
8
8
|
readonly onChangeCommitted?: (value: number) => void;
|
|
9
|
-
readonly label?:
|
|
9
|
+
readonly label?: ReactNode;
|
|
10
10
|
readonly showValue?: boolean;
|
|
11
11
|
readonly onChange?: (value: number, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
12
12
|
readonly widthOffset?: number;
|
|
@@ -2,7 +2,7 @@ import { type ComponentPropsWithoutRef } from 'react';
|
|
|
2
2
|
export interface SwitchProps extends Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'onChange' | 'value' | 'defaultValue' | 'checked'> {
|
|
3
3
|
readonly labelPosition?: 'before' | 'after' | 'below';
|
|
4
4
|
readonly large?: boolean;
|
|
5
|
-
readonly title
|
|
5
|
+
readonly title?: string;
|
|
6
6
|
readonly value?: boolean;
|
|
7
7
|
readonly defaultValue?: boolean;
|
|
8
8
|
readonly onChange?: (value: boolean, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
@@ -37,7 +37,7 @@ const Switch = /*#__PURE__*/ forwardRef(({ labelPosition = 'after', large = fals
|
|
|
37
37
|
/*#__PURE__*/ jsx("div", {
|
|
38
38
|
className: "fwe-switch-track"
|
|
39
39
|
}),
|
|
40
|
-
/*#__PURE__*/ jsx("div", {
|
|
40
|
+
!!title && /*#__PURE__*/ jsx("div", {
|
|
41
41
|
className: "fwe-switch-label-content",
|
|
42
42
|
children: title
|
|
43
43
|
})
|
|
@@ -4,7 +4,7 @@ export interface TextAreaProps extends Omit<ComponentPropsWithoutRef<'textarea'>
|
|
|
4
4
|
readonly value?: string;
|
|
5
5
|
readonly defaultValue?: string;
|
|
6
6
|
readonly onChange?: (value: string, event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
7
|
-
readonly label:
|
|
7
|
+
readonly label: React.ReactNode;
|
|
8
8
|
readonly hint?: string;
|
|
9
9
|
readonly error?: string;
|
|
10
10
|
readonly rows?: number;
|