@festo-ui/react 9.0.1-dev.768 → 9.0.1-dev.769
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.css +4 -0
- package/dist/components/accordion/Accordion.d.ts +10 -0
- package/dist/components/accordion/Accordion.js +41 -0
- package/dist/components/accordion/AccordionContext.d.ts +11 -0
- package/dist/components/accordion/AccordionContext.js +3 -0
- package/dist/components/accordion/accordion-header/AccordionHeader.css +11 -0
- package/dist/components/accordion/accordion-header/AccordionHeader.d.ts +2 -0
- package/dist/components/accordion/accordion-header/AccordionHeader.js +11 -0
- package/dist/components/accordion/accordion-item/AccordionItem.css +64 -0
- package/dist/components/accordion/accordion-item/AccordionItem.d.ts +8 -0
- package/dist/components/accordion/accordion-item/AccordionItem.js +60 -0
- package/dist/components/accordion/accordion-item/AccordionItemContext.d.ts +7 -0
- package/dist/components/accordion/accordion-item/AccordionItemContext.js +3 -0
- package/dist/components/accordion/accordion-item/accordion-item-body/AccordionItemBody.css +76 -0
- package/dist/components/accordion/accordion-item/accordion-item-body/AccordionItemBody.d.ts +2 -0
- package/dist/components/accordion/accordion-item/accordion-item-body/AccordionItemBody.js +61 -0
- package/dist/components/accordion/accordion-item/accordion-item-header/AccordionItemHeader.css +11 -0
- package/dist/components/accordion/accordion-item/accordion-item-header/AccordionItemHeader.d.ts +2 -0
- package/dist/components/accordion/accordion-item/accordion-item-header/AccordionItemHeader.js +20 -0
- package/dist/components/bottom-sheet/BottomSheet.css +18 -0
- package/dist/components/bottom-sheet/BottomSheet.d.ts +11 -0
- package/dist/components/bottom-sheet/BottomSheet.js +101 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts +14 -0
- package/dist/components/breadcrumb/Breadcrumb.js +84 -0
- package/dist/components/button/Button.d.ts +11 -0
- package/dist/components/button/Button.js +36 -0
- package/dist/components/card/Card.d.ts +4 -0
- package/dist/components/card/Card.js +9 -0
- package/dist/components/card/CardBody.d.ts +5 -0
- package/dist/components/card/CardBody.js +15 -0
- package/dist/components/card/CardHeader.d.ts +8 -0
- package/dist/components/card/CardHeader.js +31 -0
- package/dist/components/card/CardHeader.stories.helper.js +7 -0
- package/dist/components/card/CardNotification.d.ts +6 -0
- package/dist/components/card/CardNotification.js +26 -0
- package/dist/components/chips/chip/Chip.d.ts +17 -0
- package/dist/components/chips/chip/Chip.js +38 -0
- package/dist/components/chips/chip-container/ChipContainer.d.ts +5 -0
- package/dist/components/chips/chip-container/ChipContainer.js +12 -0
- package/dist/components/icon-wrapper/IconWrapper.d.ts +6 -0
- package/dist/components/icon-wrapper/IconWrapper.js +13 -0
- package/dist/components/loading-indicator/LoadingIndicator.d.ts +5 -0
- package/dist/components/loading-indicator/LoadingIndicator.js +41 -0
- package/dist/components/mobile-flyout/MobileFlyout.d.ts +11 -0
- package/dist/components/mobile-flyout/MobileFlyout.js +88 -0
- package/dist/components/mobile-flyout/MobileFlyoutContext.d.ts +8 -0
- package/dist/components/mobile-flyout/MobileFlyoutContext.js +3 -0
- package/dist/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.d.ts +17 -0
- package/dist/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.js +36 -0
- package/dist/components/mobile-flyout/mobile-flyout-page/MobileFlyoutPage.css +5 -0
- package/dist/components/mobile-flyout/mobile-flyout-page/MobileFlyoutPage.d.ts +8 -0
- package/dist/components/mobile-flyout/mobile-flyout-page/MobileFlyoutPage.js +35 -0
- package/dist/components/modals/AlertModal.d.ts +12 -0
- package/dist/components/modals/AlertModal.js +53 -0
- package/dist/components/modals/ConfirmModal.d.ts +11 -0
- package/dist/components/modals/ConfirmModal.js +46 -0
- package/dist/components/modals/CustomModal.d.ts +8 -0
- package/dist/components/modals/CustomModal.js +38 -0
- package/dist/components/modals/Modal.css +39 -0
- package/dist/components/modals/Modal.d.ts +8 -0
- package/dist/components/modals/Modal.js +31 -0
- package/dist/components/modals/ModalBase.d.ts +9 -0
- package/dist/components/modals/ModalBase.js +124 -0
- package/dist/components/modals/ModalFooter.d.ts +2 -0
- package/dist/components/modals/ModalFooter.js +12 -0
- package/dist/components/modals/Prompt.d.ts +15 -0
- package/dist/components/modals/Prompt.js +58 -0
- package/dist/components/modals/image-gallery/ImageGallery.css +815 -0
- package/dist/components/modals/image-gallery/ImageGallery.d.ts +21 -0
- package/dist/components/modals/image-gallery/ImageGallery.helper.d.ts +2 -0
- package/dist/components/modals/image-gallery/ImageGallery.helper.js +13 -0
- package/dist/components/modals/image-gallery/ImageGallery.js +103 -0
- package/dist/components/modals/image-gallery/ImageGallery.stories.helper.js +112 -0
- package/dist/components/modals/image-gallery/ImageGalleryContent.d.ts +8 -0
- package/dist/components/modals/image-gallery/ImageGalleryContent.js +15 -0
- package/dist/components/modals/image-gallery/ImageGalleryScale.d.ts +6 -0
- package/dist/components/modals/image-gallery/ImageGalleryScale.js +15 -0
- package/dist/components/modals/image-gallery/ImageGallerySwiper.d.ts +12 -0
- package/dist/components/modals/image-gallery/ImageGallerySwiper.js +40 -0
- package/dist/components/modals/image-gallery/ImageGalleryThumbsSwiper.d.ts +7 -0
- package/dist/components/modals/image-gallery/ImageGalleryThumbsSwiper.js +27 -0
- package/dist/components/modals/image-gallery/internal/CloseButton.d.ts +6 -0
- package/dist/components/modals/image-gallery/internal/CloseButton.js +14 -0
- package/dist/components/modals/image-gallery/internal/ImageGalleryContainer.d.ts +5 -0
- package/dist/components/modals/image-gallery/internal/ImageGalleryContainer.js +8 -0
- package/dist/components/modals/image-gallery/internal/ImageGalleryPagination.d.ts +5 -0
- package/dist/components/modals/image-gallery/internal/ImageGalleryPagination.js +29 -0
- package/dist/components/pagination/Pagination.css +10 -0
- package/dist/components/pagination/Pagination.d.ts +15 -0
- package/dist/components/pagination/Pagination.js +100 -0
- package/dist/components/popovers/legend/Legend.d.ts +9 -0
- package/dist/components/popovers/legend/Legend.js +21 -0
- package/dist/components/popovers/popover/Popover.css +56 -0
- package/dist/components/popovers/popover/Popover.d.ts +21 -0
- package/dist/components/popovers/popover/Popover.js +106 -0
- package/dist/components/popovers/popover-menu/PopoverMenu.d.ts +7 -0
- package/dist/components/popovers/popover-menu/PopoverMenu.js +37 -0
- package/dist/components/popovers/popover-menu/PopoverMenuContext.d.ts +3 -0
- package/dist/components/popovers/popover-menu/PopoverMenuContext.js +5 -0
- package/dist/components/popovers/popover-menu-item/PopoverMenuItem.d.ts +9 -0
- package/dist/components/popovers/popover-menu-item/PopoverMenuItem.js +28 -0
- package/dist/components/popovers/tooltip/Tooltip.d.ts +5 -0
- package/dist/components/popovers/tooltip/Tooltip.js +12 -0
- package/dist/components/progress/Progress.d.ts +7 -0
- package/dist/components/progress/Progress.js +26 -0
- package/dist/components/search-input/ClearButton.d.ts +2 -0
- package/dist/components/search-input/ClearButton.js +10 -0
- package/dist/components/search-input/SearchInput.css +13 -0
- package/dist/components/search-input/SearchInput.d.ts +14 -0
- package/dist/components/search-input/SearchInput.js +61 -0
- package/dist/components/search-input/SearchSuggestion.d.ts +17 -0
- package/dist/components/search-input/SearchSuggestion.js +21 -0
- package/dist/components/search-input/useSearchInput.d.ts +13 -0
- package/dist/components/search-input/useSearchInput.js +85 -0
- package/dist/components/snackbar/Snackbar.css +55 -0
- package/dist/components/snackbar/Snackbar.d.ts +21 -0
- package/dist/components/snackbar/Snackbar.js +78 -0
- package/dist/components/snackbar/SnackbarContext.d.ts +7 -0
- package/dist/components/snackbar/SnackbarContext.js +3 -0
- package/dist/components/snackbar/SnackbarProvider.d.ts +7 -0
- package/dist/components/snackbar/SnackbarProvider.js +66 -0
- package/dist/components/snackbar/useSnackbar.d.ts +2 -0
- package/dist/components/snackbar/useSnackbar.js +4 -0
- package/dist/components/stepper-horizontal/StepperHorizontal.css +6 -0
- package/dist/components/stepper-horizontal/StepperHorizontal.d.ts +7 -0
- package/dist/components/stepper-horizontal/StepperHorizontal.js +48 -0
- package/dist/components/stepper-horizontal/step-horizontal/StepHorizontal.css +24 -0
- package/dist/components/stepper-horizontal/step-horizontal/StepHorizontal.d.ts +6 -0
- package/dist/components/stepper-horizontal/step-horizontal/StepHorizontal.js +16 -0
- package/dist/components/stepper-vertical/StepperVertical.d.ts +6 -0
- package/dist/components/stepper-vertical/StepperVertical.js +26 -0
- package/dist/components/stepper-vertical/step-vertical/StepVertical.css +10 -0
- package/dist/components/stepper-vertical/step-vertical/StepVertical.d.ts +11 -0
- package/dist/components/stepper-vertical/step-vertical/StepVertical.js +58 -0
- package/dist/components/tab/Tabs.css +285 -0
- package/dist/components/tab/Tabs.d.ts +22 -0
- package/dist/components/tab/Tabs.js +194 -0
- package/dist/components/tab/interfaces.d.ts +5 -0
- package/dist/components/tab/interfaces.js +0 -0
- package/dist/components/tab/tab-pane/TabPane.css +8 -0
- package/dist/components/tab/tab-pane/TabPane.d.ts +9 -0
- package/dist/components/tab/tab-pane/TabPane.js +18 -0
- package/dist/components/tab/useTabScroll.d.ts +25 -0
- package/dist/components/tab/useTabScroll.js +151 -0
- package/dist/components/table-header-cell/TableHeaderCell.d.ts +5 -0
- package/dist/components/table-header-cell/TableHeaderCell.js +21 -0
- package/dist/forms/checkbox/Checkbox.css +134 -0
- package/dist/forms/checkbox/Checkbox.d.ts +15 -0
- package/dist/forms/checkbox/Checkbox.js +80 -0
- package/dist/forms/combobox/ComboBox.css +163 -0
- package/dist/forms/combobox/ComboBox.d.ts +28 -0
- package/dist/forms/combobox/ComboBox.js +169 -0
- package/dist/forms/radio/RadioButton.d.ts +14 -0
- package/dist/forms/radio/RadioButton.js +61 -0
- package/dist/forms/radio/RadioGroup.d.ts +12 -0
- package/dist/forms/radio/RadioGroup.js +50 -0
- package/dist/forms/radio/RadioGroupContext.d.ts +12 -0
- package/dist/forms/radio/RadioGroupContext.js +3 -0
- package/dist/forms/segment/Segment.d.ts +13 -0
- package/dist/forms/segment/Segment.js +59 -0
- package/dist/forms/segment/segment-control/SegmentControl.d.ts +14 -0
- package/dist/forms/segment/segment-control/SegmentControl.js +57 -0
- package/dist/forms/select/Select.css +160 -0
- package/dist/forms/select/Select.d.ts +26 -0
- package/dist/forms/select/Select.js +95 -0
- package/dist/forms/select/internal/HiddenInput.d.ts +8 -0
- package/dist/forms/select/internal/HiddenInput.js +15 -0
- package/dist/forms/select/internal/ListItem.d.ts +18 -0
- package/dist/forms/select/internal/ListItem.js +69 -0
- package/dist/forms/select/internal/SelectButton.d.ts +12 -0
- package/dist/forms/select/internal/SelectButton.js +49 -0
- package/dist/forms/select/internal/SelectButtonContent.d.ts +7 -0
- package/dist/forms/select/internal/SelectButtonContent.js +31 -0
- package/dist/forms/select/internal/SelectCheckbox.d.ts +4 -0
- package/dist/forms/select/internal/SelectCheckbox.js +13 -0
- package/dist/forms/select/internal/SelectLabel.d.ts +7 -0
- package/dist/forms/select/internal/SelectLabel.js +12 -0
- package/dist/forms/select/internal/SelectOptionsContainer.d.ts +17 -0
- package/dist/forms/select/internal/SelectOptionsContainer.js +103 -0
- package/dist/forms/select/internal/SelectScrollContainer.d.ts +8 -0
- package/dist/forms/select/internal/SelectScrollContainer.js +15 -0
- package/dist/forms/select/internal/SelectWrapper.d.ts +6 -0
- package/dist/forms/select/internal/SelectWrapper.js +12 -0
- package/dist/forms/select/internal/index.d.ts +6 -0
- package/dist/forms/select/internal/index.js +7 -0
- package/dist/forms/select/internal/utils.d.ts +7 -0
- package/dist/forms/select/internal/utils.js +30 -0
- package/dist/forms/select/select-option/SelectOption.d.ts +14 -0
- package/dist/forms/select/select-option/SelectOption.js +12 -0
- package/dist/forms/select/utils.d.ts +2 -0
- package/dist/forms/select/utils.js +12 -0
- package/dist/forms/slider/Slider.css +50 -0
- package/dist/forms/slider/Slider.d.ts +17 -0
- package/dist/forms/slider/Slider.js +93 -0
- package/dist/forms/switch/Switch.d.ts +12 -0
- package/dist/forms/switch/Switch.js +42 -0
- package/dist/forms/text-area/TextArea.css +14 -0
- package/dist/forms/text-area/TextArea.d.ts +22 -0
- package/dist/forms/text-area/TextArea.js +99 -0
- package/dist/forms/text-input/TextInput.d.ts +24 -0
- package/dist/forms/text-input/TextInput.js +74 -0
- package/dist/forms/time-picker/TimePicker.css +10 -0
- package/dist/forms/time-picker/TimePicker.d.ts +24 -0
- package/dist/forms/time-picker/TimePicker.js +140 -0
- package/dist/forms/time-picker/time-picker-dropdown/TimePickerDropdown.css +4 -0
- package/dist/forms/time-picker/time-picker-dropdown/TimePickerDropdown.d.ts +19 -0
- package/dist/forms/time-picker/time-picker-dropdown/TimePickerDropdown.js +208 -0
- package/dist/forms/time-picker/time-picker-dropdown/TimePickerInput.d.ts +9 -0
- package/dist/forms/time-picker/time-picker-dropdown/TimePickerInput.js +14 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +60 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/setRef.d.ts +1 -0
- package/dist/utils/setRef.js +5 -0
- package/dist/utils/types.d.ts +36 -0
- package/dist/utils/types.js +0 -0
- package/dist/utils/useControlled.d.ts +7 -0
- package/dist/utils/useControlled.js +20 -0
- package/dist/utils/useForkRef.d.ts +2 -0
- package/dist/utils/useForkRef.js +15 -0
- package/dist/utils/useId.d.ts +1 -0
- package/dist/utils/useId.js +20 -0
- package/dist/utils/useOnClickOutside.d.ts +2 -0
- package/dist/utils/useOnClickOutside.js +20 -0
- package/package.json +1 -1
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "./ComboBox.css";
|
|
3
|
+
import { Combobox, ComboboxButton, ComboboxInput, ComboboxOption, ComboboxOptions } from "@headlessui/react";
|
|
4
|
+
import classnames from "classnames";
|
|
5
|
+
import { forwardRef, useMemo, useRef, useState } from "react";
|
|
6
|
+
import { useControlled } from "../../utils/useControlled.js";
|
|
7
|
+
import { useId } from "../../utils/useId.js";
|
|
8
|
+
function getHighlightedLabel(label, query) {
|
|
9
|
+
if (!query) return [
|
|
10
|
+
{
|
|
11
|
+
text: label,
|
|
12
|
+
highlighted: false
|
|
13
|
+
}
|
|
14
|
+
];
|
|
15
|
+
const parts = [];
|
|
16
|
+
const lowerLabel = label.toLowerCase();
|
|
17
|
+
const lowerQuery = query.toLowerCase();
|
|
18
|
+
let currentIndex = 0;
|
|
19
|
+
while(currentIndex < label.length){
|
|
20
|
+
const matchIndex = lowerLabel.indexOf(lowerQuery, currentIndex);
|
|
21
|
+
if (-1 === matchIndex) {
|
|
22
|
+
parts.push({
|
|
23
|
+
text: label.slice(currentIndex),
|
|
24
|
+
highlighted: false
|
|
25
|
+
});
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
if (matchIndex > currentIndex) parts.push({
|
|
29
|
+
text: label.slice(currentIndex, matchIndex),
|
|
30
|
+
highlighted: false
|
|
31
|
+
});
|
|
32
|
+
parts.push({
|
|
33
|
+
text: label.slice(matchIndex, matchIndex + query.length),
|
|
34
|
+
highlighted: true
|
|
35
|
+
});
|
|
36
|
+
currentIndex = matchIndex + query.length;
|
|
37
|
+
}
|
|
38
|
+
return parts;
|
|
39
|
+
}
|
|
40
|
+
function ComboBoxComponent({ defaultValue = '', value: controlled, label, options = [], onChange, required = false, disabled, name, id: idProp, hint, error, placeholder, onInputChange, emptyMessage = 'No results found', className, ...props }, ref) {
|
|
41
|
+
const id = useId(idProp);
|
|
42
|
+
const controlRef = useRef(null);
|
|
43
|
+
const [value, setValue] = useControlled({
|
|
44
|
+
controlled,
|
|
45
|
+
default: defaultValue,
|
|
46
|
+
onChange
|
|
47
|
+
});
|
|
48
|
+
const [query, setQuery] = useState('');
|
|
49
|
+
const selectedOption = useMemo(()=>options.find((option)=>option.data === value && !option.disabled), [
|
|
50
|
+
options,
|
|
51
|
+
value
|
|
52
|
+
]);
|
|
53
|
+
const filteredOptions = useMemo(()=>{
|
|
54
|
+
if (!query) return options;
|
|
55
|
+
const normalizedQuery = query.toLowerCase();
|
|
56
|
+
return options.filter((option)=>option.label.toLowerCase().includes(normalizedQuery));
|
|
57
|
+
}, [
|
|
58
|
+
options,
|
|
59
|
+
query
|
|
60
|
+
]);
|
|
61
|
+
function handleChange(option) {
|
|
62
|
+
if (!option || option.disabled) return;
|
|
63
|
+
setValue(option.data);
|
|
64
|
+
setQuery('');
|
|
65
|
+
}
|
|
66
|
+
function handleInputChange(inputValue) {
|
|
67
|
+
setQuery(inputValue);
|
|
68
|
+
onInputChange?.(inputValue);
|
|
69
|
+
}
|
|
70
|
+
const inputClasses = classnames('fr-combobox-input', {
|
|
71
|
+
'fr-required': required,
|
|
72
|
+
'fr-disabled': disabled,
|
|
73
|
+
'fr-invalid': error,
|
|
74
|
+
'fr-empty': !query && !selectedOption
|
|
75
|
+
});
|
|
76
|
+
return /*#__PURE__*/ jsx(Combobox, {
|
|
77
|
+
value: selectedOption ?? null,
|
|
78
|
+
onChange: handleChange,
|
|
79
|
+
disabled: disabled,
|
|
80
|
+
immediate: true,
|
|
81
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
82
|
+
className: classnames(className, 'fr-combobox-wrapper', {
|
|
83
|
+
'fr-disabled': disabled,
|
|
84
|
+
'fr-invalid': error,
|
|
85
|
+
'fr-required': required
|
|
86
|
+
}),
|
|
87
|
+
ref: ref,
|
|
88
|
+
...props,
|
|
89
|
+
children: [
|
|
90
|
+
/*#__PURE__*/ jsx("label", {
|
|
91
|
+
className: classnames('fr-combobox-label'),
|
|
92
|
+
htmlFor: id,
|
|
93
|
+
children: label || ''
|
|
94
|
+
}),
|
|
95
|
+
/*#__PURE__*/ jsxs("div", {
|
|
96
|
+
className: "fr-combobox-control",
|
|
97
|
+
ref: controlRef,
|
|
98
|
+
children: [
|
|
99
|
+
/*#__PURE__*/ jsx(ComboboxInput, {
|
|
100
|
+
className: inputClasses,
|
|
101
|
+
id: id,
|
|
102
|
+
name: name,
|
|
103
|
+
required: required,
|
|
104
|
+
disabled: disabled,
|
|
105
|
+
placeholder: placeholder,
|
|
106
|
+
autoComplete: "off",
|
|
107
|
+
displayValue: (option)=>option?.label ?? '',
|
|
108
|
+
onChange: (event)=>handleInputChange(event.target.value)
|
|
109
|
+
}),
|
|
110
|
+
/*#__PURE__*/ jsx(ComboboxButton, {
|
|
111
|
+
className: "fr-combobox-button",
|
|
112
|
+
disabled: disabled,
|
|
113
|
+
"aria-label": "Optionen anzeigen"
|
|
114
|
+
})
|
|
115
|
+
]
|
|
116
|
+
}),
|
|
117
|
+
/*#__PURE__*/ jsxs(ComboboxOptions, {
|
|
118
|
+
className: "fr-combobox-options-container",
|
|
119
|
+
as: "ul",
|
|
120
|
+
portal: false,
|
|
121
|
+
anchor: {
|
|
122
|
+
to: 'bottom start',
|
|
123
|
+
gap: 20,
|
|
124
|
+
padding: 8
|
|
125
|
+
},
|
|
126
|
+
children: [
|
|
127
|
+
0 === filteredOptions.length && /*#__PURE__*/ jsx("li", {
|
|
128
|
+
className: "fr-combobox-option fr-combobox-empty",
|
|
129
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
130
|
+
className: "fr-combobox-option-content",
|
|
131
|
+
children: emptyMessage
|
|
132
|
+
})
|
|
133
|
+
}),
|
|
134
|
+
filteredOptions.map((option)=>/*#__PURE__*/ jsx(ComboboxOption, {
|
|
135
|
+
value: option,
|
|
136
|
+
disabled: option.disabled,
|
|
137
|
+
as: "li",
|
|
138
|
+
className: ({ focus, selected, disabled: isDisabled })=>classnames('fr-combobox-option', {
|
|
139
|
+
'fr-selected': selected,
|
|
140
|
+
'fr-focus': focus,
|
|
141
|
+
'fr-disabled': isDisabled
|
|
142
|
+
}),
|
|
143
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
144
|
+
className: "fr-combobox-option-content",
|
|
145
|
+
"data-testid": "fr-combobox-option-content",
|
|
146
|
+
children: getHighlightedLabel(option.label, query).map((part, index)=>/*#__PURE__*/ jsx("span", {
|
|
147
|
+
className: classnames({
|
|
148
|
+
'fr-combobox-highlight': part.highlighted
|
|
149
|
+
}),
|
|
150
|
+
children: part.text
|
|
151
|
+
}, `${part.text}-${index}`))
|
|
152
|
+
})
|
|
153
|
+
}, String(option.data)))
|
|
154
|
+
]
|
|
155
|
+
}),
|
|
156
|
+
hint && !error && /*#__PURE__*/ jsx("div", {
|
|
157
|
+
className: "fr-combobox-description",
|
|
158
|
+
children: hint
|
|
159
|
+
}),
|
|
160
|
+
error && /*#__PURE__*/ jsx("div", {
|
|
161
|
+
className: "fr-combobox-invalid",
|
|
162
|
+
children: error
|
|
163
|
+
})
|
|
164
|
+
]
|
|
165
|
+
})
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
const ComboBox = /*#__PURE__*/ forwardRef(ComboBoxComponent);
|
|
169
|
+
export { ComboBox };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ClassNamePropsWithChildren } from '../../utils/types';
|
|
2
|
+
export interface RadioButtonProps extends ClassNamePropsWithChildren {
|
|
3
|
+
readonly id?: string;
|
|
4
|
+
readonly defaultChecked?: boolean;
|
|
5
|
+
readonly checked?: boolean;
|
|
6
|
+
readonly onChange?: (value: string) => void;
|
|
7
|
+
readonly name?: string;
|
|
8
|
+
readonly value?: string;
|
|
9
|
+
readonly labelPosition?: 'before' | 'after' | 'below';
|
|
10
|
+
readonly large?: boolean;
|
|
11
|
+
readonly disabled?: boolean;
|
|
12
|
+
readonly required?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function RadioButton(props: RadioButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
import { useId } from "../../utils/useId.js";
|
|
5
|
+
import { RadioGroupContext } from "./RadioGroupContext.js";
|
|
6
|
+
function RadioButton(props) {
|
|
7
|
+
const { id: idProps, onChange, value, name, defaultChecked: defaultCheckedProp, checked, labelPosition = 'after', large = false, disabled = false, required = false, children, className } = props;
|
|
8
|
+
const { disabled: groupDisabled, labelPosition: groupLabelPosition, large: groupLarge, name: groupName, value: groupValue, required: groupRequired, handleValueChange: onGroupValueChange, isControlled } = useContext(RadioGroupContext);
|
|
9
|
+
const innerLabelPosition = groupLabelPosition ?? labelPosition;
|
|
10
|
+
const classes = classnames('fwe-radio', {
|
|
11
|
+
'fwe-radio-label-below': 'below' === innerLabelPosition
|
|
12
|
+
}, {
|
|
13
|
+
'fwe-radio-label-before': 'before' === innerLabelPosition
|
|
14
|
+
}, {
|
|
15
|
+
'fwe-radio-lg': large || groupLarge
|
|
16
|
+
}, className);
|
|
17
|
+
const controlledChecked = void 0 !== checked || isControlled && void 0 !== groupValue ? Boolean(checked || groupValue === value) : void 0;
|
|
18
|
+
const getDefaultChecked = ()=>{
|
|
19
|
+
if (void 0 !== controlledChecked) return;
|
|
20
|
+
if (void 0 !== defaultCheckedProp) return defaultCheckedProp;
|
|
21
|
+
if (!isControlled && void 0 !== groupValue) return groupValue === value;
|
|
22
|
+
};
|
|
23
|
+
const defaultChecked = getDefaultChecked();
|
|
24
|
+
function handleChange(event) {
|
|
25
|
+
const newValue = event.target.value;
|
|
26
|
+
if (newValue) onGroupValueChange?.(newValue);
|
|
27
|
+
onChange?.(newValue);
|
|
28
|
+
}
|
|
29
|
+
const id = useId(idProps);
|
|
30
|
+
return /*#__PURE__*/ jsxs("label", {
|
|
31
|
+
className: classes,
|
|
32
|
+
htmlFor: id,
|
|
33
|
+
children: [
|
|
34
|
+
/*#__PURE__*/ jsxs("div", {
|
|
35
|
+
className: "fwe-radio-check",
|
|
36
|
+
children: [
|
|
37
|
+
/*#__PURE__*/ jsx("input", {
|
|
38
|
+
defaultChecked: defaultChecked,
|
|
39
|
+
checked: controlledChecked,
|
|
40
|
+
type: "radio",
|
|
41
|
+
id: id,
|
|
42
|
+
name: groupName || name,
|
|
43
|
+
value: value,
|
|
44
|
+
onChange: handleChange,
|
|
45
|
+
disabled: disabled || groupDisabled,
|
|
46
|
+
required: required || groupRequired
|
|
47
|
+
}),
|
|
48
|
+
/*#__PURE__*/ jsx("div", {
|
|
49
|
+
className: "fwe-radio-checkmark"
|
|
50
|
+
}),
|
|
51
|
+
' '
|
|
52
|
+
]
|
|
53
|
+
}),
|
|
54
|
+
/*#__PURE__*/ jsx("div", {
|
|
55
|
+
className: "fwe-radio-label-content",
|
|
56
|
+
children: children
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export { RadioButton };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export interface RadioGroupProps extends ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
readonly name?: string;
|
|
4
|
+
readonly defaultValue?: string;
|
|
5
|
+
readonly onValueChange?: (value: string) => void;
|
|
6
|
+
readonly value?: string;
|
|
7
|
+
readonly labelPosition?: 'before' | 'after' | 'below';
|
|
8
|
+
readonly large?: boolean;
|
|
9
|
+
readonly disabled?: boolean;
|
|
10
|
+
readonly required?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const RadioGroup: (props: RadioGroupProps & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
import { forwardRef, useCallback, useMemo } from "react";
|
|
4
|
+
import { useControlled } from "../../utils/useControlled.js";
|
|
5
|
+
import { useId } from "../../utils/useId.js";
|
|
6
|
+
import { RadioGroupContext } from "./RadioGroupContext.js";
|
|
7
|
+
const RadioGroup = /*#__PURE__*/ forwardRef(({ children, className, onValueChange, value: controlledValue, defaultValue, name, labelPosition, large, disabled, required, ...props }, ref)=>{
|
|
8
|
+
const contextName = useId(name);
|
|
9
|
+
const [value, setValue] = useControlled({
|
|
10
|
+
controlled: controlledValue,
|
|
11
|
+
default: defaultValue
|
|
12
|
+
});
|
|
13
|
+
const handleValueChange = useCallback((newValue)=>{
|
|
14
|
+
onValueChange?.(newValue);
|
|
15
|
+
setValue(newValue);
|
|
16
|
+
}, [
|
|
17
|
+
onValueChange,
|
|
18
|
+
setValue
|
|
19
|
+
]);
|
|
20
|
+
const contextValue = useMemo(()=>({
|
|
21
|
+
labelPosition,
|
|
22
|
+
large,
|
|
23
|
+
disabled,
|
|
24
|
+
required,
|
|
25
|
+
handleValueChange,
|
|
26
|
+
value,
|
|
27
|
+
isControlled: void 0 !== controlledValue,
|
|
28
|
+
name: contextName
|
|
29
|
+
}), [
|
|
30
|
+
controlledValue,
|
|
31
|
+
handleValueChange,
|
|
32
|
+
labelPosition,
|
|
33
|
+
large,
|
|
34
|
+
disabled,
|
|
35
|
+
required,
|
|
36
|
+
value,
|
|
37
|
+
contextName
|
|
38
|
+
]);
|
|
39
|
+
return /*#__PURE__*/ jsx(RadioGroupContext.Provider, {
|
|
40
|
+
value: contextValue,
|
|
41
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
42
|
+
ref: ref,
|
|
43
|
+
className: classnames('fwe-radio-group', className),
|
|
44
|
+
role: "radiogroup",
|
|
45
|
+
...props,
|
|
46
|
+
children: children
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
export { RadioGroup };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface ContextProps {
|
|
2
|
+
name: string;
|
|
3
|
+
value: string;
|
|
4
|
+
isControlled: boolean;
|
|
5
|
+
labelPosition: 'before' | 'after' | 'below';
|
|
6
|
+
large: boolean;
|
|
7
|
+
handleValueChange: (value: string) => void;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
required: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const RadioGroupContext: import("react").Context<Partial<ContextProps>>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ClassNamePropsWithChildren } from '../../utils/types';
|
|
3
|
+
export interface SegmentConfiguration {
|
|
4
|
+
readonly outline?: boolean;
|
|
5
|
+
readonly iconOnly?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface SegmentProps extends ClassNamePropsWithChildren {
|
|
8
|
+
readonly legend: string;
|
|
9
|
+
readonly config?: SegmentConfiguration;
|
|
10
|
+
readonly onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: any) => void;
|
|
11
|
+
readonly value?: any;
|
|
12
|
+
}
|
|
13
|
+
export declare function Segment(props: SegmentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
import react from "react";
|
|
4
|
+
import { useControlled } from "../../utils/useControlled.js";
|
|
5
|
+
const defaultConfig = {
|
|
6
|
+
outline: true,
|
|
7
|
+
iconOnly: true
|
|
8
|
+
};
|
|
9
|
+
function Segment(props) {
|
|
10
|
+
const { children, legend, config, onChange, className, value: valueProps } = props;
|
|
11
|
+
const innerConfig = {
|
|
12
|
+
...defaultConfig,
|
|
13
|
+
...config
|
|
14
|
+
};
|
|
15
|
+
let useIcon = false;
|
|
16
|
+
let useIconAndText = false;
|
|
17
|
+
let tmpValue = '';
|
|
18
|
+
react.Children.forEach(children, (child, index)=>{
|
|
19
|
+
if (!/*#__PURE__*/ react.isValidElement(child)) return null;
|
|
20
|
+
if (0 === index && null !== child.props.icon) if (innerConfig.iconOnly) useIcon = true;
|
|
21
|
+
else useIconAndText = true;
|
|
22
|
+
if (child.props.checked) tmpValue = child.props.value;
|
|
23
|
+
return null;
|
|
24
|
+
});
|
|
25
|
+
const [value, setValue] = useControlled({
|
|
26
|
+
controlled: valueProps,
|
|
27
|
+
default: tmpValue
|
|
28
|
+
});
|
|
29
|
+
const handleChange = (event, _value)=>{
|
|
30
|
+
if (onChange) onChange(event, _value);
|
|
31
|
+
setValue(_value);
|
|
32
|
+
};
|
|
33
|
+
return /*#__PURE__*/ jsxs("fieldset", {
|
|
34
|
+
className: classnames('fwe-segment', {
|
|
35
|
+
'fwe-segment-outline': innerConfig.outline,
|
|
36
|
+
'fwe-segment-icon': useIcon,
|
|
37
|
+
'fwe-segment-icon-text': useIconAndText
|
|
38
|
+
}, className),
|
|
39
|
+
children: [
|
|
40
|
+
/*#__PURE__*/ jsx("legend", {
|
|
41
|
+
className: "fwe-sr-only fwe-d-inline-block",
|
|
42
|
+
children: legend
|
|
43
|
+
}),
|
|
44
|
+
/*#__PURE__*/ jsx("div", {
|
|
45
|
+
className: "fwe-segment-group",
|
|
46
|
+
children: react.Children.map(children, (child)=>{
|
|
47
|
+
if (!/*#__PURE__*/ react.isValidElement(child)) return null;
|
|
48
|
+
return /*#__PURE__*/ react.cloneElement(child, {
|
|
49
|
+
...child.props,
|
|
50
|
+
onChange: handleChange,
|
|
51
|
+
iconOnly: innerConfig.iconOnly,
|
|
52
|
+
checked: child.props.value === value
|
|
53
|
+
});
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
export { Segment };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { ClassNameProps } from '../../../utils/types';
|
|
3
|
+
export interface SegmentControlProps extends ClassNameProps {
|
|
4
|
+
readonly label: string;
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly value: any;
|
|
7
|
+
readonly checked?: boolean;
|
|
8
|
+
readonly disabled?: boolean;
|
|
9
|
+
readonly icon?: React.ReactNode;
|
|
10
|
+
readonly onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: any) => void;
|
|
11
|
+
readonly id?: string;
|
|
12
|
+
readonly iconOnly?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function SegmentControl(props: SegmentControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
import { useRef } from "react";
|
|
4
|
+
import { IconWrapper } from "../../../components/icon-wrapper/IconWrapper.js";
|
|
5
|
+
function SegmentControl(props) {
|
|
6
|
+
const { label, checked, disabled, name, value, icon, onChange, id, className, iconOnly } = props;
|
|
7
|
+
const componentId = useRef(id ?? (Math.random() * Date.now()).toString().replace('.', '-'));
|
|
8
|
+
let viewMode = 'text';
|
|
9
|
+
if (icon) viewMode = iconOnly ? 'icon' : 'icon-text';
|
|
10
|
+
const handleChange = (event)=>{
|
|
11
|
+
if (onChange) onChange(event, value);
|
|
12
|
+
};
|
|
13
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
14
|
+
children: [
|
|
15
|
+
/*#__PURE__*/ jsx("input", {
|
|
16
|
+
className: "fwe-segment-input",
|
|
17
|
+
type: "radio",
|
|
18
|
+
id: componentId.current,
|
|
19
|
+
name: name,
|
|
20
|
+
value: value,
|
|
21
|
+
checked: checked,
|
|
22
|
+
disabled: disabled,
|
|
23
|
+
onChange: (e)=>handleChange(e)
|
|
24
|
+
}),
|
|
25
|
+
/*#__PURE__*/ jsxs("label", {
|
|
26
|
+
className: classnames('fwe-segment-label', className),
|
|
27
|
+
htmlFor: componentId.current,
|
|
28
|
+
children: [
|
|
29
|
+
'icon' === viewMode && /*#__PURE__*/ jsxs(Fragment, {
|
|
30
|
+
children: [
|
|
31
|
+
/*#__PURE__*/ jsx("span", {
|
|
32
|
+
className: "fwe-sr-only",
|
|
33
|
+
children: label
|
|
34
|
+
}),
|
|
35
|
+
/*#__PURE__*/ jsx(IconWrapper, {
|
|
36
|
+
icon: icon
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
}),
|
|
40
|
+
'text' === viewMode && label,
|
|
41
|
+
'icon-text' === viewMode && /*#__PURE__*/ jsxs(Fragment, {
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ jsx(IconWrapper, {
|
|
44
|
+
icon: icon
|
|
45
|
+
}),
|
|
46
|
+
/*#__PURE__*/ jsx("span", {
|
|
47
|
+
className: "fwe-ml-xxs",
|
|
48
|
+
children: label
|
|
49
|
+
})
|
|
50
|
+
]
|
|
51
|
+
})
|
|
52
|
+
]
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
export { SegmentControl };
|
|
@@ -0,0 +1,160 @@
|
|
|
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
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import './Select.scss';
|
|
2
|
+
import { type ComponentPropsWithoutRef, type Ref } from 'react';
|
|
3
|
+
import type { SelectConfiguration } from '../../utils/types';
|
|
4
|
+
import type { SelectOptionType } from './select-option/SelectOption';
|
|
5
|
+
export interface SelectProps<T> extends Omit<ComponentPropsWithoutRef<'div'>, 'onChange' | 'defaultValue'> {
|
|
6
|
+
readonly defaultValue?: T;
|
|
7
|
+
readonly defaultOpen?: boolean;
|
|
8
|
+
readonly open?: boolean;
|
|
9
|
+
readonly value?: T;
|
|
10
|
+
readonly label?: string;
|
|
11
|
+
readonly options?: SelectOptionType<T>[];
|
|
12
|
+
readonly required?: boolean;
|
|
13
|
+
readonly onChange?: (value: T) => void;
|
|
14
|
+
readonly config?: SelectConfiguration;
|
|
15
|
+
readonly disabled?: boolean;
|
|
16
|
+
readonly name?: string;
|
|
17
|
+
readonly hint?: string;
|
|
18
|
+
readonly error?: string;
|
|
19
|
+
readonly onOpenChange?: (value: boolean) => void;
|
|
20
|
+
readonly renderLabelContent?: (label?: string | string[]) => JSX.Element;
|
|
21
|
+
}
|
|
22
|
+
declare function SelectComponent<T>({ defaultValue, open, defaultOpen, value: controlled, label, options, onChange, required, config, disabled, name, id, children, hint, error, onOpenChange, renderLabelContent, ...props }: SelectProps<T>, ref: Ref<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare const Select: <T>(props: SelectProps<T> & {
|
|
24
|
+
ref?: Ref<HTMLDivElement>;
|
|
25
|
+
}) => ReturnType<typeof SelectComponent>;
|
|
26
|
+
export {};
|