@festo-ui/react 9.0.1 → 10.0.0-dev.826
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 +9 -9
- package/dist/components/breadcrumb/Breadcrumb.js +86 -26
- package/dist/components/button/Button.js +1 -0
- package/dist/components/card/Card.d.ts +3 -4
- 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/icon-wrapper/IconWrapper.d.ts +2 -1
- 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 +3 -3
- package/dist/components/modals/Prompt.js +9 -6
- package/dist/components/modals/image-gallery/ImageGallery.css +24 -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/modals/image-gallery/internal/ImageGalleryContainer.d.ts +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 +6 -4
- package/dist/components/popovers/legend/Legend.js +8 -4
- package/dist/components/popovers/popover/Popover.css +5 -52
- package/dist/components/popovers/popover/Popover.d.ts +12 -14
- package/dist/components/popovers/popover/Popover.js +82 -91
- package/dist/components/popovers/popover-menu/PopoverMenu.d.ts +6 -4
- package/dist/components/popovers/popover-menu/PopoverMenu.js +23 -27
- package/dist/components/popovers/popover-menu/PopoverMenuContext.d.ts +2 -1
- package/dist/components/popovers/popover-menu/PopoverMenuContext.js +1 -1
- package/dist/components/popovers/popover-menu/popover-menu-item/PopoverMenuItem.d.ts +8 -0
- package/dist/components/popovers/popover-menu/popover-menu-item/PopoverMenuItem.js +31 -0
- package/dist/components/popovers/tooltip/Tooltip.d.ts +4 -3
- package/dist/components/popovers/tooltip/Tooltip.js +7 -6
- 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 +4 -3
- package/dist/components/stepper-horizontal/step-horizontal/StepHorizontal.js +2 -1
- package/dist/components/stepper-vertical/StepperVertical.js +1 -1
- package/dist/components/stepper-vertical/step-vertical/StepVertical.js +1 -0
- package/dist/components/tab/Tabs.js +3 -3
- 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.css +124 -0
- package/dist/forms/combobox/ComboBox.d.ts +27 -0
- package/dist/forms/combobox/ComboBox.js +174 -0
- package/dist/forms/multi-select/MultiSelect.css +13 -0
- package/dist/forms/multi-select/MultiSelect.d.ts +20 -0
- package/dist/forms/multi-select/MultiSelect.js +192 -0
- 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 -9
- 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 +16 -17
- package/dist/forms/select/Select.js +80 -82
- package/dist/forms/select/internal/SelectButton.d.ts +0 -12
- package/dist/forms/select/internal/SelectButton.js +0 -49
- package/dist/forms/select/internal/SelectButtonContent.d.ts +0 -7
- package/dist/forms/select/internal/SelectButtonContent.js +0 -31
- package/dist/forms/select/internal/SelectOptionsContainer.d.ts +0 -17
- package/dist/forms/select/internal/SelectOptionsContainer.js +0 -103
- 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.css +31 -0
- package/dist/forms/text-input/TextInput.d.ts +6 -17
- package/dist/forms/text-input/TextInput.js +16 -25
- package/dist/forms/time-picker/TimePicker.d.ts +7 -6
- package/dist/forms/time-picker/TimePicker.js +16 -31
- 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/index.d.ts +7 -5
- package/dist/index.js +4 -3
- package/dist/utils/types.d.ts +0 -6
- package/dist/utils/useControlled.js +4 -4
- package/dist/utils/useForkRef.d.ts +2 -2
- package/dist/utils/useForkRef.js +2 -2
- package/dist/utils/useOnClickOutside.d.ts +1 -1
- package/package.json +17 -28
- package/dist/components/popovers/popover-menu-item/PopoverMenuItem.d.ts +0 -9
- package/dist/components/popovers/popover-menu-item/PopoverMenuItem.js +0 -29
- package/dist/forms/select/Select.css +0 -160
- package/dist/forms/select/internal/HiddenInput.d.ts +0 -8
- package/dist/forms/select/internal/HiddenInput.js +0 -15
- package/dist/forms/select/internal/ListItem.d.ts +0 -18
- package/dist/forms/select/internal/ListItem.js +0 -69
- package/dist/forms/select/internal/SelectCheckbox.d.ts +0 -4
- package/dist/forms/select/internal/SelectCheckbox.js +0 -13
- package/dist/forms/select/internal/SelectLabel.d.ts +0 -7
- package/dist/forms/select/internal/SelectLabel.js +0 -12
- package/dist/forms/select/internal/SelectScrollContainer.d.ts +0 -8
- package/dist/forms/select/internal/SelectScrollContainer.js +0 -15
- package/dist/forms/select/internal/SelectWrapper.d.ts +0 -6
- package/dist/forms/select/internal/SelectWrapper.js +0 -12
- package/dist/forms/select/internal/index.d.ts +0 -6
- package/dist/forms/select/internal/index.js +0 -7
- package/dist/forms/select/internal/utils.d.ts +0 -7
- package/dist/forms/select/internal/utils.js +0 -30
- package/dist/forms/select/select-option/SelectOption.d.ts +0 -14
- package/dist/forms/select/select-option/SelectOption.js +0 -12
- package/dist/forms/select/utils.d.ts +0 -2
- package/dist/forms/select/utils.js +0 -12
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useContext } from "react";
|
|
3
|
-
import { IconWrapper } from "../../icon-wrapper/IconWrapper.js";
|
|
4
|
-
import { PopoverMenuContext } from "../popover-menu/PopoverMenuContext.js";
|
|
5
|
-
function PopoverMenuItem({ item }) {
|
|
6
|
-
const { setShowPopper } = useContext(PopoverMenuContext);
|
|
7
|
-
function handleClick(e) {
|
|
8
|
-
e?.stopPropagation();
|
|
9
|
-
e?.preventDefault();
|
|
10
|
-
if (setShowPopper) setShowPopper(false);
|
|
11
|
-
if (item.action) item.action(item.data);
|
|
12
|
-
}
|
|
13
|
-
if (!item) return null;
|
|
14
|
-
return /*#__PURE__*/ jsxs("button", {
|
|
15
|
-
type: "button",
|
|
16
|
-
className: "fwe-btn-unstyled fr-popover-item",
|
|
17
|
-
onClick: (e)=>handleClick(e),
|
|
18
|
-
children: [
|
|
19
|
-
/*#__PURE__*/ jsx(IconWrapper, {
|
|
20
|
-
icon: item.icon
|
|
21
|
-
}),
|
|
22
|
-
/*#__PURE__*/ jsx("span", {
|
|
23
|
-
className: "fwe-mr-xxs",
|
|
24
|
-
children: item.text
|
|
25
|
-
})
|
|
26
|
-
]
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
export { PopoverMenuItem };
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
.fwe-select-wrapper {
|
|
2
|
-
width: inherit;
|
|
3
|
-
min-width: 48px;
|
|
4
|
-
display: flex;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.fwe-select-wrapper .fr-select-input {
|
|
8
|
-
opacity: 0;
|
|
9
|
-
pointer-events: none;
|
|
10
|
-
box-sizing: border-box;
|
|
11
|
-
width: 100%;
|
|
12
|
-
position: absolute;
|
|
13
|
-
bottom: 0;
|
|
14
|
-
left: 0;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.fwe-select-wrapper.fwe-disabled:before {
|
|
18
|
-
color: var(--fwe-text-disabled);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.fwe-select-wrapper .fwe-select {
|
|
22
|
-
text-align: left;
|
|
23
|
-
cursor: pointer;
|
|
24
|
-
height: unset;
|
|
25
|
-
background: none;
|
|
26
|
-
min-height: 33px;
|
|
27
|
-
padding: 0;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.fwe-select-wrapper .fwe-select .fwe-select-content {
|
|
31
|
-
white-space: nowrap;
|
|
32
|
-
text-overflow: ellipsis;
|
|
33
|
-
padding-right: 24px;
|
|
34
|
-
line-height: 1.5rem;
|
|
35
|
-
overflow: hidden;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.fwe-select-wrapper .fwe-select.fwe-required:not(.fwe-disabled) ~ .fwe-select-label:after {
|
|
39
|
-
content: "*";
|
|
40
|
-
display: inline-block;
|
|
41
|
-
position: relative;
|
|
42
|
-
left: 3px;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.fwe-select-wrapper .fwe-select.fwe-required:not(.fwe-disabled):not(.fwe-invalid) ~ .fwe-select-valid {
|
|
46
|
-
display: block;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.fwe-select-wrapper .fwe-select:focus:not(:disabled) {
|
|
50
|
-
color: var(--fwe-hero);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.fwe-select-wrapper .fwe-select:focus:not(:disabled) option {
|
|
54
|
-
color: var(--fwe-text);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.fwe-select-wrapper .fwe-select:focus:not(:disabled) {
|
|
58
|
-
border-color: var(--fwe-hero);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.fwe-select-wrapper .fwe-select:focus:invalid {
|
|
62
|
-
border-color: var(--fwe-red);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.fwe-select-wrapper .fwe-select.fwe-disabled {
|
|
66
|
-
cursor: default;
|
|
67
|
-
border-color: var(--fwe-control-disabled) !important;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.fwe-select-wrapper .fwe-select.fwe-disabled ~ .fwe-select-label, .fwe-select-wrapper .fwe-select.fwe-disabled .fwe-select-content {
|
|
71
|
-
color: var(--fwe-text-disabled);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.fwe-select-wrapper .fwe-select.fwe-disabled .fwe-chip {
|
|
75
|
-
color: var(--fwe-text-disabled);
|
|
76
|
-
border: 1px solid var(--fwe-control-disabled);
|
|
77
|
-
pointer-events: none;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.fwe-select-wrapper .fwe-select.fwe-invalid.fwe-select:hover, .fwe-select-wrapper .fwe-select.fwe-invalid.fwe-select:focus {
|
|
81
|
-
border-color: var(--fwe-red);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.fwe-select-wrapper .fwe-select.fwe-invalid ~ .fwe-select-invalid {
|
|
85
|
-
display: block;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.fwe-select-wrapper .fwe-select.fwe-invalid ~ .fwe-select-description {
|
|
89
|
-
display: none;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.fr-select-scroll {
|
|
93
|
-
overflow-y: scroll;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.fwe-select-options-container {
|
|
97
|
-
z-index: var(--fwe-z-index-popover);
|
|
98
|
-
max-width: 100vw;
|
|
99
|
-
font-size: var(--fwe-font-size-base);
|
|
100
|
-
background-color: var(--fwe-white);
|
|
101
|
-
border: 1px solid var(--fwe-gray-200);
|
|
102
|
-
border-radius: 4px;
|
|
103
|
-
margin: 0;
|
|
104
|
-
padding: 8px;
|
|
105
|
-
list-style: none;
|
|
106
|
-
box-shadow: 0 1px 4px #00000029;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.fwe-select-options-container .fwe-select-option {
|
|
110
|
-
cursor: pointer;
|
|
111
|
-
min-height: 24px;
|
|
112
|
-
padding: 12px 8px;
|
|
113
|
-
line-height: 24px;
|
|
114
|
-
position: relative;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.fwe-select-options-container .fwe-select-option:hover, .fwe-select-options-container .fwe-select-option:focus {
|
|
118
|
-
background-color: var(--fwe-gray-100);
|
|
119
|
-
outline: none;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.fwe-select-options-container .fwe-select-option:last-child {
|
|
123
|
-
border-bottom: none;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.fwe-select-options-container .fwe-select-option .fwe-select-option-content {
|
|
127
|
-
white-space: nowrap;
|
|
128
|
-
text-overflow: ellipsis;
|
|
129
|
-
min-height: 24px;
|
|
130
|
-
line-height: 24px;
|
|
131
|
-
display: block;
|
|
132
|
-
overflow: hidden;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.fr-backdrop {
|
|
136
|
-
z-index: var(--fwe-z-index-modal);
|
|
137
|
-
position: fixed;
|
|
138
|
-
inset: 0;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.chip-text-truncate {
|
|
142
|
-
white-space: nowrap;
|
|
143
|
-
text-overflow: ellipsis;
|
|
144
|
-
display: inline-block;
|
|
145
|
-
overflow: hidden;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.chip-removable {
|
|
149
|
-
cursor: pointer;
|
|
150
|
-
border: none;
|
|
151
|
-
padding: 0;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.fwe-chip .chip-removable svg {
|
|
155
|
-
margin: 0;
|
|
156
|
-
position: absolute;
|
|
157
|
-
top: 4px;
|
|
158
|
-
right: 5px;
|
|
159
|
-
}
|
|
160
|
-
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { SelectOptionType } from '../select-option/SelectOption';
|
|
2
|
-
interface HiddenInputProps<T> {
|
|
3
|
-
value: any;
|
|
4
|
-
onChange: (value: SelectOptionType<T>) => void;
|
|
5
|
-
options: SelectOptionType<T>[];
|
|
6
|
-
}
|
|
7
|
-
export declare function HiddenInput<T>({ value, onChange, options, }: HiddenInputProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
function HiddenInput({ value, onChange, options }) {
|
|
3
|
-
function handleChange(event) {
|
|
4
|
-
const child = options.find(({ data })=>data === event.target.value);
|
|
5
|
-
if (void 0 !== child) onChange(child);
|
|
6
|
-
}
|
|
7
|
-
return /*#__PURE__*/ jsx("input", {
|
|
8
|
-
className: "fr-select-input",
|
|
9
|
-
"aria-hidden": true,
|
|
10
|
-
tabIndex: -1,
|
|
11
|
-
value: value,
|
|
12
|
-
onChange: handleChange
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
export { HiddenInput };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React, { type Ref, type RefObject } from 'react';
|
|
2
|
-
import type { SelectOptionProps, SelectOptionType } from '../select-option/SelectOption';
|
|
3
|
-
export interface ListItemProps<T> extends React.ComponentPropsWithoutRef<'li'> {
|
|
4
|
-
empty?: boolean;
|
|
5
|
-
item: SelectOptionType<T> | React.ReactElement<SelectOptionProps<T>>;
|
|
6
|
-
options: SelectOptionType<T>[];
|
|
7
|
-
index: number;
|
|
8
|
-
onOptionChange: (option: SelectOptionType<T>) => void;
|
|
9
|
-
onFocusChange: (index: number) => void;
|
|
10
|
-
onClose: () => void;
|
|
11
|
-
selectedLabel?: string | string[];
|
|
12
|
-
withCheckbox?: boolean;
|
|
13
|
-
}
|
|
14
|
-
declare function ListItemComponent<T>({ children, className, empty, options, onClose, onOptionChange, index, selectedLabel, item, withCheckbox, onFocusChange, ...restProps }: ListItemProps<T>, ref: Ref<RefObject<HTMLLIElement>[]>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export declare const ListItem: <T>(props: ListItemProps<T> & {
|
|
16
|
-
ref?: Ref<RefObject<HTMLLIElement>[]>;
|
|
17
|
-
}) => ReturnType<typeof ListItemComponent>;
|
|
18
|
-
export {};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import classnames from "classnames";
|
|
3
|
-
import react, { forwardRef } from "react";
|
|
4
|
-
import { SelectCheckbox } from "./SelectCheckbox.js";
|
|
5
|
-
function ListItemComponent({ children, className, empty, options, onClose, onOptionChange, index, selectedLabel, item, withCheckbox, onFocusChange, ...restProps }, ref) {
|
|
6
|
-
const isChild = /*#__PURE__*/ react.isValidElement(item);
|
|
7
|
-
const option = isChild ? item.props.option : item;
|
|
8
|
-
const propsWithoutOption = isChild ? {
|
|
9
|
-
...item.props,
|
|
10
|
-
option: void 0
|
|
11
|
-
} : {};
|
|
12
|
-
const checked = Array.isArray(selectedLabel) ? selectedLabel.includes(option.label) : selectedLabel === option.label;
|
|
13
|
-
function handleKeyDown(e) {
|
|
14
|
-
const arrowKeys = [
|
|
15
|
-
'ArrowDown',
|
|
16
|
-
'ArrowUp'
|
|
17
|
-
];
|
|
18
|
-
const validKeys = [
|
|
19
|
-
'Enter',
|
|
20
|
-
' '
|
|
21
|
-
];
|
|
22
|
-
if (arrowKeys.concat(validKeys).includes(e.key)) e.preventDefault();
|
|
23
|
-
if ('ArrowDown' === e.key) onFocusChange((index + 1) % options.length);
|
|
24
|
-
if ('ArrowUp' === e.key) {
|
|
25
|
-
const nextIndex = (index - 1 + options.length) % options.length;
|
|
26
|
-
onFocusChange(nextIndex);
|
|
27
|
-
}
|
|
28
|
-
if ([
|
|
29
|
-
'Enter',
|
|
30
|
-
' '
|
|
31
|
-
].includes(e.key)) {
|
|
32
|
-
if (option.disabled) return;
|
|
33
|
-
onOptionChange(option);
|
|
34
|
-
}
|
|
35
|
-
if ('Escape' === e.key) onClose();
|
|
36
|
-
}
|
|
37
|
-
function handleClick() {
|
|
38
|
-
if (option.disabled) return;
|
|
39
|
-
onOptionChange(option);
|
|
40
|
-
}
|
|
41
|
-
const itemRef = 'function' != typeof ref ? ref?.current?.[index] : void 0;
|
|
42
|
-
return /*#__PURE__*/ jsx("li", {
|
|
43
|
-
onClick: handleClick,
|
|
44
|
-
ref: itemRef,
|
|
45
|
-
role: "option",
|
|
46
|
-
onKeyDown: handleKeyDown,
|
|
47
|
-
"aria-selected": checked,
|
|
48
|
-
className: classnames('fwe-select-option', {
|
|
49
|
-
'fwe-empty': !option.label
|
|
50
|
-
}, className),
|
|
51
|
-
tabIndex: 0,
|
|
52
|
-
...restProps,
|
|
53
|
-
children: /*#__PURE__*/ jsx(SelectCheckbox, {
|
|
54
|
-
disabled: option.disabled,
|
|
55
|
-
onClick: (e)=>e.stopPropagation(),
|
|
56
|
-
checked: checked,
|
|
57
|
-
withCheckbox: withCheckbox,
|
|
58
|
-
children: isChild ? /*#__PURE__*/ jsx("span", {
|
|
59
|
-
...propsWithoutOption
|
|
60
|
-
}) : /*#__PURE__*/ jsx("span", {
|
|
61
|
-
className: "fwe-select-option-content",
|
|
62
|
-
"data-testid": "fwe-select-option-content",
|
|
63
|
-
children: option.label
|
|
64
|
-
})
|
|
65
|
-
})
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
const ListItem = /*#__PURE__*/ forwardRef(ListItemComponent);
|
|
69
|
-
export { ListItem };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Checkbox } from "../../checkbox/Checkbox.js";
|
|
3
|
-
function SelectCheckbox({ children, withCheckbox, ...props }) {
|
|
4
|
-
if (withCheckbox) return /*#__PURE__*/ jsx(Checkbox, {
|
|
5
|
-
tabIndex: -1,
|
|
6
|
-
...props,
|
|
7
|
-
children: children
|
|
8
|
-
});
|
|
9
|
-
return /*#__PURE__*/ jsx(Fragment, {
|
|
10
|
-
children: children
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
export { SelectCheckbox };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import classnames from "classnames";
|
|
3
|
-
function SelectLabel({ hideLabel, label, id }) {
|
|
4
|
-
return /*#__PURE__*/ jsx("label", {
|
|
5
|
-
className: classnames('fwe-select-label', {
|
|
6
|
-
'fwe-sr-only': hideLabel
|
|
7
|
-
}),
|
|
8
|
-
htmlFor: id,
|
|
9
|
-
children: label || ''
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
export { SelectLabel };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { SelectConfiguration } from '../../../utils/types';
|
|
2
|
-
interface SelectScrollContainerProps {
|
|
3
|
-
readonly config?: SelectConfiguration;
|
|
4
|
-
readonly children: React.ReactNode;
|
|
5
|
-
readonly length: number;
|
|
6
|
-
}
|
|
7
|
-
export declare function SelectScrollContainer({ config, children, length, }: SelectScrollContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { calcVirtualScrollHeight } from "../utils.js";
|
|
3
|
-
function SelectScrollContainer({ config, children, length }) {
|
|
4
|
-
if (config?.scroll?.enabled) return /*#__PURE__*/ jsx("div", {
|
|
5
|
-
className: "fr-select-scroll",
|
|
6
|
-
style: {
|
|
7
|
-
height: calcVirtualScrollHeight(config, length)
|
|
8
|
-
},
|
|
9
|
-
children: children
|
|
10
|
-
});
|
|
11
|
-
return /*#__PURE__*/ jsx(Fragment, {
|
|
12
|
-
children: children
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
export { SelectScrollContainer };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type ComponentPropsWithoutRef } from 'react';
|
|
2
|
-
interface SelectWrapperProps extends ComponentPropsWithoutRef<'div'> {
|
|
3
|
-
disabled?: boolean;
|
|
4
|
-
}
|
|
5
|
-
export declare const SelectWrapper: (props: SelectWrapperProps & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
6
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import classnames from "classnames";
|
|
3
|
-
import { forwardRef } from "react";
|
|
4
|
-
const SelectWrapper = /*#__PURE__*/ forwardRef(({ children, disabled, className, ...props }, ref)=>/*#__PURE__*/ jsx("div", {
|
|
5
|
-
...props,
|
|
6
|
-
ref: ref,
|
|
7
|
-
className: classnames('fwe-select-wrapper', {
|
|
8
|
-
'fwe-disabled': disabled
|
|
9
|
-
}, className),
|
|
10
|
-
children: children
|
|
11
|
-
}));
|
|
12
|
-
export { SelectWrapper };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { HiddenInput } from './HiddenInput';
|
|
2
|
-
export { ListItem } from './ListItem';
|
|
3
|
-
export { SelectButton } from './SelectButton';
|
|
4
|
-
export { SelectLabel } from './SelectLabel';
|
|
5
|
-
export { SelectOptionsContainer } from './SelectOptionsContainer';
|
|
6
|
-
export { SelectWrapper } from './SelectWrapper';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { HiddenInput } from "./HiddenInput.js";
|
|
2
|
-
import { ListItem } from "./ListItem.js";
|
|
3
|
-
import { SelectButton } from "./SelectButton.js";
|
|
4
|
-
import { SelectLabel } from "./SelectLabel.js";
|
|
5
|
-
import { SelectOptionsContainer } from "./SelectOptionsContainer.js";
|
|
6
|
-
import { SelectWrapper } from "./SelectWrapper.js";
|
|
7
|
-
export { HiddenInput, ListItem, SelectButton, SelectLabel, SelectOptionsContainer, SelectWrapper };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { SelectOptionProps } from '../select-option/SelectOption';
|
|
3
|
-
export declare function getChildren<T>(children: React.ReactNode): {
|
|
4
|
-
childrenList: React.ReactElement<SelectOptionProps<T>, string | React.JSXElementConstructor<any>>[];
|
|
5
|
-
after: React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
|
|
6
|
-
before: React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
|
|
7
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import classnames from "classnames";
|
|
2
|
-
import react from "react";
|
|
3
|
-
import { SelectOption } from "../select-option/SelectOption.js";
|
|
4
|
-
function getChildren(children) {
|
|
5
|
-
const before = [];
|
|
6
|
-
const childrenList = [];
|
|
7
|
-
const after = [];
|
|
8
|
-
let foundFirstOption = false;
|
|
9
|
-
react.Children.forEach(children, (element)=>{
|
|
10
|
-
if (react.isValidElement(element)) if (react.isValidElement(element) && element.type === SelectOption) {
|
|
11
|
-
foundFirstOption = true;
|
|
12
|
-
const className = classnames('fwe-select-option-content', element.props.className);
|
|
13
|
-
const { props } = element;
|
|
14
|
-
childrenList.push({
|
|
15
|
-
...element,
|
|
16
|
-
props: {
|
|
17
|
-
...props,
|
|
18
|
-
className
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
} else if (foundFirstOption) after.push(element);
|
|
22
|
-
else before.push(element);
|
|
23
|
-
});
|
|
24
|
-
return {
|
|
25
|
-
childrenList,
|
|
26
|
-
after,
|
|
27
|
-
before
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export { getChildren };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type ComponentPropsWithoutRef, type Ref } from 'react';
|
|
2
|
-
export interface SelectOptionType<T> {
|
|
3
|
-
readonly label: string;
|
|
4
|
-
readonly data: T;
|
|
5
|
-
readonly disabled?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface SelectOptionProps<T> extends ComponentPropsWithoutRef<'span'> {
|
|
8
|
-
option: SelectOptionType<T>;
|
|
9
|
-
}
|
|
10
|
-
declare function SelectOptionComponent<T>({ children, className, ...props }: SelectOptionProps<T>, ref: Ref<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export declare const SelectOption: <T>(props: SelectOptionProps<T> & {
|
|
12
|
-
ref?: Ref<HTMLDivElement>;
|
|
13
|
-
}) => ReturnType<typeof SelectOptionComponent>;
|
|
14
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
function SelectOptionComponent({ children, className, ...props }, ref) {
|
|
4
|
-
return /*#__PURE__*/ jsx("span", {
|
|
5
|
-
ref: ref,
|
|
6
|
-
className: className,
|
|
7
|
-
...props,
|
|
8
|
-
children: children
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
const SelectOption = /*#__PURE__*/ forwardRef(SelectOptionComponent);
|
|
12
|
-
export { SelectOption };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
function calcVirtualScrollHeight(config, itemLength) {
|
|
2
|
-
const defaultHeight = 48;
|
|
3
|
-
let height = defaultHeight;
|
|
4
|
-
if (2 === itemLength) height = 2 * defaultHeight;
|
|
5
|
-
else if (itemLength >= 3) height = 3 * defaultHeight;
|
|
6
|
-
if (config?.scroll?.viewportSize != null && void 0 !== config.scroll.viewportSize) {
|
|
7
|
-
if (itemLength >= config.scroll.viewportSize) height = config.scroll.viewportSize * defaultHeight;
|
|
8
|
-
else if (itemLength < config.scroll.viewportSize) height = itemLength * defaultHeight;
|
|
9
|
-
}
|
|
10
|
-
return height;
|
|
11
|
-
}
|
|
12
|
-
export { calcVirtualScrollHeight };
|