@festo-ui/react 10.1.0-dev.864 → 10.1.0-dev.866
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 +42 -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 +12 -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 +61 -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 +56 -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 +21 -0
- package/dist/components/bottom-sheet/BottomSheet.css +18 -0
- package/dist/components/bottom-sheet/BottomSheet.d.ts +10 -0
- package/dist/components/bottom-sheet/BottomSheet.js +104 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts +13 -0
- package/dist/components/breadcrumb/Breadcrumb.js +61 -0
- package/dist/components/button/Button.d.ts +11 -0
- package/dist/components/button/Button.js +37 -0
- package/dist/components/card/Card.d.ts +3 -0
- package/dist/components/card/Card.js +11 -0
- package/dist/components/card/CardBody.d.ts +5 -0
- package/dist/components/card/CardBody.js +17 -0
- package/dist/components/card/CardHeader.d.ts +8 -0
- package/dist/components/card/CardHeader.js +33 -0
- package/dist/components/card/CardHeader.stories.helper.js +7 -0
- package/dist/components/card/CardNotification.d.ts +5 -0
- package/dist/components/card/CardNotification.js +30 -0
- package/dist/components/chips/chip/Chip.d.ts +16 -0
- package/dist/components/chips/chip/Chip.js +45 -0
- package/dist/components/chips/chip-container/ChipContainer.d.ts +5 -0
- package/dist/components/chips/chip-container/ChipContainer.js +16 -0
- package/dist/components/icon-wrapper/IconWrapper.d.ts +7 -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 +42 -0
- package/dist/components/mobile-flyout/MobileFlyout.d.ts +11 -0
- package/dist/components/mobile-flyout/MobileFlyout.js +89 -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 +18 -0
- package/dist/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.js +37 -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 +36 -0
- package/dist/components/modals/AlertModal.d.ts +12 -0
- package/dist/components/modals/AlertModal.js +54 -0
- package/dist/components/modals/ConfirmModal.d.ts +11 -0
- package/dist/components/modals/ConfirmModal.js +47 -0
- package/dist/components/modals/CustomModal.d.ts +8 -0
- package/dist/components/modals/CustomModal.js +39 -0
- package/dist/components/modals/Modal.css +39 -0
- package/dist/components/modals/Modal.d.ts +8 -0
- package/dist/components/modals/Modal.js +32 -0
- package/dist/components/modals/ModalBase.d.ts +10 -0
- package/dist/components/modals/ModalBase.js +125 -0
- package/dist/components/modals/ModalFooter.d.ts +2 -0
- package/dist/components/modals/ModalFooter.js +14 -0
- package/dist/components/modals/Prompt.d.ts +15 -0
- package/dist/components/modals/Prompt.js +61 -0
- package/dist/components/modals/image-gallery/ImageGallery.css +833 -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 +104 -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 +10 -0
- package/dist/components/pagination/Pagination.js +98 -0
- package/dist/components/popovers/legend/Legend.d.ts +11 -0
- package/dist/components/popovers/legend/Legend.js +25 -0
- package/dist/components/popovers/popover/Popover.css +9 -0
- package/dist/components/popovers/popover/Popover.d.ts +19 -0
- package/dist/components/popovers/popover/Popover.js +99 -0
- package/dist/components/popovers/popover-menu/PopoverMenu.d.ts +9 -0
- package/dist/components/popovers/popover-menu/PopoverMenu.js +33 -0
- package/dist/components/popovers/popover-menu/PopoverMenuContext.d.ts +4 -0
- package/dist/components/popovers/popover-menu/PopoverMenuContext.js +5 -0
- package/dist/components/popovers/popover-menu/popover-menu-item/PopoverMenuItem.d.ts +9 -0
- package/dist/components/popovers/popover-menu/popover-menu-item/PopoverMenuItem.js +31 -0
- package/dist/components/popovers/tooltip/Tooltip.d.ts +6 -0
- package/dist/components/popovers/tooltip/Tooltip.js +13 -0
- package/dist/components/progress/Progress.d.ts +6 -0
- package/dist/components/progress/Progress.js +30 -0
- package/dist/components/search-input/SearchInput.css +25 -0
- package/dist/components/search-input/SearchInput.d.ts +25 -0
- package/dist/components/search-input/SearchInput.js +89 -0
- package/dist/components/search-input/SearchInputOption.d.ts +5 -0
- package/dist/components/search-input/SearchInputOption.js +18 -0
- package/dist/components/search-input/SearchResult.d.ts +8 -0
- package/dist/components/search-input/SearchResult.js +48 -0
- package/dist/components/snackbar/Snackbar.css +55 -0
- package/dist/components/snackbar/Snackbar.d.ts +21 -0
- package/dist/components/snackbar/Snackbar.js +82 -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 +69 -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 +49 -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 +17 -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 +59 -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 +8 -0
- package/dist/components/tab/tab-pane/TabPane.js +22 -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 +6 -0
- package/dist/components/table-header-cell/TableHeaderCell.js +22 -0
- package/dist/forms/checkbox/Checkbox.css +134 -0
- package/dist/forms/checkbox/Checkbox.d.ts +12 -0
- package/dist/forms/checkbox/Checkbox.js +83 -0
- 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 +14 -0
- package/dist/forms/radio/RadioButton.js +57 -0
- package/dist/forms/radio/RadioGroup.d.ts +12 -0
- package/dist/forms/radio/RadioGroup.js +51 -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 +12 -0
- package/dist/forms/segment/Segment.js +60 -0
- package/dist/forms/segment/segment-control/SegmentControl.d.ts +10 -0
- package/dist/forms/segment/segment-control/SegmentControl.js +59 -0
- package/dist/forms/select/Select.d.ts +25 -0
- package/dist/forms/select/Select.js +93 -0
- package/dist/forms/select/internal/SelectButton.d.ts +0 -0
- package/dist/forms/select/internal/SelectButton.js +0 -0
- package/dist/forms/select/internal/SelectButtonContent.d.ts +0 -0
- package/dist/forms/select/internal/SelectButtonContent.js +0 -0
- package/dist/forms/select/internal/SelectOptionsContainer.d.ts +0 -0
- package/dist/forms/select/internal/SelectOptionsContainer.js +0 -0
- package/dist/forms/slider/Slider.css +50 -0
- package/dist/forms/slider/Slider.d.ts +14 -0
- package/dist/forms/slider/Slider.js +98 -0
- package/dist/forms/switch/Switch.d.ts +10 -0
- package/dist/forms/switch/Switch.js +48 -0
- package/dist/forms/text-area/TextArea.css +14 -0
- package/dist/forms/text-area/TextArea.d.ts +13 -0
- package/dist/forms/text-area/TextArea.js +116 -0
- package/dist/forms/text-input/TextInput.css +31 -0
- package/dist/forms/text-input/TextInput.d.ts +13 -0
- package/dist/forms/text-input/TextInput.js +65 -0
- package/dist/forms/time-picker/TimePicker.css +10 -0
- package/dist/forms/time-picker/TimePicker.d.ts +25 -0
- package/dist/forms/time-picker/TimePicker.js +125 -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 +209 -0
- package/dist/forms/time-picker/time-picker-dropdown/TimePickerInput.d.ts +9 -0
- package/dist/forms/time-picker/time-picker-dropdown/TimePickerInput.js +15 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +61 -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 +23 -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,19 @@
|
|
|
1
|
+
import './Popover.scss';
|
|
2
|
+
import { type Placement } from '@floating-ui/react';
|
|
3
|
+
import { type MouseEvent, type ReactNode } from 'react';
|
|
4
|
+
export interface PopoverProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'content' | 'onChange'> {
|
|
5
|
+
readonly 'data-testid'?: string;
|
|
6
|
+
readonly containerClassName?: string;
|
|
7
|
+
readonly content: ReactNode;
|
|
8
|
+
readonly position?: Placement;
|
|
9
|
+
readonly fallbackPositions?: Placement[];
|
|
10
|
+
readonly isOpen?: boolean;
|
|
11
|
+
readonly openOnHover?: boolean;
|
|
12
|
+
readonly openByDefault?: boolean;
|
|
13
|
+
readonly onChange?: (isOpen: boolean) => void;
|
|
14
|
+
readonly flip?: boolean;
|
|
15
|
+
readonly showArrow?: boolean;
|
|
16
|
+
readonly onTriggerClick?: (event: MouseEvent) => void;
|
|
17
|
+
readonly stopPropagation?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const Popover: (props: PopoverProps & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "./Popover.css";
|
|
3
|
+
import { FloatingArrow, FloatingPortal, arrow, autoUpdate, flip, offset, shift, useClick, useDismiss, useFloating, useHover, useInteractions } from "@floating-ui/react";
|
|
4
|
+
import classnames from "classnames";
|
|
5
|
+
import { forwardRef, useRef } from "react";
|
|
6
|
+
import { useControlled } from "../../../utils/useControlled.js";
|
|
7
|
+
import { useForkRef } from "../../../utils/useForkRef.js";
|
|
8
|
+
const Popover = /*#__PURE__*/ forwardRef(({ children, className, style, containerClassName, content, position, fallbackPositions, isOpen, openOnHover = false, openByDefault = false, onChange, flip: enableFlip = true, showArrow = true, onTriggerClick, stopPropagation = false, ...props }, ref)=>{
|
|
9
|
+
const [showPopover, setShowPopover] = useControlled({
|
|
10
|
+
controlled: isOpen,
|
|
11
|
+
default: openByDefault
|
|
12
|
+
});
|
|
13
|
+
const arrowRef = useRef(null);
|
|
14
|
+
const triggerRef = useRef(null);
|
|
15
|
+
const handleRef = useForkRef(ref, triggerRef);
|
|
16
|
+
const { refs, floatingStyles, context } = useFloating({
|
|
17
|
+
placement: position,
|
|
18
|
+
open: showPopover,
|
|
19
|
+
onOpenChange: (isOpen)=>{
|
|
20
|
+
setShowPopover(isOpen);
|
|
21
|
+
onChange?.(isOpen);
|
|
22
|
+
},
|
|
23
|
+
middleware: [
|
|
24
|
+
offset(12),
|
|
25
|
+
enableFlip && flip({
|
|
26
|
+
fallbackPlacements: fallbackPositions || void 0,
|
|
27
|
+
fallbackAxisSideDirection: 'end'
|
|
28
|
+
}),
|
|
29
|
+
shift({
|
|
30
|
+
padding: 8
|
|
31
|
+
}),
|
|
32
|
+
showArrow && arrow({
|
|
33
|
+
element: arrowRef,
|
|
34
|
+
padding: 8
|
|
35
|
+
})
|
|
36
|
+
].filter(Boolean),
|
|
37
|
+
whileElementsMounted: autoUpdate
|
|
38
|
+
});
|
|
39
|
+
const dismiss = useDismiss(context);
|
|
40
|
+
const click = useClick(context, {
|
|
41
|
+
enabled: !openOnHover,
|
|
42
|
+
event: 'click',
|
|
43
|
+
stickIfOpen: true
|
|
44
|
+
});
|
|
45
|
+
const hover = useHover(context, {
|
|
46
|
+
enabled: openOnHover
|
|
47
|
+
});
|
|
48
|
+
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
49
|
+
dismiss,
|
|
50
|
+
click,
|
|
51
|
+
hover
|
|
52
|
+
]);
|
|
53
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
54
|
+
children: [
|
|
55
|
+
/*#__PURE__*/ jsx("div", {
|
|
56
|
+
className: className,
|
|
57
|
+
style: style,
|
|
58
|
+
ref: (node)=>{
|
|
59
|
+
refs.setReference(node);
|
|
60
|
+
if ('function' == typeof handleRef) handleRef(node);
|
|
61
|
+
},
|
|
62
|
+
...getReferenceProps({
|
|
63
|
+
...props,
|
|
64
|
+
onClick: (e)=>{
|
|
65
|
+
if (stopPropagation) {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
e.stopPropagation();
|
|
68
|
+
}
|
|
69
|
+
onTriggerClick?.(e);
|
|
70
|
+
}
|
|
71
|
+
}),
|
|
72
|
+
children: children
|
|
73
|
+
}),
|
|
74
|
+
showPopover && /*#__PURE__*/ jsx(FloatingPortal, {
|
|
75
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
76
|
+
className: "fwe-popover-container",
|
|
77
|
+
ref: refs.setFloating,
|
|
78
|
+
style: floatingStyles,
|
|
79
|
+
...getFloatingProps(),
|
|
80
|
+
children: [
|
|
81
|
+
showArrow && /*#__PURE__*/ jsx(FloatingArrow, {
|
|
82
|
+
ref: arrowRef,
|
|
83
|
+
context: context,
|
|
84
|
+
fill: "white",
|
|
85
|
+
width: 16,
|
|
86
|
+
height: 8
|
|
87
|
+
}),
|
|
88
|
+
/*#__PURE__*/ jsx("div", {
|
|
89
|
+
className: classnames('fwe-popover', containerClassName),
|
|
90
|
+
children: content
|
|
91
|
+
})
|
|
92
|
+
]
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
Popover.displayName = 'Popover';
|
|
99
|
+
export { Popover };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type PopoverProps } from '../popover/Popover';
|
|
3
|
+
import { type PopoverMenuItemProps } from './popover-menu-item/PopoverMenuItem';
|
|
4
|
+
export interface PopoverMenuProps extends Omit<PopoverProps, 'content' | 'isOpen' | 'onStateChange'> {
|
|
5
|
+
readonly items: PopoverMenuItemProps[] | ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const PopoverMenu: (props: PopoverMenuProps & {
|
|
8
|
+
children?: ReactNode | undefined;
|
|
9
|
+
} & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
import { forwardRef, useMemo, useState } from "react";
|
|
4
|
+
import { Popover } from "../popover/Popover.js";
|
|
5
|
+
import { PopoverMenuContext } from "./PopoverMenuContext.js";
|
|
6
|
+
import { PopoverMenuItem } from "./popover-menu-item/PopoverMenuItem.js";
|
|
7
|
+
const PopoverMenu = /*#__PURE__*/ forwardRef(({ items, className, containerClassName, children, ...props }, ref)=>{
|
|
8
|
+
const [showPopoverMenu, setShowPopoverMenu] = useState(false);
|
|
9
|
+
const isPopoverMenuItemPropsArray = (items)=>Array.isArray(items) && items.length > 0 && 'text' in items[0];
|
|
10
|
+
let content = null;
|
|
11
|
+
content = isPopoverMenuItemPropsArray(items) ? items.map((item)=>/*#__PURE__*/ jsx(PopoverMenuItem, {
|
|
12
|
+
...item
|
|
13
|
+
}, item.text)) : items;
|
|
14
|
+
const popoverMenuContextValue = useMemo(()=>({
|
|
15
|
+
setShowPopoverMenu: setShowPopoverMenu
|
|
16
|
+
}), []);
|
|
17
|
+
return /*#__PURE__*/ jsx(PopoverMenuContext.Provider, {
|
|
18
|
+
value: popoverMenuContextValue,
|
|
19
|
+
children: /*#__PURE__*/ jsx(Popover, {
|
|
20
|
+
className: classnames('fwe-popover-menu-trigger', className),
|
|
21
|
+
containerClassName: classnames('fwe-popover--menu', containerClassName),
|
|
22
|
+
content: content,
|
|
23
|
+
position: "right",
|
|
24
|
+
isOpen: showPopoverMenu,
|
|
25
|
+
onChange: setShowPopoverMenu,
|
|
26
|
+
ref: ref,
|
|
27
|
+
...props,
|
|
28
|
+
children: children
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
PopoverMenu.displayName = 'PopoverMenu';
|
|
33
|
+
export { PopoverMenu };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export interface PopoverMenuItemProps extends Omit<ComponentPropsWithoutRef<'button'>, 'onClick'> {
|
|
3
|
+
readonly 'data-testid'?: string;
|
|
4
|
+
readonly text: string;
|
|
5
|
+
readonly icon: React.ReactNode;
|
|
6
|
+
readonly onClick?: (data: unknown) => void;
|
|
7
|
+
readonly data?: unknown;
|
|
8
|
+
}
|
|
9
|
+
export declare const PopoverMenuItem: (props: PopoverMenuItemProps & import("react").RefAttributes<HTMLButtonElement>) => React.ReactElement | null;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useContext } from "react";
|
|
3
|
+
import { IconWrapper } from "../../../icon-wrapper/IconWrapper.js";
|
|
4
|
+
import { PopoverMenuContext } from "../PopoverMenuContext.js";
|
|
5
|
+
const PopoverMenuItem = /*#__PURE__*/ forwardRef(({ text, icon, onClick, data, className, ...props }, ref)=>{
|
|
6
|
+
const { setShowPopoverMenu } = useContext(PopoverMenuContext);
|
|
7
|
+
function handleClick(e) {
|
|
8
|
+
e?.preventDefault();
|
|
9
|
+
e?.stopPropagation();
|
|
10
|
+
if (setShowPopoverMenu) setShowPopoverMenu(false);
|
|
11
|
+
if (onClick) onClick(data);
|
|
12
|
+
}
|
|
13
|
+
return /*#__PURE__*/ jsxs("button", {
|
|
14
|
+
type: "button",
|
|
15
|
+
className: className,
|
|
16
|
+
onClick: handleClick,
|
|
17
|
+
ref: ref,
|
|
18
|
+
...props,
|
|
19
|
+
children: [
|
|
20
|
+
/*#__PURE__*/ jsx(IconWrapper, {
|
|
21
|
+
icon: icon
|
|
22
|
+
}),
|
|
23
|
+
/*#__PURE__*/ jsx("span", {
|
|
24
|
+
className: "fwe-mr-xxs",
|
|
25
|
+
children: text
|
|
26
|
+
})
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
PopoverMenuItem.displayName = 'PopoverMenuItem';
|
|
31
|
+
export { PopoverMenuItem };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PopoverProps } from '../popover/Popover';
|
|
2
|
+
export interface TooltipProps extends Omit<PopoverProps, 'openOnHover'> {
|
|
3
|
+
}
|
|
4
|
+
export declare const Tooltip: (props: TooltipProps & {
|
|
5
|
+
children?: import("react").ReactNode | undefined;
|
|
6
|
+
} & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Popover } from "../popover/Popover.js";
|
|
4
|
+
const Tooltip = /*#__PURE__*/ forwardRef(({ content, children, ...props }, ref)=>/*#__PURE__*/ jsx(Popover, {
|
|
5
|
+
position: "bottom",
|
|
6
|
+
openOnHover: true,
|
|
7
|
+
content: content,
|
|
8
|
+
ref: ref,
|
|
9
|
+
...props,
|
|
10
|
+
children: children
|
|
11
|
+
}));
|
|
12
|
+
Tooltip.displayName = 'Tooltip';
|
|
13
|
+
export { Tooltip };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface ProgressProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
2
|
+
readonly progress: number;
|
|
3
|
+
readonly background?: 'white' | 'black' | 'background';
|
|
4
|
+
readonly error?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const Progress: (props: ProgressProps & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
const Progress = /*#__PURE__*/ forwardRef(({ background = 'white', error = false, progress, className, ...props }, ref)=>{
|
|
5
|
+
const classes = classnames('fwe-progress-bar', {
|
|
6
|
+
'fwe-bg-red': error
|
|
7
|
+
}, {
|
|
8
|
+
'fwe-progress-bar-black': 'black' === background
|
|
9
|
+
}, {
|
|
10
|
+
'fwe-progress-bar-background': 'background' === background
|
|
11
|
+
});
|
|
12
|
+
return /*#__PURE__*/ jsx("div", {
|
|
13
|
+
className: classnames('fwe-progress', className),
|
|
14
|
+
ref: ref,
|
|
15
|
+
...props,
|
|
16
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
17
|
+
className: classes,
|
|
18
|
+
role: "progressbar",
|
|
19
|
+
style: {
|
|
20
|
+
width: `${progress}%`
|
|
21
|
+
},
|
|
22
|
+
"aria-valuenow": progress,
|
|
23
|
+
"aria-valuemin": 0,
|
|
24
|
+
"aria-valuemax": 100,
|
|
25
|
+
"aria-label": "progressbar"
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
Progress.displayName = 'Progress';
|
|
30
|
+
export { Progress };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.fwe-search-suggestion {
|
|
2
|
+
height: 40px;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.fwe-search-suggestions {
|
|
6
|
+
top: unset;
|
|
7
|
+
left: unset;
|
|
8
|
+
right: unset;
|
|
9
|
+
position: static;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.fr-search-input-clear-button {
|
|
13
|
+
background: none;
|
|
14
|
+
border: none;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
align-items: center;
|
|
17
|
+
padding: 0;
|
|
18
|
+
display: flex;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.fr-search-result-highlight {
|
|
22
|
+
font-weight: unset;
|
|
23
|
+
color: var(--fwe-hero, #0091dc);
|
|
24
|
+
}
|
|
25
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import './SearchInput.scss';
|
|
2
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
3
|
+
export interface SearchInputProps extends Omit<ComponentPropsWithoutRef<'input'>, 'onChange' | 'value' | 'defaultValue' | 'children'> {
|
|
4
|
+
/** Placeholder text shown in the input. */
|
|
5
|
+
readonly label?: string;
|
|
6
|
+
/** Controlled value. */
|
|
7
|
+
readonly value?: string;
|
|
8
|
+
/** Initial value for uncontrolled usage. */
|
|
9
|
+
readonly defaultValue?: string;
|
|
10
|
+
/** Debounce time in milliseconds before `onChange` fires. Default: 300. */
|
|
11
|
+
readonly debounceTime?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Called after the debounce interval when the user types.
|
|
14
|
+
* Use this to trigger a search and update the children (suggestions).
|
|
15
|
+
*/
|
|
16
|
+
readonly onChange?: (value: string) => void;
|
|
17
|
+
/** Called when the user presses Enter or selects a suggestion. */
|
|
18
|
+
readonly onSearch?: (value: string) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Render search suggestions as children.
|
|
21
|
+
* Use `<SearchInputOption>` for each item.
|
|
22
|
+
*/
|
|
23
|
+
readonly children?: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export declare const SearchInput: (props: SearchInputProps & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "./SearchInput.css";
|
|
3
|
+
import { Combobox, ComboboxButton, ComboboxInput, ComboboxOptions } from "@headlessui/react";
|
|
4
|
+
import classnames from "classnames";
|
|
5
|
+
import { Children, forwardRef, useCallback, useRef } from "react";
|
|
6
|
+
import { useControlled } from "../../utils/useControlled.js";
|
|
7
|
+
const SearchInput = /*#__PURE__*/ forwardRef(({ defaultValue, disabled, label, value: controlledValue, debounceTime = 300, onChange, onSearch, children, className, ...props }, ref)=>{
|
|
8
|
+
const [innerValue, setInnerValue] = useControlled({
|
|
9
|
+
controlled: controlledValue,
|
|
10
|
+
default: defaultValue ?? ''
|
|
11
|
+
});
|
|
12
|
+
const debounceRef = useRef(null);
|
|
13
|
+
const debouncedOnChange = useCallback((val)=>{
|
|
14
|
+
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
15
|
+
debounceRef.current = setTimeout(()=>{
|
|
16
|
+
onChange?.(val);
|
|
17
|
+
}, debounceTime);
|
|
18
|
+
}, [
|
|
19
|
+
onChange,
|
|
20
|
+
debounceTime
|
|
21
|
+
]);
|
|
22
|
+
function handleInputChange(event) {
|
|
23
|
+
const val = event.target.value;
|
|
24
|
+
setInnerValue(val);
|
|
25
|
+
debouncedOnChange(val);
|
|
26
|
+
}
|
|
27
|
+
function handleSelect(val) {
|
|
28
|
+
if (null == val) return;
|
|
29
|
+
setInnerValue(val);
|
|
30
|
+
onSearch?.(val);
|
|
31
|
+
}
|
|
32
|
+
function handleClear() {
|
|
33
|
+
setInnerValue('');
|
|
34
|
+
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
35
|
+
onChange?.('');
|
|
36
|
+
onSearch?.('');
|
|
37
|
+
}
|
|
38
|
+
function handleKeyDown(event) {
|
|
39
|
+
if ('Enter' === event.key && innerValue) onSearch?.(innerValue);
|
|
40
|
+
if ('Escape' === event.key) handleClear();
|
|
41
|
+
}
|
|
42
|
+
const hasChildren = Children.count(children) > 0;
|
|
43
|
+
return /*#__PURE__*/ jsx(Combobox, {
|
|
44
|
+
value: innerValue,
|
|
45
|
+
onChange: handleSelect,
|
|
46
|
+
disabled: disabled,
|
|
47
|
+
immediate: true,
|
|
48
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
49
|
+
className: classnames('fwe-search-input', className),
|
|
50
|
+
ref: ref,
|
|
51
|
+
children: [
|
|
52
|
+
/*#__PURE__*/ jsx(ComboboxInput, {
|
|
53
|
+
disabled: disabled,
|
|
54
|
+
placeholder: label,
|
|
55
|
+
type: "search",
|
|
56
|
+
"aria-label": label ?? 'Search',
|
|
57
|
+
value: innerValue,
|
|
58
|
+
onChange: handleInputChange,
|
|
59
|
+
onKeyDown: handleKeyDown,
|
|
60
|
+
autoComplete: "off",
|
|
61
|
+
...props
|
|
62
|
+
}),
|
|
63
|
+
/*#__PURE__*/ jsx("div", {
|
|
64
|
+
className: "fwe-search-icon"
|
|
65
|
+
}),
|
|
66
|
+
/*#__PURE__*/ jsx(ComboboxButton, {
|
|
67
|
+
className: "fwe-clear-icon fr-search-input-clear-button",
|
|
68
|
+
"aria-label": "Clear",
|
|
69
|
+
onClick: handleClear
|
|
70
|
+
}),
|
|
71
|
+
hasChildren && /*#__PURE__*/ jsx(ComboboxOptions, {
|
|
72
|
+
className: "fwe-search-suggestions",
|
|
73
|
+
as: "div",
|
|
74
|
+
portal: false,
|
|
75
|
+
anchor: {
|
|
76
|
+
to: 'bottom start',
|
|
77
|
+
gap: 4
|
|
78
|
+
},
|
|
79
|
+
style: {
|
|
80
|
+
minWidth: 'var(--input-width)'
|
|
81
|
+
},
|
|
82
|
+
children: children
|
|
83
|
+
})
|
|
84
|
+
]
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
SearchInput.displayName = 'SearchInput';
|
|
89
|
+
export { SearchInput };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ComboboxOptionProps } from '@headlessui/react';
|
|
2
|
+
export interface SearchInputOptionProps extends Omit<ComboboxOptionProps, 'as'> {
|
|
3
|
+
readonly value: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const SearchInputOption: (props: SearchInputOptionProps & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ComboboxOption } from "@headlessui/react";
|
|
3
|
+
import classnames from "classnames";
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
function SearchInputOptionComponent({ children, className, ...props }, ref) {
|
|
6
|
+
return /*#__PURE__*/ jsx(ComboboxOption, {
|
|
7
|
+
ref: ref,
|
|
8
|
+
as: "div",
|
|
9
|
+
className: ({ focus, selected })=>classnames('fwe-search-suggestion', className, {
|
|
10
|
+
'fwe-selected': focus || selected
|
|
11
|
+
}),
|
|
12
|
+
...props,
|
|
13
|
+
children: children
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
const SearchInputOption = /*#__PURE__*/ forwardRef(SearchInputOptionComponent);
|
|
17
|
+
SearchInputOption.displayName = 'SearchInputOption';
|
|
18
|
+
export { SearchInputOption };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export interface SearchResultProps extends ComponentPropsWithoutRef<'span'> {
|
|
3
|
+
/** The full label text to display. */
|
|
4
|
+
readonly label: string;
|
|
5
|
+
/** The current search query — matching parts will be highlighted. */
|
|
6
|
+
readonly query?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const SearchResult: (props: SearchResultProps & import("react").RefAttributes<HTMLSpanElement>) => React.ReactElement | null;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
function getHighlightedParts(label, query) {
|
|
5
|
+
if (!query) return [
|
|
6
|
+
{
|
|
7
|
+
text: label,
|
|
8
|
+
highlighted: false
|
|
9
|
+
}
|
|
10
|
+
];
|
|
11
|
+
const parts = [];
|
|
12
|
+
const lowerLabel = label.toLowerCase();
|
|
13
|
+
const lowerQuery = query.toLowerCase();
|
|
14
|
+
let currentIndex = 0;
|
|
15
|
+
while(currentIndex < label.length){
|
|
16
|
+
const matchIndex = lowerLabel.indexOf(lowerQuery, currentIndex);
|
|
17
|
+
if (-1 === matchIndex) {
|
|
18
|
+
parts.push({
|
|
19
|
+
text: label.slice(currentIndex),
|
|
20
|
+
highlighted: false
|
|
21
|
+
});
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
if (matchIndex > currentIndex) parts.push({
|
|
25
|
+
text: label.slice(currentIndex, matchIndex),
|
|
26
|
+
highlighted: false
|
|
27
|
+
});
|
|
28
|
+
parts.push({
|
|
29
|
+
text: label.slice(matchIndex, matchIndex + query.length),
|
|
30
|
+
highlighted: true
|
|
31
|
+
});
|
|
32
|
+
currentIndex = matchIndex + query.length;
|
|
33
|
+
}
|
|
34
|
+
return parts;
|
|
35
|
+
}
|
|
36
|
+
const SearchResult = /*#__PURE__*/ forwardRef(({ label, query = '', className, ...props }, ref)=>/*#__PURE__*/ jsx("span", {
|
|
37
|
+
ref: ref,
|
|
38
|
+
className: classnames('fr-search-result', className),
|
|
39
|
+
...props,
|
|
40
|
+
children: getHighlightedParts(label, query).map((part, index)=>/*#__PURE__*/ jsx("span", {
|
|
41
|
+
className: classnames({
|
|
42
|
+
'fr-search-result-highlight': part.highlighted
|
|
43
|
+
}),
|
|
44
|
+
children: part.text
|
|
45
|
+
}, `${part.text}-${index}`))
|
|
46
|
+
}));
|
|
47
|
+
SearchResult.displayName = 'SearchResult';
|
|
48
|
+
export { SearchResult };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.fr-snackbar-wrapper {
|
|
2
|
+
opacity: 0;
|
|
3
|
+
opacity: 1;
|
|
4
|
+
margin-bottom: 24px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.fr-snackbar-wrapper-enter-done {
|
|
8
|
+
opacity: 1;
|
|
9
|
+
transition: opacity .6s ease-out;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.fr-snackbar-wrapper-exit {
|
|
13
|
+
opacity: 1;
|
|
14
|
+
height: 48px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.fr-snackbar-wrapper-exit-active {
|
|
18
|
+
opacity: 0;
|
|
19
|
+
height: 0;
|
|
20
|
+
margin-bottom: 0;
|
|
21
|
+
transition: height .3s ease-out .3s, opacity .3s ease-out, margin-bottom .3s ease-out .3s;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.fr-snackbar-wrapper--first {
|
|
25
|
+
opacity: 1;
|
|
26
|
+
margin-bottom: 24px;
|
|
27
|
+
transform: translateY(100px);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.fr-snackbar-wrapper--first-enter-done {
|
|
31
|
+
opacity: 1;
|
|
32
|
+
transition: opacity .6s ease-out;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.fr-snackbar-wrapper--first-exit {
|
|
36
|
+
opacity: 1;
|
|
37
|
+
height: 48px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.fr-snackbar-wrapper--first-exit-active {
|
|
41
|
+
opacity: 0;
|
|
42
|
+
height: 0;
|
|
43
|
+
margin-bottom: 0;
|
|
44
|
+
transition: height .3s ease-out .3s, opacity .3s ease-out, margin-bottom .3s ease-out .3s;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.fr-snackbar-wrapper--first-enter-done {
|
|
48
|
+
transition: transform .6s ease-out;
|
|
49
|
+
transform: translateY(0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.fr-snackbar-wrapper--first-exit-active {
|
|
53
|
+
transform: translateY(0);
|
|
54
|
+
}
|
|
55
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import './Snackbar.scss';
|
|
2
|
+
export interface SnackbarConfig {
|
|
3
|
+
type?: 'info' | 'warning' | 'error';
|
|
4
|
+
variant?: 'a' | 'b' | 'c';
|
|
5
|
+
darkBackground?: boolean;
|
|
6
|
+
showClose?: boolean;
|
|
7
|
+
action?: string;
|
|
8
|
+
disappearAfter?: number | null;
|
|
9
|
+
key?: string | number;
|
|
10
|
+
'data-testid'?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface SnackbarData extends SnackbarConfig {
|
|
13
|
+
text: string;
|
|
14
|
+
}
|
|
15
|
+
export interface SnackbarProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
16
|
+
readonly data?: SnackbarData;
|
|
17
|
+
readonly onAction?: () => void;
|
|
18
|
+
readonly onClose?: () => void;
|
|
19
|
+
readonly first?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const Snackbar: (props: SnackbarProps & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "./Snackbar.css";
|
|
3
|
+
import classnames from "classnames";
|
|
4
|
+
import { forwardRef, useEffect, useRef, useState } from "react";
|
|
5
|
+
import { CSSTransition } from "react-transition-group";
|
|
6
|
+
import { useForkRef } from "../../utils/useForkRef.js";
|
|
7
|
+
const Snackbar = /*#__PURE__*/ forwardRef(({ data, onAction, onClose, first = false, className, ...props }, ref)=>{
|
|
8
|
+
const [show, setShow] = useState(true);
|
|
9
|
+
const nodeRef = useRef(null);
|
|
10
|
+
const handleRef = useForkRef(ref, nodeRef);
|
|
11
|
+
useEffect(()=>{
|
|
12
|
+
let disappearAfter = 5000;
|
|
13
|
+
if (data?.disappearAfter !== null) {
|
|
14
|
+
if (data?.disappearAfter && data?.disappearAfter > 0) disappearAfter = data?.disappearAfter;
|
|
15
|
+
const timer = setTimeout(()=>setShow(false), disappearAfter);
|
|
16
|
+
return ()=>{
|
|
17
|
+
clearTimeout(timer);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}, [
|
|
21
|
+
data
|
|
22
|
+
]);
|
|
23
|
+
function handleClose() {
|
|
24
|
+
setShow(false);
|
|
25
|
+
}
|
|
26
|
+
const classes = first ? 'fr-snackbar-wrapper--first' : 'fr-snackbar-wrapper';
|
|
27
|
+
return /*#__PURE__*/ jsx(CSSTransition, {
|
|
28
|
+
nodeRef: nodeRef,
|
|
29
|
+
onExited: ()=>onClose ? onClose() : void 0,
|
|
30
|
+
unmountOnExit: true,
|
|
31
|
+
timeout: {
|
|
32
|
+
exit: 600
|
|
33
|
+
},
|
|
34
|
+
in: show,
|
|
35
|
+
classNames: classes,
|
|
36
|
+
appear: true,
|
|
37
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
38
|
+
ref: handleRef,
|
|
39
|
+
className: classnames(classes, className),
|
|
40
|
+
...props,
|
|
41
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
42
|
+
className: classnames({
|
|
43
|
+
'fwe-snackbar': true,
|
|
44
|
+
'fwe-snackbar-b': data?.variant === 'b',
|
|
45
|
+
'fwe-snackbar-c': data?.variant === 'c',
|
|
46
|
+
'fwe-snackbar-info': data?.type === 'info',
|
|
47
|
+
'fwe-snackbar-warning': data?.type === 'warning',
|
|
48
|
+
'fwe-snackbar-error': data?.type === 'error',
|
|
49
|
+
'fwe-snackbar-shadow': data?.darkBackground
|
|
50
|
+
}),
|
|
51
|
+
"data-testid": data?.['data-testid'],
|
|
52
|
+
children: [
|
|
53
|
+
/*#__PURE__*/ jsx("span", {
|
|
54
|
+
children: data?.text
|
|
55
|
+
}),
|
|
56
|
+
data?.action && /*#__PURE__*/ jsx("button", {
|
|
57
|
+
"aria-label": "UserAction",
|
|
58
|
+
type: "button",
|
|
59
|
+
className: "fwe-snackbar-link-btn",
|
|
60
|
+
onClick: ()=>onAction ? onAction() : void 0,
|
|
61
|
+
children: data?.action
|
|
62
|
+
}),
|
|
63
|
+
data?.action && data?.showClose && /*#__PURE__*/ jsx("div", {
|
|
64
|
+
className: "fwe-snackbar-separator"
|
|
65
|
+
}),
|
|
66
|
+
data?.showClose && /*#__PURE__*/ jsx("button", {
|
|
67
|
+
"aria-label": "Close",
|
|
68
|
+
type: "button",
|
|
69
|
+
className: "fwe-snackbar-close-btn",
|
|
70
|
+
onClick: handleClose,
|
|
71
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
72
|
+
className: "fwe-sr-only",
|
|
73
|
+
children: "Close"
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
Snackbar.displayName = 'Snackbar';
|
|
82
|
+
export { Snackbar };
|