@festo-ui/react 9.0.1-dev.783 → 9.0.1-dev.784
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 +87 -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 +5 -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 +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 +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 +16 -0
- package/dist/components/modals/Prompt.js +58 -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 +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 +10 -0
- package/dist/components/popovers/legend/Legend.js +22 -0
- package/dist/components/popovers/popover/Popover.css +8 -0
- package/dist/components/popovers/popover/Popover.d.ts +19 -0
- package/dist/components/popovers/popover/Popover.js +82 -0
- package/dist/components/popovers/popover-menu/PopoverMenu.d.ts +7 -0
- package/dist/components/popovers/popover-menu/PopoverMenu.js +31 -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 +7 -0
- package/dist/components/popovers/popover-menu/popover-menu-item/PopoverMenuItem.js +27 -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 +25 -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 +193 -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 +124 -0
- package/dist/forms/combobox/ComboBox.d.ts +28 -0
- package/dist/forms/combobox/ComboBox.js +175 -0
- package/dist/forms/multi-select/MultiSelect.d.ts +20 -0
- package/dist/forms/multi-select/MultiSelect.js +191 -0
- package/dist/forms/multi-select/MultiSelect.module.js +8 -0
- package/dist/forms/multi-select/MultiSelect_module.css +13 -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 +58 -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.d.ts +25 -0
- package/dist/forms/select/Select.js +92 -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 +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 +123 -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 +60 -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,19 @@
|
|
|
1
|
+
import './Popover.scss';
|
|
2
|
+
import { type Placement } from '@floating-ui/react';
|
|
3
|
+
import { type MouseEvent, type PropsWithChildren, type ReactNode } from 'react';
|
|
4
|
+
import type { ComponentBase } from '../../../utils/types';
|
|
5
|
+
export interface PopoverProps extends ComponentBase {
|
|
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 function Popover({ children, className, 'data-testid': dataTestId, containerClassName, content, position, fallbackPositions, isOpen, openOnHover, openByDefault, onChange, flip: enableFlip, showArrow, onTriggerClick, stopPropagation, }: PropsWithChildren<PopoverProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "./Popover.css";
|
|
3
|
+
import { FloatingArrow, arrow, autoUpdate, flip, offset, useClick, useDismiss, useFloating, useHover, useInteractions } from "@floating-ui/react";
|
|
4
|
+
import classnames from "classnames";
|
|
5
|
+
import { useRef } from "react";
|
|
6
|
+
import { useControlled } from "../../../utils/useControlled.js";
|
|
7
|
+
function Popover({ children, className, 'data-testid': dataTestId, containerClassName, content, position, fallbackPositions, isOpen, openOnHover = false, openByDefault = false, onChange, flip: enableFlip = true, showArrow = true, onTriggerClick, stopPropagation = false }) {
|
|
8
|
+
const [showPopover, setShowPopover] = useControlled({
|
|
9
|
+
controlled: isOpen,
|
|
10
|
+
default: openByDefault
|
|
11
|
+
});
|
|
12
|
+
const arrowRef = useRef(null);
|
|
13
|
+
const { refs, floatingStyles, context } = useFloating({
|
|
14
|
+
placement: position,
|
|
15
|
+
open: showPopover,
|
|
16
|
+
onOpenChange: (isOpen)=>{
|
|
17
|
+
setShowPopover(isOpen);
|
|
18
|
+
onChange?.(isOpen);
|
|
19
|
+
},
|
|
20
|
+
middleware: [
|
|
21
|
+
offset(12),
|
|
22
|
+
enableFlip && flip({
|
|
23
|
+
fallbackPlacements: fallbackPositions || void 0
|
|
24
|
+
}),
|
|
25
|
+
showArrow && arrow({
|
|
26
|
+
element: arrowRef,
|
|
27
|
+
padding: 8
|
|
28
|
+
})
|
|
29
|
+
].filter(Boolean),
|
|
30
|
+
whileElementsMounted: autoUpdate
|
|
31
|
+
});
|
|
32
|
+
const dismiss = useDismiss(context);
|
|
33
|
+
const click = useClick(context, {
|
|
34
|
+
enabled: !openOnHover,
|
|
35
|
+
event: 'click',
|
|
36
|
+
stickIfOpen: true
|
|
37
|
+
});
|
|
38
|
+
const hover = useHover(context, {
|
|
39
|
+
enabled: openOnHover
|
|
40
|
+
});
|
|
41
|
+
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
42
|
+
dismiss,
|
|
43
|
+
click,
|
|
44
|
+
hover
|
|
45
|
+
]);
|
|
46
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
47
|
+
children: [
|
|
48
|
+
/*#__PURE__*/ jsx("span", {
|
|
49
|
+
className: className,
|
|
50
|
+
ref: refs.setReference,
|
|
51
|
+
...getReferenceProps({
|
|
52
|
+
onClick: (event)=>{
|
|
53
|
+
if (stopPropagation) event.stopPropagation();
|
|
54
|
+
onTriggerClick?.(event);
|
|
55
|
+
}
|
|
56
|
+
}),
|
|
57
|
+
children: children
|
|
58
|
+
}),
|
|
59
|
+
showPopover && /*#__PURE__*/ jsxs("div", {
|
|
60
|
+
className: "fwe-popover-container",
|
|
61
|
+
ref: refs.setFloating,
|
|
62
|
+
style: floatingStyles,
|
|
63
|
+
...getFloatingProps(),
|
|
64
|
+
children: [
|
|
65
|
+
showArrow && /*#__PURE__*/ jsx(FloatingArrow, {
|
|
66
|
+
ref: arrowRef,
|
|
67
|
+
context: context,
|
|
68
|
+
fill: "white",
|
|
69
|
+
width: 16,
|
|
70
|
+
height: 8
|
|
71
|
+
}),
|
|
72
|
+
/*#__PURE__*/ jsx("div", {
|
|
73
|
+
"data-testid": dataTestId,
|
|
74
|
+
className: classnames('fwe-popover', containerClassName),
|
|
75
|
+
children: content
|
|
76
|
+
})
|
|
77
|
+
]
|
|
78
|
+
})
|
|
79
|
+
]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
export { Popover };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type PropsWithChildren, 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 function PopoverMenu({ items, className, containerClassName, children, ...props }: PropsWithChildren<PopoverMenuProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
import { 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
|
+
function PopoverMenu({ items, className, containerClassName, children, ...props }) {
|
|
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
|
+
...props,
|
|
27
|
+
children: children
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export { PopoverMenu };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface PopoverMenuItemProps {
|
|
2
|
+
readonly text: string;
|
|
3
|
+
readonly icon: React.ReactNode;
|
|
4
|
+
readonly onClick?: (data: unknown) => void;
|
|
5
|
+
readonly data?: unknown;
|
|
6
|
+
}
|
|
7
|
+
export declare function PopoverMenuItem({ text, icon, onClick, data, }: PopoverMenuItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
import { IconWrapper } from "../../../icon-wrapper/IconWrapper.js";
|
|
4
|
+
import { PopoverMenuContext } from "../PopoverMenuContext.js";
|
|
5
|
+
function PopoverMenuItem({ text, icon, onClick, data }) {
|
|
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
|
+
onClick: handleClick,
|
|
16
|
+
children: [
|
|
17
|
+
/*#__PURE__*/ jsx(IconWrapper, {
|
|
18
|
+
icon: icon
|
|
19
|
+
}),
|
|
20
|
+
/*#__PURE__*/ jsx("span", {
|
|
21
|
+
className: "fwe-mr-xxs",
|
|
22
|
+
children: text
|
|
23
|
+
})
|
|
24
|
+
]
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export { PopoverMenuItem };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import type { PopoverProps } from '../popover/Popover';
|
|
3
|
+
export interface TooltipProps extends Omit<PopoverProps, 'openOnHover'> {
|
|
4
|
+
}
|
|
5
|
+
export declare function Tooltip({ content, children, ...props }: PropsWithChildren<TooltipProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Popover } from "../popover/Popover.js";
|
|
3
|
+
function Tooltip({ content, children, ...props }) {
|
|
4
|
+
return /*#__PURE__*/ jsx(Popover, {
|
|
5
|
+
position: "bottom",
|
|
6
|
+
openOnHover: true,
|
|
7
|
+
content: content,
|
|
8
|
+
...props,
|
|
9
|
+
children: children
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export { Tooltip };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ClassNameProps } from '../../utils/types';
|
|
2
|
+
export interface ProgressProps extends ClassNameProps {
|
|
3
|
+
readonly progress: number;
|
|
4
|
+
readonly background?: 'white' | 'black' | 'background';
|
|
5
|
+
readonly error?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function Progress({ background, error, progress, className, }: ProgressProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
function Progress({ background = 'white', error = false, progress, className }) {
|
|
4
|
+
const classes = classnames('fwe-progress-bar', {
|
|
5
|
+
'fwe-bg-red': error
|
|
6
|
+
}, {
|
|
7
|
+
'fwe-progress-bar-black': 'black' === background
|
|
8
|
+
}, {
|
|
9
|
+
'fwe-progress-bar-background': 'background' === background
|
|
10
|
+
});
|
|
11
|
+
return /*#__PURE__*/ jsx("div", {
|
|
12
|
+
className: classnames('fwe-progress', className),
|
|
13
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
14
|
+
className: classes,
|
|
15
|
+
role: "progressbar",
|
|
16
|
+
style: {
|
|
17
|
+
width: `${progress}%`
|
|
18
|
+
},
|
|
19
|
+
"aria-valuenow": progress,
|
|
20
|
+
"aria-valuemin": 0,
|
|
21
|
+
"aria-valuemax": 100,
|
|
22
|
+
"aria-label": "progressbar"
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export { Progress };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
function ClearButton(props) {
|
|
3
|
+
return /*#__PURE__*/ jsx("button", {
|
|
4
|
+
type: "button",
|
|
5
|
+
className: "fwe-clear-icon fr-search-input-clear-button",
|
|
6
|
+
"aria-label": "Clear",
|
|
7
|
+
...props
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
export { ClearButton };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import './SearchInput.scss';
|
|
2
|
+
import type { SearchSuggestion } from './SearchSuggestion';
|
|
3
|
+
export interface SearchInputProps {
|
|
4
|
+
readonly disabled?: boolean;
|
|
5
|
+
readonly label?: string;
|
|
6
|
+
readonly defaultValue?: string;
|
|
7
|
+
readonly value?: string;
|
|
8
|
+
readonly suggestions?: SearchSuggestion[];
|
|
9
|
+
readonly onChange?: (value: string) => void;
|
|
10
|
+
readonly onKeyboardNavigate?: (value: string) => void;
|
|
11
|
+
readonly onSearch?: (value: string) => void;
|
|
12
|
+
readonly className?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function SearchInput({ defaultValue, disabled, label, value, suggestions, onChange, onSearch, onKeyboardNavigate, className, }: SearchInputProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "./SearchInput.css";
|
|
3
|
+
import classnames from "classnames";
|
|
4
|
+
import { useRef } from "react";
|
|
5
|
+
import { useOnClickOutside } from "../../utils/useOnClickOutside.js";
|
|
6
|
+
import { ClearButton } from "./ClearButton.js";
|
|
7
|
+
import { useSearchInput } from "./useSearchInput.js";
|
|
8
|
+
function SearchInput({ defaultValue, disabled, label, value, suggestions, onChange, onSearch, onKeyboardNavigate, className }) {
|
|
9
|
+
const inputRef = useRef(null);
|
|
10
|
+
const containerRef = useRef(null);
|
|
11
|
+
const cappedSuggestions = suggestions?.slice(0, 10) ?? [];
|
|
12
|
+
const { handleFocus, handleInput, handleClearQuery, handleSuggestionClick, handleOutsideClick, handleKeyDown, hideSuggestionList, selectedSuggestionIndex, innerValue } = useSearchInput(inputRef, cappedSuggestions, value, defaultValue, onChange, onSearch, onKeyboardNavigate);
|
|
13
|
+
useOnClickOutside(containerRef, handleOutsideClick);
|
|
14
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
15
|
+
className: classnames('fwe-search-input', className),
|
|
16
|
+
ref: containerRef,
|
|
17
|
+
children: [
|
|
18
|
+
/*#__PURE__*/ jsx("input", {
|
|
19
|
+
ref: inputRef,
|
|
20
|
+
disabled: disabled,
|
|
21
|
+
placeholder: label,
|
|
22
|
+
onFocus: handleFocus,
|
|
23
|
+
type: "search",
|
|
24
|
+
"aria-label": "Search",
|
|
25
|
+
onInput: handleInput,
|
|
26
|
+
onKeyDown: handleKeyDown,
|
|
27
|
+
value: innerValue
|
|
28
|
+
}),
|
|
29
|
+
/*#__PURE__*/ jsx("div", {
|
|
30
|
+
className: "fwe-search-icon"
|
|
31
|
+
}),
|
|
32
|
+
/*#__PURE__*/ jsx(ClearButton, {
|
|
33
|
+
onClick: handleClearQuery
|
|
34
|
+
}),
|
|
35
|
+
Boolean(suggestions?.length) && !hideSuggestionList && /*#__PURE__*/ jsxs("div", {
|
|
36
|
+
className: "fwe-search-suggestions",
|
|
37
|
+
role: "listbox",
|
|
38
|
+
children: [
|
|
39
|
+
cappedSuggestions.map((suggestion, i)=>/*#__PURE__*/ jsx("div", {
|
|
40
|
+
role: "option",
|
|
41
|
+
tabIndex: -1,
|
|
42
|
+
"aria-label": suggestion.value,
|
|
43
|
+
"aria-selected": selectedSuggestionIndex === i,
|
|
44
|
+
onClick: ()=>handleSuggestionClick(suggestion),
|
|
45
|
+
className: `fwe-search-suggestion ${selectedSuggestionIndex === i ? 'fwe-selected' : ''}`,
|
|
46
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
47
|
+
dangerouslySetInnerHTML: {
|
|
48
|
+
__html: suggestion.template
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
}, suggestion.value)),
|
|
52
|
+
suggestions && suggestions.length > 10 && /*#__PURE__*/ jsx("div", {
|
|
53
|
+
className: "fwe-ml-xxs",
|
|
54
|
+
children: "..."
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export { SearchInput };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class SearchSuggestion {
|
|
2
|
+
/**
|
|
3
|
+
* a html-string. e.g.: '<b> hello </b>'
|
|
4
|
+
*/
|
|
5
|
+
template: string;
|
|
6
|
+
/**
|
|
7
|
+
* This Value will be used as new query when the user selects the suggestion.
|
|
8
|
+
*/
|
|
9
|
+
value: string;
|
|
10
|
+
/**
|
|
11
|
+
* Creates a basic Suggestion from a string. The first query match is highlighted by bold tags.
|
|
12
|
+
* @param suggestionString The suggested string (should contain the whole query)
|
|
13
|
+
* @param query The current query. This string will be highlighted.
|
|
14
|
+
* @returns a html-string.
|
|
15
|
+
*/
|
|
16
|
+
static basicSuggestion(suggestionString: string, query: string): SearchSuggestion;
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
class SearchSuggestion {
|
|
2
|
+
template;
|
|
3
|
+
value;
|
|
4
|
+
static basicSuggestion(suggestionString, query) {
|
|
5
|
+
const i = suggestionString.toLocaleLowerCase().indexOf(query.toLocaleLowerCase());
|
|
6
|
+
let template = suggestionString;
|
|
7
|
+
if (-1 !== i) {
|
|
8
|
+
const boldStart = i;
|
|
9
|
+
const boldEnd = i + query.length;
|
|
10
|
+
const part1 = suggestionString.substring(0, boldStart);
|
|
11
|
+
const part2 = suggestionString.substring(boldStart, boldEnd);
|
|
12
|
+
const part3 = suggestionString.substring(boldEnd, suggestionString.length);
|
|
13
|
+
template = `${part1}<strong>${part2}</strong>${part3}`;
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
value: suggestionString,
|
|
17
|
+
template
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export { SearchSuggestion };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { SearchSuggestion } from './SearchSuggestion';
|
|
3
|
+
export declare function useSearchInput(inputRef: React.MutableRefObject<HTMLInputElement | null>, cappedSuggestions: SearchSuggestion[], value?: string, defaultValue?: string, onChange?: (value: string) => void, onSearch?: (value: string) => void, onKeyboardNavigate?: (value: string) => void): {
|
|
4
|
+
innerValue: string | undefined;
|
|
5
|
+
hideSuggestionList: boolean;
|
|
6
|
+
selectedSuggestionIndex: number;
|
|
7
|
+
handleClearQuery: () => void;
|
|
8
|
+
handleFocus: () => void;
|
|
9
|
+
handleInput: (event: any) => void;
|
|
10
|
+
handleSuggestionClick: (suggestion: SearchSuggestion) => void;
|
|
11
|
+
handleOutsideClick: () => void;
|
|
12
|
+
handleKeyDown: (event: React.KeyboardEvent) => void;
|
|
13
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { useControlled } from "../../utils/useControlled.js";
|
|
3
|
+
function useSearchInput(inputRef, cappedSuggestions, value, defaultValue = '', onChange, onSearch, onKeyboardNavigate) {
|
|
4
|
+
const [innerValue, setValue] = useControlled({
|
|
5
|
+
controlled: value,
|
|
6
|
+
default: defaultValue
|
|
7
|
+
});
|
|
8
|
+
const [hideSuggestionList, setHideSuggestionList] = useState(false);
|
|
9
|
+
const [selectedSuggestionIndex, setSelectedSuggestionIndex] = useState(-1);
|
|
10
|
+
function blurInput() {
|
|
11
|
+
if (inputRef.current) inputRef.current.blur();
|
|
12
|
+
}
|
|
13
|
+
function reset() {
|
|
14
|
+
setSelectedSuggestionIndex(-1);
|
|
15
|
+
setHideSuggestionList(true);
|
|
16
|
+
blurInput();
|
|
17
|
+
}
|
|
18
|
+
function handleSearch() {
|
|
19
|
+
reset();
|
|
20
|
+
if (void 0 !== innerValue) onSearch?.(innerValue);
|
|
21
|
+
}
|
|
22
|
+
function updateValue(newValue) {
|
|
23
|
+
setValue(newValue);
|
|
24
|
+
onChange?.(newValue);
|
|
25
|
+
onSearch?.(newValue);
|
|
26
|
+
}
|
|
27
|
+
function handleClearQuery() {
|
|
28
|
+
reset();
|
|
29
|
+
updateValue('');
|
|
30
|
+
}
|
|
31
|
+
function handleArrowKey(newSuggestionIndex) {
|
|
32
|
+
if (!cappedSuggestions || !cappedSuggestions.length) return;
|
|
33
|
+
const selectedSuggestion = cappedSuggestions[newSuggestionIndex];
|
|
34
|
+
setSelectedSuggestionIndex(newSuggestionIndex);
|
|
35
|
+
setValue(selectedSuggestion.value);
|
|
36
|
+
onKeyboardNavigate?.(selectedSuggestion.value);
|
|
37
|
+
}
|
|
38
|
+
function handleUpArrowKey() {
|
|
39
|
+
handleArrowKey(selectedSuggestionIndex > 0 ? selectedSuggestionIndex - 1 : cappedSuggestions.length - 1);
|
|
40
|
+
}
|
|
41
|
+
function handleDownArrowKey() {
|
|
42
|
+
handleArrowKey(selectedSuggestionIndex >= cappedSuggestions.length - 1 ? 0 : selectedSuggestionIndex + 1);
|
|
43
|
+
}
|
|
44
|
+
function handleKeyDown(event) {
|
|
45
|
+
switch(event.key){
|
|
46
|
+
case 'Enter':
|
|
47
|
+
handleSearch();
|
|
48
|
+
break;
|
|
49
|
+
case 'Escape':
|
|
50
|
+
handleClearQuery();
|
|
51
|
+
break;
|
|
52
|
+
case 'ArrowUp':
|
|
53
|
+
handleUpArrowKey();
|
|
54
|
+
break;
|
|
55
|
+
case 'ArrowDown':
|
|
56
|
+
handleDownArrowKey();
|
|
57
|
+
break;
|
|
58
|
+
default:
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const handleFocus = ()=>setHideSuggestionList(false);
|
|
63
|
+
const handleOutsideClick = ()=>setHideSuggestionList(true);
|
|
64
|
+
function handleSuggestionClick(suggestion) {
|
|
65
|
+
reset();
|
|
66
|
+
updateValue(suggestion.value);
|
|
67
|
+
}
|
|
68
|
+
function handleInput(event) {
|
|
69
|
+
setSelectedSuggestionIndex(-1);
|
|
70
|
+
setValue(event.target.value);
|
|
71
|
+
onChange?.(event.target.value);
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
innerValue,
|
|
75
|
+
hideSuggestionList,
|
|
76
|
+
selectedSuggestionIndex,
|
|
77
|
+
handleClearQuery,
|
|
78
|
+
handleFocus,
|
|
79
|
+
handleInput,
|
|
80
|
+
handleSuggestionClick,
|
|
81
|
+
handleOutsideClick,
|
|
82
|
+
handleKeyDown
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
export { useSearchInput };
|
|
@@ -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
|
+
import type { ClassNameProps } from '../../utils/types';
|
|
3
|
+
export interface SnackbarConfig extends ClassNameProps {
|
|
4
|
+
type?: 'info' | 'warning' | 'error';
|
|
5
|
+
variant?: 'a' | 'b' | 'c';
|
|
6
|
+
darkBackground?: boolean;
|
|
7
|
+
showClose?: boolean;
|
|
8
|
+
action?: string;
|
|
9
|
+
disappearAfter?: number | null;
|
|
10
|
+
key?: string | number;
|
|
11
|
+
}
|
|
12
|
+
export interface SnackbarData extends SnackbarConfig {
|
|
13
|
+
text: string;
|
|
14
|
+
}
|
|
15
|
+
export interface SnackbarProps {
|
|
16
|
+
readonly data?: SnackbarData;
|
|
17
|
+
readonly onAction?: () => void;
|
|
18
|
+
readonly onClose?: () => void;
|
|
19
|
+
readonly first?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function Snackbar(props: SnackbarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "./Snackbar.css";
|
|
3
|
+
import classnames from "classnames";
|
|
4
|
+
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { CSSTransition } from "react-transition-group";
|
|
6
|
+
function Snackbar(props) {
|
|
7
|
+
const { data, onAction, onClose, first = false } = props;
|
|
8
|
+
const [show, setShow] = useState(true);
|
|
9
|
+
const nodeRef = useRef(null);
|
|
10
|
+
useEffect(()=>{
|
|
11
|
+
let disappearAfter = 5000;
|
|
12
|
+
if (data?.disappearAfter !== null) {
|
|
13
|
+
if (data?.disappearAfter && data?.disappearAfter > 0) disappearAfter = data?.disappearAfter;
|
|
14
|
+
const timer = setTimeout(()=>setShow(false), disappearAfter);
|
|
15
|
+
return ()=>{
|
|
16
|
+
clearTimeout(timer);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}, [
|
|
20
|
+
data
|
|
21
|
+
]);
|
|
22
|
+
function handleClose() {
|
|
23
|
+
setShow(false);
|
|
24
|
+
}
|
|
25
|
+
const classes = first ? 'fr-snackbar-wrapper--first' : 'fr-snackbar-wrapper';
|
|
26
|
+
return /*#__PURE__*/ jsx(CSSTransition, {
|
|
27
|
+
nodeRef: nodeRef,
|
|
28
|
+
onExited: ()=>onClose ? onClose() : void 0,
|
|
29
|
+
unmountOnExit: true,
|
|
30
|
+
timeout: {
|
|
31
|
+
exit: 600
|
|
32
|
+
},
|
|
33
|
+
in: show,
|
|
34
|
+
classNames: classes,
|
|
35
|
+
appear: true,
|
|
36
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
37
|
+
ref: nodeRef,
|
|
38
|
+
className: classes,
|
|
39
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
40
|
+
className: classnames({
|
|
41
|
+
'fwe-snackbar': true,
|
|
42
|
+
'fwe-snackbar-b': data?.variant === 'b',
|
|
43
|
+
'fwe-snackbar-c': data?.variant === 'c',
|
|
44
|
+
'fwe-snackbar-info': data?.type === 'info',
|
|
45
|
+
'fwe-snackbar-warning': data?.type === 'warning',
|
|
46
|
+
'fwe-snackbar-error': data?.type === 'error',
|
|
47
|
+
'fwe-snackbar-shadow': data?.darkBackground
|
|
48
|
+
}, data?.className),
|
|
49
|
+
children: [
|
|
50
|
+
/*#__PURE__*/ jsx("span", {
|
|
51
|
+
children: data?.text
|
|
52
|
+
}),
|
|
53
|
+
data?.action && /*#__PURE__*/ jsx("button", {
|
|
54
|
+
"aria-label": "UserAction",
|
|
55
|
+
type: "button",
|
|
56
|
+
className: "fwe-snackbar-link-btn",
|
|
57
|
+
onClick: ()=>onAction ? onAction() : void 0,
|
|
58
|
+
children: data?.action
|
|
59
|
+
}),
|
|
60
|
+
data?.action && data?.showClose && /*#__PURE__*/ jsx("div", {
|
|
61
|
+
className: "fwe-snackbar-separator"
|
|
62
|
+
}),
|
|
63
|
+
data?.showClose && /*#__PURE__*/ jsx("button", {
|
|
64
|
+
"aria-label": "Close",
|
|
65
|
+
type: "button",
|
|
66
|
+
className: "fwe-snackbar-close-btn",
|
|
67
|
+
onClick: handleClose,
|
|
68
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
69
|
+
className: "fwe-sr-only",
|
|
70
|
+
children: "Close"
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
export { Snackbar };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SnackbarData } from './Snackbar';
|
|
3
|
+
export interface ProviderContext {
|
|
4
|
+
addSnackbar: (data: SnackbarData, onAction?: () => void, onClose?: () => void) => void;
|
|
5
|
+
closeSnackbar: (key: number | string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const SnackbarContext: React.Context<ProviderContext>;
|