@festo-ui/react 9.0.0-dev.715 → 9.0.0-dev.716
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/package.json +1 -1
- package/dist/components/accordion/Accordion.css +0 -4
- package/dist/components/accordion/Accordion.d.ts +0 -10
- package/dist/components/accordion/Accordion.js +0 -41
- package/dist/components/accordion/AccordionContext.d.ts +0 -11
- package/dist/components/accordion/AccordionContext.js +0 -3
- package/dist/components/accordion/accordion-header/AccordionHeader.css +0 -11
- package/dist/components/accordion/accordion-header/AccordionHeader.d.ts +0 -2
- package/dist/components/accordion/accordion-header/AccordionHeader.js +0 -11
- package/dist/components/accordion/accordion-item/AccordionItem.css +0 -64
- package/dist/components/accordion/accordion-item/AccordionItem.d.ts +0 -8
- package/dist/components/accordion/accordion-item/AccordionItem.js +0 -60
- package/dist/components/accordion/accordion-item/AccordionItemContext.d.ts +0 -7
- package/dist/components/accordion/accordion-item/AccordionItemContext.js +0 -3
- package/dist/components/accordion/accordion-item/accordion-item-body/AccordionItemBody.css +0 -76
- package/dist/components/accordion/accordion-item/accordion-item-body/AccordionItemBody.d.ts +0 -2
- package/dist/components/accordion/accordion-item/accordion-item-body/AccordionItemBody.js +0 -61
- package/dist/components/accordion/accordion-item/accordion-item-header/AccordionItemHeader.css +0 -11
- package/dist/components/accordion/accordion-item/accordion-item-header/AccordionItemHeader.d.ts +0 -2
- package/dist/components/accordion/accordion-item/accordion-item-header/AccordionItemHeader.js +0 -20
- package/dist/components/bottom-sheet/BottomSheet.css +0 -18
- package/dist/components/bottom-sheet/BottomSheet.d.ts +0 -12
- package/dist/components/bottom-sheet/BottomSheet.js +0 -101
- package/dist/components/breadcrumb/Breadcrumb.d.ts +0 -13
- package/dist/components/breadcrumb/Breadcrumb.js +0 -32
- package/dist/components/button/Button.d.ts +0 -11
- package/dist/components/button/Button.js +0 -36
- package/dist/components/card/Card.d.ts +0 -4
- package/dist/components/card/Card.js +0 -9
- package/dist/components/card/CardBody.d.ts +0 -5
- package/dist/components/card/CardBody.js +0 -15
- package/dist/components/card/CardHeader.d.ts +0 -8
- package/dist/components/card/CardHeader.js +0 -31
- package/dist/components/card/CardHeader.stories.helper.js +0 -7
- package/dist/components/card/CardNotification.d.ts +0 -6
- package/dist/components/card/CardNotification.js +0 -26
- package/dist/components/chips/chip/Chip.d.ts +0 -17
- package/dist/components/chips/chip/Chip.js +0 -38
- package/dist/components/chips/chip-container/ChipContainer.d.ts +0 -5
- package/dist/components/chips/chip-container/ChipContainer.js +0 -12
- package/dist/components/icon-wrapper/IconWrapper.d.ts +0 -3
- package/dist/components/icon-wrapper/IconWrapper.js +0 -13
- package/dist/components/link-button/LinkButton.d.ts +0 -8
- package/dist/components/link-button/LinkButton.js +0 -26
- package/dist/components/loading-indicator/LoadingIndicator.d.ts +0 -5
- package/dist/components/loading-indicator/LoadingIndicator.js +0 -41
- package/dist/components/mobile-flyout/MobileFlyout.d.ts +0 -11
- package/dist/components/mobile-flyout/MobileFlyout.js +0 -88
- package/dist/components/mobile-flyout/MobileFlyoutContext.d.ts +0 -8
- package/dist/components/mobile-flyout/MobileFlyoutContext.js +0 -3
- package/dist/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.d.ts +0 -17
- package/dist/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.js +0 -36
- package/dist/components/mobile-flyout/mobile-flyout-page/MobileFlyoutPage.css +0 -5
- package/dist/components/mobile-flyout/mobile-flyout-page/MobileFlyoutPage.d.ts +0 -8
- package/dist/components/mobile-flyout/mobile-flyout-page/MobileFlyoutPage.js +0 -35
- package/dist/components/modals/AlertModal.d.ts +0 -12
- package/dist/components/modals/AlertModal.js +0 -53
- package/dist/components/modals/ConfirmModal.d.ts +0 -11
- package/dist/components/modals/ConfirmModal.js +0 -46
- package/dist/components/modals/CustomModal.d.ts +0 -8
- package/dist/components/modals/CustomModal.js +0 -38
- package/dist/components/modals/Modal.css +0 -39
- package/dist/components/modals/Modal.d.ts +0 -8
- package/dist/components/modals/Modal.js +0 -31
- package/dist/components/modals/ModalBase.d.ts +0 -9
- package/dist/components/modals/ModalBase.js +0 -124
- package/dist/components/modals/ModalFooter.d.ts +0 -2
- package/dist/components/modals/ModalFooter.js +0 -12
- package/dist/components/modals/Prompt.d.ts +0 -15
- package/dist/components/modals/Prompt.js +0 -58
- package/dist/components/modals/image-gallery/ImageGallery.css +0 -790
- package/dist/components/modals/image-gallery/ImageGallery.d.ts +0 -18
- package/dist/components/modals/image-gallery/ImageGallery.helper.d.ts +0 -2
- package/dist/components/modals/image-gallery/ImageGallery.helper.js +0 -13
- package/dist/components/modals/image-gallery/ImageGallery.js +0 -75
- package/dist/components/modals/image-gallery/ImageGallery.stories.helper.js +0 -112
- package/dist/components/modals/image-gallery/ImageGalleryContent.d.ts +0 -9
- package/dist/components/modals/image-gallery/ImageGalleryContent.js +0 -15
- package/dist/components/modals/image-gallery/ImageGalleryContext.d.ts +0 -10
- package/dist/components/modals/image-gallery/ImageGalleryContext.js +0 -4
- package/dist/components/modals/image-gallery/ImageGallerySwiper.d.ts +0 -8
- package/dist/components/modals/image-gallery/ImageGallerySwiper.js +0 -29
- package/dist/components/modals/image-gallery/ImageGalleryThumbsSwiper.d.ts +0 -5
- package/dist/components/modals/image-gallery/ImageGalleryThumbsSwiper.js +0 -23
- package/dist/components/modals/image-gallery/image-gallery-item/ImageGalleryItem.css +0 -10
- package/dist/components/modals/image-gallery/image-gallery-item/ImageGalleryItem.d.ts +0 -11
- package/dist/components/modals/image-gallery/image-gallery-item/ImageGalleryItem.js +0 -24
- package/dist/components/modals/image-gallery/internal/BaseGallery.d.ts +0 -17
- package/dist/components/modals/image-gallery/internal/BaseGallery.js +0 -50
- package/dist/components/modals/image-gallery/internal/CloseButton.d.ts +0 -6
- package/dist/components/modals/image-gallery/internal/CloseButton.js +0 -14
- package/dist/components/modals/image-gallery/internal/ImageGalleryContainer.d.ts +0 -5
- package/dist/components/modals/image-gallery/internal/ImageGalleryContainer.js +0 -8
- package/dist/components/modals/image-gallery/internal/ImageGalleryPagination.d.ts +0 -5
- package/dist/components/modals/image-gallery/internal/ImageGalleryPagination.js +0 -29
- package/dist/components/modals/image-gallery/internal/ScaleButton.d.ts +0 -4
- package/dist/components/modals/image-gallery/internal/ScaleButton.js +0 -17
- package/dist/components/pagination/Pagination.css +0 -10
- package/dist/components/pagination/Pagination.d.ts +0 -15
- package/dist/components/pagination/Pagination.js +0 -100
- package/dist/components/popovers/legend/Legend.css +0 -21
- package/dist/components/popovers/legend/Legend.d.ts +0 -11
- package/dist/components/popovers/legend/Legend.js +0 -24
- package/dist/components/popovers/popover/Popover.css +0 -56
- package/dist/components/popovers/popover/Popover.d.ts +0 -20
- package/dist/components/popovers/popover/Popover.js +0 -107
- package/dist/components/popovers/popover-menu/PopoverMenu.css +0 -20
- package/dist/components/popovers/popover-menu/PopoverMenu.d.ts +0 -8
- package/dist/components/popovers/popover-menu/PopoverMenu.js +0 -37
- package/dist/components/popovers/popover-menu/PopoverMenuContext.d.ts +0 -3
- package/dist/components/popovers/popover-menu/PopoverMenuContext.js +0 -5
- package/dist/components/popovers/popover-menu-item/PopoverMenuItem.css +0 -35
- package/dist/components/popovers/popover-menu-item/PopoverMenuItem.d.ts +0 -10
- package/dist/components/popovers/popover-menu-item/PopoverMenuItem.js +0 -30
- package/dist/components/popovers/tooltip/Tooltip.d.ts +0 -5
- package/dist/components/popovers/tooltip/Tooltip.js +0 -12
- package/dist/components/progress/Progress.d.ts +0 -7
- package/dist/components/progress/Progress.js +0 -26
- package/dist/components/scroll-area/ScrollArea.d.ts +0 -4
- package/dist/components/scroll-area/ScrollArea.js +0 -10
- package/dist/components/scroll-area/ScrollArea.stories.css +0 -9
- package/dist/components/search-input/ClearButton.d.ts +0 -2
- package/dist/components/search-input/ClearButton.js +0 -10
- package/dist/components/search-input/SearchInput.css +0 -13
- package/dist/components/search-input/SearchInput.d.ts +0 -14
- package/dist/components/search-input/SearchInput.js +0 -61
- package/dist/components/search-input/SearchSuggestion.d.ts +0 -17
- package/dist/components/search-input/SearchSuggestion.js +0 -21
- package/dist/components/search-input/useSearchInput.d.ts +0 -13
- package/dist/components/search-input/useSearchInput.js +0 -85
- package/dist/components/snackbar/Snackbar.css +0 -55
- package/dist/components/snackbar/Snackbar.d.ts +0 -21
- package/dist/components/snackbar/Snackbar.js +0 -78
- package/dist/components/snackbar/SnackbarContext.d.ts +0 -7
- package/dist/components/snackbar/SnackbarContext.js +0 -3
- package/dist/components/snackbar/SnackbarProvider.d.ts +0 -8
- package/dist/components/snackbar/SnackbarProvider.js +0 -66
- package/dist/components/snackbar/useSnackbar.d.ts +0 -2
- package/dist/components/snackbar/useSnackbar.js +0 -4
- package/dist/components/stepper-horizontal/StepperHorizontal.css +0 -6
- package/dist/components/stepper-horizontal/StepperHorizontal.d.ts +0 -7
- package/dist/components/stepper-horizontal/StepperHorizontal.js +0 -48
- package/dist/components/stepper-horizontal/step-horizontal/StepHorizontal.css +0 -24
- package/dist/components/stepper-horizontal/step-horizontal/StepHorizontal.d.ts +0 -6
- package/dist/components/stepper-horizontal/step-horizontal/StepHorizontal.js +0 -16
- package/dist/components/stepper-vertical/StepperVertical.d.ts +0 -6
- package/dist/components/stepper-vertical/StepperVertical.js +0 -26
- package/dist/components/stepper-vertical/step-vertical/StepVertical.css +0 -10
- package/dist/components/stepper-vertical/step-vertical/StepVertical.d.ts +0 -11
- package/dist/components/stepper-vertical/step-vertical/StepVertical.js +0 -58
- package/dist/components/tab/Tabs.css +0 -285
- package/dist/components/tab/Tabs.d.ts +0 -23
- package/dist/components/tab/Tabs.js +0 -194
- package/dist/components/tab/interfaces.d.ts +0 -5
- package/dist/components/tab/interfaces.js +0 -0
- package/dist/components/tab/tab-pane/TabPane.css +0 -8
- package/dist/components/tab/tab-pane/TabPane.d.ts +0 -9
- package/dist/components/tab/tab-pane/TabPane.js +0 -18
- package/dist/components/tab/useTabScroll.d.ts +0 -25
- package/dist/components/tab/useTabScroll.js +0 -151
- package/dist/components/table-header-cell/TableHeaderCell.d.ts +0 -5
- package/dist/components/table-header-cell/TableHeaderCell.js +0 -21
- package/dist/forms/checkbox/Checkbox.css +0 -134
- package/dist/forms/checkbox/Checkbox.d.ts +0 -15
- package/dist/forms/checkbox/Checkbox.js +0 -80
- package/dist/forms/radio/RadioButton.d.ts +0 -14
- package/dist/forms/radio/RadioButton.js +0 -61
- package/dist/forms/radio/RadioGroup.d.ts +0 -12
- package/dist/forms/radio/RadioGroup.js +0 -50
- package/dist/forms/radio/RadioGroupContext.d.ts +0 -12
- package/dist/forms/radio/RadioGroupContext.js +0 -3
- package/dist/forms/segment/Segment.d.ts +0 -13
- package/dist/forms/segment/Segment.js +0 -59
- package/dist/forms/segment/segment-control/SegmentControl.d.ts +0 -14
- package/dist/forms/segment/segment-control/SegmentControl.js +0 -57
- package/dist/forms/select/Select.css +0 -160
- package/dist/forms/select/Select.d.ts +0 -26
- package/dist/forms/select/Select.js +0 -95
- 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/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/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/SelectOptionsContainer.d.ts +0 -17
- package/dist/forms/select/internal/SelectOptionsContainer.js +0 -103
- 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
- package/dist/forms/slider/Slider.css +0 -50
- package/dist/forms/slider/Slider.d.ts +0 -17
- package/dist/forms/slider/Slider.js +0 -93
- package/dist/forms/switch/Switch.d.ts +0 -12
- package/dist/forms/switch/Switch.js +0 -42
- package/dist/forms/text-area/TextArea.css +0 -14
- package/dist/forms/text-area/TextArea.d.ts +0 -22
- package/dist/forms/text-area/TextArea.js +0 -99
- package/dist/forms/text-input/TextInput.d.ts +0 -24
- package/dist/forms/text-input/TextInput.js +0 -74
- package/dist/forms/time-picker/TimePicker.css +0 -10
- package/dist/forms/time-picker/TimePicker.d.ts +0 -24
- package/dist/forms/time-picker/TimePicker.js +0 -140
- package/dist/forms/time-picker/time-picker-dropdown/TimePickerDropdown.css +0 -4
- package/dist/forms/time-picker/time-picker-dropdown/TimePickerDropdown.d.ts +0 -19
- package/dist/forms/time-picker/time-picker-dropdown/TimePickerDropdown.js +0 -202
- package/dist/forms/time-picker/time-picker-dropdown/TimePickerInput.d.ts +0 -9
- package/dist/forms/time-picker/time-picker-dropdown/TimePickerInput.js +0 -14
- package/dist/index.d.ts +0 -63
- package/dist/index.js +0 -60
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +0 -7
- package/dist/utils/setRef.d.ts +0 -1
- package/dist/utils/setRef.js +0 -5
- package/dist/utils/types.d.ts +0 -29
- package/dist/utils/types.js +0 -0
- package/dist/utils/useControlled.d.ts +0 -7
- package/dist/utils/useControlled.js +0 -20
- package/dist/utils/useForkRef.d.ts +0 -2
- package/dist/utils/useForkRef.js +0 -15
- package/dist/utils/useId.d.ts +0 -1
- package/dist/utils/useId.js +0 -20
- package/dist/utils/useOnClickOutside.d.ts +0 -2
- package/dist/utils/useOnClickOutside.js +0 -20
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
const useTabScroll = (tabLength, componentId, refs)=>{
|
|
3
|
-
const { elRef, scrollContent, scrollArea } = refs;
|
|
4
|
-
const [style, setStyle] = useState({});
|
|
5
|
-
const [classes, setClasses] = useState('');
|
|
6
|
-
function getScrollContentStyleValue(propName) {
|
|
7
|
-
return scrollContent.current ? window.getComputedStyle(scrollContent.current).getPropertyValue(propName) : '';
|
|
8
|
-
}
|
|
9
|
-
function calculateCurrentTranslateX() {
|
|
10
|
-
const transformValue = getScrollContentStyleValue('transform');
|
|
11
|
-
if ('none' === transformValue) return 0;
|
|
12
|
-
const match = /\((.+?)\)/.exec(transformValue);
|
|
13
|
-
if (!match) return 0;
|
|
14
|
-
const matrixParams = match[1];
|
|
15
|
-
const [_a, _b, _c, _d, tx, _ty] = matrixParams.split(',');
|
|
16
|
-
return parseFloat(tx);
|
|
17
|
-
}
|
|
18
|
-
function getScrollPosition() {
|
|
19
|
-
const currentTranslateX = calculateCurrentTranslateX();
|
|
20
|
-
const scrollLeft = scrollArea.current?.scrollLeft ?? 0;
|
|
21
|
-
return scrollLeft - currentTranslateX;
|
|
22
|
-
}
|
|
23
|
-
function calculateScrollEdges() {
|
|
24
|
-
const scrollContentWidth = scrollContent.current?.offsetWidth ?? 0;
|
|
25
|
-
const scrollAreaWidth = scrollArea.current?.offsetWidth ?? 0;
|
|
26
|
-
return {
|
|
27
|
-
left: 0,
|
|
28
|
-
right: scrollContentWidth - scrollAreaWidth
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function clampScrollValue(scrollX) {
|
|
32
|
-
const edges = calculateScrollEdges();
|
|
33
|
-
return Math.min(Math.max(edges.left, scrollX), edges.right);
|
|
34
|
-
}
|
|
35
|
-
function getIncrementScrollOperation(scrollX) {
|
|
36
|
-
const currentScrollX = getScrollPosition();
|
|
37
|
-
const targetScrollX = scrollX + currentScrollX;
|
|
38
|
-
const safeScrollX = clampScrollValue(targetScrollX);
|
|
39
|
-
const scrollDelta = safeScrollX - currentScrollX;
|
|
40
|
-
return {
|
|
41
|
-
finalScrollPosition: safeScrollX,
|
|
42
|
-
scrollDelta
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function getAnimatingScrollPosition() {
|
|
46
|
-
const currentTranslateX = calculateCurrentTranslateX();
|
|
47
|
-
const scrollLeft = scrollArea.current?.scrollLeft ?? 0;
|
|
48
|
-
return scrollLeft - currentTranslateX;
|
|
49
|
-
}
|
|
50
|
-
function stopScrollAnimation() {
|
|
51
|
-
const currentScrollPosition = getAnimatingScrollPosition();
|
|
52
|
-
setClasses('');
|
|
53
|
-
setStyle({
|
|
54
|
-
transform: 'translateX(0px)'
|
|
55
|
-
});
|
|
56
|
-
if (scrollArea.current) scrollArea.current.scrollLeft = currentScrollPosition;
|
|
57
|
-
}
|
|
58
|
-
function animate(animation) {
|
|
59
|
-
if (0 === animation.scrollDelta) return;
|
|
60
|
-
stopScrollAnimation();
|
|
61
|
-
if (scrollArea.current) scrollArea.current.scrollLeft = animation.finalScrollPosition;
|
|
62
|
-
setStyle({
|
|
63
|
-
transform: `translateX(${animation.scrollDelta}px)`
|
|
64
|
-
});
|
|
65
|
-
if (scrollArea.current) scrollArea.current.getBoundingClientRect();
|
|
66
|
-
requestAnimationFrame(()=>{
|
|
67
|
-
setClasses('fr-tab-scroller--animating');
|
|
68
|
-
setStyle({
|
|
69
|
-
transform: 'none'
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
function incrementScroll(scrollXIncrement) {
|
|
74
|
-
if (0 === scrollXIncrement) return;
|
|
75
|
-
const scrollOperation = getIncrementScrollOperation(scrollXIncrement);
|
|
76
|
-
animate(scrollOperation);
|
|
77
|
-
}
|
|
78
|
-
function computeDimensions(tab) {
|
|
79
|
-
const rootWidth = tab.offsetWidth;
|
|
80
|
-
const rootLeft = tab.offsetLeft;
|
|
81
|
-
const tabContent = tab.querySelector('.fr-tab-content');
|
|
82
|
-
const contentWidth = tabContent?.offsetWidth ?? 0;
|
|
83
|
-
const contentLeft = tabContent?.offsetLeft ?? 0;
|
|
84
|
-
return {
|
|
85
|
-
contentLeft: rootLeft + contentLeft,
|
|
86
|
-
contentRight: rootLeft + contentLeft + contentWidth,
|
|
87
|
-
rootLeft,
|
|
88
|
-
rootRight: rootLeft + rootWidth
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
function calculateScrollIncrement(index, nextIndex, scrollPosition, barWidth) {
|
|
92
|
-
const nextTab = elRef.current?.querySelector(`#${componentId}-tab-${nextIndex}`);
|
|
93
|
-
if (null == nextTab) return 0;
|
|
94
|
-
const nextTabDimensions = computeDimensions(nextTab);
|
|
95
|
-
const relativeContentLeft = nextTabDimensions.contentLeft - scrollPosition - barWidth;
|
|
96
|
-
const relativeContentRight = nextTabDimensions.contentRight - scrollPosition;
|
|
97
|
-
const leftIncrement = relativeContentRight - 48;
|
|
98
|
-
const rightIncrement = relativeContentLeft + 48;
|
|
99
|
-
if (nextIndex < index) return Math.min(leftIncrement, 0);
|
|
100
|
-
return Math.max(rightIncrement, 0);
|
|
101
|
-
}
|
|
102
|
-
function findAdjacentTabIndexClosestToEdge(index, tabDimensions, scrollPosition, barWidth) {
|
|
103
|
-
const relativeRootLeft = tabDimensions.rootLeft - scrollPosition;
|
|
104
|
-
const relativeRootRight = tabDimensions.rootRight - scrollPosition - barWidth;
|
|
105
|
-
const relativeRootDelta = relativeRootLeft + relativeRootRight;
|
|
106
|
-
const leftEdgeIsCloser = relativeRootLeft < 0 || relativeRootDelta < 0;
|
|
107
|
-
const rightEdgeIsCloser = relativeRootRight > 0 || relativeRootDelta > 0;
|
|
108
|
-
if (leftEdgeIsCloser) return index - 1;
|
|
109
|
-
if (rightEdgeIsCloser) return index + 1;
|
|
110
|
-
return -1;
|
|
111
|
-
}
|
|
112
|
-
function indexIsInRange(index) {
|
|
113
|
-
return index >= 0 && index < tabLength;
|
|
114
|
-
}
|
|
115
|
-
function scrollIntoView(index, tab) {
|
|
116
|
-
const scrollPosition = getScrollPosition();
|
|
117
|
-
const barWidth = scrollArea.current?.offsetWidth ?? 0;
|
|
118
|
-
const tabDimensions = computeDimensions(tab);
|
|
119
|
-
const nextIndex = findAdjacentTabIndexClosestToEdge(index, tabDimensions, scrollPosition, barWidth);
|
|
120
|
-
if (!indexIsInRange(nextIndex)) return;
|
|
121
|
-
const scrollIncrement = calculateScrollIncrement(index, nextIndex, scrollPosition, barWidth);
|
|
122
|
-
incrementScroll(scrollIncrement);
|
|
123
|
-
}
|
|
124
|
-
function scrollTo(scrollX) {
|
|
125
|
-
const currentScrollX = getScrollPosition();
|
|
126
|
-
const safeScrollX = clampScrollValue(scrollX);
|
|
127
|
-
const scrollDelta = safeScrollX - currentScrollX;
|
|
128
|
-
animate({
|
|
129
|
-
finalScrollPosition: safeScrollX,
|
|
130
|
-
scrollDelta
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
function handleTabScroll(e, index) {
|
|
134
|
-
const scrollContentWidth = scrollContent.current?.offsetWidth ?? 0;
|
|
135
|
-
const scrollAreaWidth = scrollArea.current?.offsetWidth ?? 0;
|
|
136
|
-
if (scrollAreaWidth > scrollContentWidth) return;
|
|
137
|
-
if (!indexIsInRange(index)) return;
|
|
138
|
-
if (0 === index) return void scrollTo(0);
|
|
139
|
-
if (index === tabLength - 1 && scrollContent.current) return void scrollTo(scrollContent.current.offsetWidth);
|
|
140
|
-
if (e.currentTarget instanceof HTMLElement) {
|
|
141
|
-
const currentTab = e.currentTarget;
|
|
142
|
-
scrollIntoView(index, currentTab);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return [
|
|
146
|
-
handleTabScroll,
|
|
147
|
-
classes,
|
|
148
|
-
style
|
|
149
|
-
];
|
|
150
|
-
};
|
|
151
|
-
export { useTabScroll };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export interface TableHeaderCellProps extends React.ThHTMLAttributes<HTMLTableCellElement> {
|
|
2
|
-
active?: boolean;
|
|
3
|
-
ascending: boolean;
|
|
4
|
-
}
|
|
5
|
-
export declare const TableHeaderCell: (props: TableHeaderCellProps & import("react").RefAttributes<HTMLTableCellElement>) => React.ReactElement | null;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import classnames from "classnames";
|
|
3
|
-
import { forwardRef } from "react";
|
|
4
|
-
const TableHeaderCell = /*#__PURE__*/ forwardRef(({ active, ascending, className, ...props }, ref)=>{
|
|
5
|
-
function handleClick(event) {
|
|
6
|
-
if (props.onClick) props.onClick(event);
|
|
7
|
-
}
|
|
8
|
-
return /*#__PURE__*/ jsx("th", {
|
|
9
|
-
...props,
|
|
10
|
-
className: classnames('fwe-table-order', {
|
|
11
|
-
'fwe-active': active
|
|
12
|
-
}, {
|
|
13
|
-
'fwe-table-order-ascending': active && ascending
|
|
14
|
-
}, {
|
|
15
|
-
'fwe-table-order-descending': active && !ascending
|
|
16
|
-
}, className),
|
|
17
|
-
onClick: handleClick,
|
|
18
|
-
ref: ref
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
export { TableHeaderCell };
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
.fwe-checkbox-container {
|
|
2
|
-
font-family: var(--fwe-font-family-sans-serif);
|
|
3
|
-
user-select: none;
|
|
4
|
-
cursor: pointer;
|
|
5
|
-
flex-direction: row;
|
|
6
|
-
align-items: center;
|
|
7
|
-
display: flex;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.fwe-checkbox-container.fwe-label-below {
|
|
11
|
-
flex-direction: column;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.fwe-checkbox-container.fwe-label-below .fwe-checkbox-title {
|
|
15
|
-
margin: 8px 0 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.fwe-checkbox-container.fwe-label-before {
|
|
19
|
-
flex-direction: row-reverse;
|
|
20
|
-
justify-content: flex-end;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.fwe-checkbox-container.fwe-label-before .fwe-checkbox-title {
|
|
24
|
-
margin: 0 8px 0 0;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.fwe-checkbox-container .fwe-checkbox-indicator-container {
|
|
28
|
-
position: relative;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.fwe-checkbox-container input {
|
|
32
|
-
opacity: 0;
|
|
33
|
-
cursor: pointer;
|
|
34
|
-
width: 0;
|
|
35
|
-
height: 0;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.fwe-checkbox-container .fwe-checkbox-title {
|
|
39
|
-
color: var(--fwe-text);
|
|
40
|
-
user-select: none;
|
|
41
|
-
margin-left: 8px;
|
|
42
|
-
line-height: 24px;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.fwe-checkbox-container .fwe-checkbox-indicator-background {
|
|
46
|
-
box-sizing: border-box;
|
|
47
|
-
background: var(--fwe-white);
|
|
48
|
-
border: 1px solid var(--fwe-text-light);
|
|
49
|
-
border-radius: 2px;
|
|
50
|
-
width: 16px;
|
|
51
|
-
height: 16px;
|
|
52
|
-
transition: border-width .2s ease-out;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.fwe-checkbox-container .fwe-indeterminate-indicator {
|
|
56
|
-
background: #fff;
|
|
57
|
-
width: 10px;
|
|
58
|
-
height: 2px;
|
|
59
|
-
position: absolute;
|
|
60
|
-
top: 7px;
|
|
61
|
-
left: 3px;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.fwe-checkbox-container .fwe-checkbox-indicator-background + svg {
|
|
65
|
-
display: block;
|
|
66
|
-
position: absolute;
|
|
67
|
-
top: 0;
|
|
68
|
-
left: 0;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.fwe-checkbox-container.fr-checkbox-large .fwe-checkbox-indicator-background {
|
|
72
|
-
border-radius: 4px;
|
|
73
|
-
width: 24px;
|
|
74
|
-
height: 24px;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.fwe-checkbox-container.fr-checkbox-large .fwe-indeterminate-indicator {
|
|
78
|
-
width: 14px;
|
|
79
|
-
top: 11px;
|
|
80
|
-
left: 5px;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.fwe-checkbox-container.fr-checkbox-large.fwe-checked .fwe-checkbox-indicator-background, .fwe-checkbox-container.fr-checkbox-large.fr-checkbox-indeterminate .fwe-checkbox-indicator-background {
|
|
84
|
-
border: 12px solid var(--fwe-hero);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.fwe-checkbox-container:hover .fwe-checkbox-indicator-background {
|
|
88
|
-
background-color: var(--fwe-control);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.fwe-checkbox-container:active .fwe-checkbox-indicator-background {
|
|
92
|
-
background-color: var(--fwe-control-hover);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.fwe-checkbox-container.fwe-checked .fwe-checkbox-indicator-background, .fwe-checkbox-container.fr-checkbox-indeterminate .fwe-checkbox-indicator-background {
|
|
96
|
-
border: 8px solid var(--fwe-hero);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.fwe-checkbox-container.fwe-checked:hover .fwe-checkbox-indicator-background, .fwe-checkbox-container.fr-checkbox-indeterminate:hover .fwe-checkbox-indicator-background {
|
|
100
|
-
border-color: var(--fwe-hero-hover);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.fwe-checkbox-container.fwe-checked:active .fwe-checkbox-indicator-background, .fwe-checkbox-container.fr-checkbox-indeterminate:active .fwe-checkbox-indicator-background {
|
|
104
|
-
border-color: var(--fwe-hero-active);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.fwe-checkbox-container.fr-checkbox-invalid .fwe-checkbox-indicator-background {
|
|
108
|
-
border: 1px solid var(--fwe-red);
|
|
109
|
-
background: var(--fwe-white);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.fwe-checkbox-container.fwe-disabled {
|
|
113
|
-
cursor: default;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.fwe-checkbox-container.fwe-disabled .fwe-checkbox-indicator-background {
|
|
117
|
-
background-color: var(--fwe-white);
|
|
118
|
-
border: 1px solid var(--fwe-control);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.fwe-checkbox-container.fwe-disabled.fwe-checked .fwe-checkbox-indicator-background, .fwe-checkbox-container.fwe-disabled.fr-checkbox-indeterminate .fwe-checkbox-indicator-background {
|
|
122
|
-
background-color: var(--fwe-control);
|
|
123
|
-
border: 1px solid var(--fwe-control);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.fwe-checkbox-container.fwe-disabled.fr-checkbox-invalid .fwe-checkbox-indicator-background {
|
|
127
|
-
background-color: var(--fwe-white);
|
|
128
|
-
border: 1px solid var(--fwe-control);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.fwe-checkbox-container.fwe-disabled .fwe-checkbox-title {
|
|
132
|
-
color: var(--fwe-text-disabled);
|
|
133
|
-
}
|
|
134
|
-
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import './Checkbox.scss';
|
|
2
|
-
export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
|
|
3
|
-
readonly id?: string;
|
|
4
|
-
readonly checked?: boolean;
|
|
5
|
-
readonly defaultChecked?: boolean;
|
|
6
|
-
readonly onChange?: (value: boolean, e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
|
-
readonly name?: string;
|
|
8
|
-
readonly large?: boolean;
|
|
9
|
-
readonly valid?: boolean;
|
|
10
|
-
readonly labelPosition?: 'before' | 'after' | 'below';
|
|
11
|
-
readonly required?: boolean;
|
|
12
|
-
readonly disabled?: boolean;
|
|
13
|
-
readonly indeterminate?: boolean;
|
|
14
|
-
}
|
|
15
|
-
export declare function Checkbox({ id, checked: checkedProp, defaultChecked, onChange, name, large, valid, labelPosition, required, disabled, indeterminate, children, className, ...props }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import "./Checkbox.css";
|
|
3
|
-
import classnames from "classnames";
|
|
4
|
-
import { useControlled } from "../../utils/useControlled.js";
|
|
5
|
-
function Checkbox({ id, checked: checkedProp, defaultChecked, onChange, name, large = false, valid = true, labelPosition = 'after', required, disabled = false, indeterminate = false, children, className, ...props }) {
|
|
6
|
-
const [isChecked, setChecked] = useControlled({
|
|
7
|
-
controlled: checkedProp,
|
|
8
|
-
default: defaultChecked
|
|
9
|
-
});
|
|
10
|
-
const handleChange = (e)=>{
|
|
11
|
-
const newChecked = !isChecked;
|
|
12
|
-
setChecked(newChecked);
|
|
13
|
-
onChange?.(newChecked, e);
|
|
14
|
-
};
|
|
15
|
-
const containerClasses = classnames('fwe-checkbox-container', {
|
|
16
|
-
'fr-checkbox-large': large
|
|
17
|
-
}, {
|
|
18
|
-
'fr-checkbox-invalid': !valid || required
|
|
19
|
-
}, {
|
|
20
|
-
'fwe-disabled': disabled
|
|
21
|
-
}, {
|
|
22
|
-
'fwe-checked': isChecked
|
|
23
|
-
}, {
|
|
24
|
-
'fwe-label-below': 'below' === labelPosition
|
|
25
|
-
}, {
|
|
26
|
-
'fwe-label-before': 'before' === labelPosition
|
|
27
|
-
}, {
|
|
28
|
-
'fr-checkbox-indeterminate': indeterminate
|
|
29
|
-
}, className);
|
|
30
|
-
return /*#__PURE__*/ jsxs("label", {
|
|
31
|
-
className: containerClasses,
|
|
32
|
-
htmlFor: id,
|
|
33
|
-
children: [
|
|
34
|
-
/*#__PURE__*/ jsx("input", {
|
|
35
|
-
name: name,
|
|
36
|
-
type: "checkbox",
|
|
37
|
-
id: id,
|
|
38
|
-
disabled: disabled,
|
|
39
|
-
required: required,
|
|
40
|
-
onChange: (e)=>handleChange(e),
|
|
41
|
-
...props,
|
|
42
|
-
checked: isChecked
|
|
43
|
-
}),
|
|
44
|
-
/*#__PURE__*/ jsxs("div", {
|
|
45
|
-
className: "fwe-checkbox-indicator-container",
|
|
46
|
-
children: [
|
|
47
|
-
/*#__PURE__*/ jsx("div", {
|
|
48
|
-
className: "fwe-checkbox-indicator-background"
|
|
49
|
-
}),
|
|
50
|
-
!indeterminate && isChecked && (large ? /*#__PURE__*/ jsx("svg", {
|
|
51
|
-
width: "24px",
|
|
52
|
-
height: "24px",
|
|
53
|
-
"aria-hidden": "true",
|
|
54
|
-
children: /*#__PURE__*/ jsx("path", {
|
|
55
|
-
d: "M17.5 7L10 14.5 7.501 12l-1.5 1.501L10 17.5l9-9z",
|
|
56
|
-
fill: "#fff"
|
|
57
|
-
})
|
|
58
|
-
}) : /*#__PURE__*/ jsx("svg", {
|
|
59
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
60
|
-
width: "16",
|
|
61
|
-
height: "16",
|
|
62
|
-
"aria-hidden": "true",
|
|
63
|
-
children: /*#__PURE__*/ jsx("path", {
|
|
64
|
-
d: "M6 12L3 9l1.25-1.25L6 9.5l5.75-5.75L13 5l-7 7z",
|
|
65
|
-
fill: "#fff"
|
|
66
|
-
})
|
|
67
|
-
})),
|
|
68
|
-
indeterminate && /*#__PURE__*/ jsx("div", {
|
|
69
|
-
className: "fwe-indeterminate-indicator"
|
|
70
|
-
})
|
|
71
|
-
]
|
|
72
|
-
}),
|
|
73
|
-
/*#__PURE__*/ jsx("div", {
|
|
74
|
-
className: "fwe-checkbox-title",
|
|
75
|
-
children: children
|
|
76
|
-
})
|
|
77
|
-
]
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
export { Checkbox };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ClassNamePropsWithChildren } from '../../utils/types';
|
|
2
|
-
export interface RadioProps extends ClassNamePropsWithChildren {
|
|
3
|
-
id?: string;
|
|
4
|
-
defaultChecked?: boolean;
|
|
5
|
-
checked?: boolean;
|
|
6
|
-
onChange?: (value: string) => void;
|
|
7
|
-
name?: string;
|
|
8
|
-
value?: string;
|
|
9
|
-
labelPosition?: 'before' | 'after' | 'below';
|
|
10
|
-
large?: boolean;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
required?: boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare function RadioButton(props: RadioProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,61 +0,0 @@
|
|
|
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 };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type ComponentPropsWithoutRef } from 'react';
|
|
2
|
-
export interface RadioGroupProps extends ComponentPropsWithoutRef<'div'> {
|
|
3
|
-
name?: string;
|
|
4
|
-
defaultValue?: string;
|
|
5
|
-
onValueChange?: (value: string) => void;
|
|
6
|
-
value?: string;
|
|
7
|
-
labelPosition?: 'before' | 'after' | 'below';
|
|
8
|
-
large?: boolean;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
required?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare const RadioGroup: (props: RadioGroupProps & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -1,50 +0,0 @@
|
|
|
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 };
|
|
@@ -1,12 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ClassNamePropsWithChildren } from '../../utils/types';
|
|
3
|
-
export interface SegmentComponentConfiguration {
|
|
4
|
-
outline?: boolean;
|
|
5
|
-
iconOnly?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface SegmentProps extends ClassNamePropsWithChildren {
|
|
8
|
-
legend: string;
|
|
9
|
-
config?: SegmentComponentConfiguration;
|
|
10
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: any) => void;
|
|
11
|
-
value?: any;
|
|
12
|
-
}
|
|
13
|
-
export declare function Segment(props: SegmentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,59 +0,0 @@
|
|
|
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 };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { ClassNameProps } from '../../../utils/types';
|
|
3
|
-
export interface SegmentControlProps extends ClassNameProps {
|
|
4
|
-
label: string;
|
|
5
|
-
name: string;
|
|
6
|
-
value: any;
|
|
7
|
-
checked?: boolean;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
icon?: React.ReactNode;
|
|
10
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: any) => void;
|
|
11
|
-
id?: string;
|
|
12
|
-
iconOnly?: boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare function SegmentControl(props: SegmentControlProps): import("react/jsx-runtime").JSX.Element;
|