@festo-ui/react 9.0.1 → 10.0.0-dev.827

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.
Files changed (150) hide show
  1. package/dist/components/accordion/Accordion.d.ts +3 -3
  2. package/dist/components/accordion/Accordion.js +2 -1
  3. package/dist/components/accordion/accordion-header/AccordionHeader.js +1 -0
  4. package/dist/components/accordion/accordion-item/AccordionItem.d.ts +1 -1
  5. package/dist/components/accordion/accordion-item/AccordionItem.js +2 -1
  6. package/dist/components/accordion/accordion-item/accordion-item-body/AccordionItemBody.js +1 -0
  7. package/dist/components/accordion/accordion-item/accordion-item-header/AccordionItemHeader.js +1 -0
  8. package/dist/components/bottom-sheet/BottomSheet.d.ts +2 -3
  9. package/dist/components/bottom-sheet/BottomSheet.js +7 -4
  10. package/dist/components/breadcrumb/Breadcrumb.d.ts +9 -9
  11. package/dist/components/breadcrumb/Breadcrumb.js +86 -26
  12. package/dist/components/button/Button.js +1 -0
  13. package/dist/components/card/Card.d.ts +3 -4
  14. package/dist/components/card/Card.js +6 -4
  15. package/dist/components/card/CardBody.d.ts +3 -3
  16. package/dist/components/card/CardBody.js +6 -4
  17. package/dist/components/card/CardHeader.d.ts +3 -3
  18. package/dist/components/card/CardHeader.js +6 -4
  19. package/dist/components/card/CardNotification.d.ts +2 -3
  20. package/dist/components/card/CardNotification.js +6 -2
  21. package/dist/components/chips/chip/Chip.d.ts +4 -5
  22. package/dist/components/chips/chip/Chip.js +11 -4
  23. package/dist/components/chips/chip-container/ChipContainer.d.ts +3 -3
  24. package/dist/components/chips/chip-container/ChipContainer.js +6 -2
  25. package/dist/components/icon-wrapper/IconWrapper.d.ts +2 -1
  26. package/dist/components/loading-indicator/LoadingIndicator.d.ts +2 -2
  27. package/dist/components/loading-indicator/LoadingIndicator.js +1 -0
  28. package/dist/components/mobile-flyout/MobileFlyout.js +1 -0
  29. package/dist/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.d.ts +1 -0
  30. package/dist/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.js +3 -2
  31. package/dist/components/mobile-flyout/mobile-flyout-page/MobileFlyoutPage.js +4 -3
  32. package/dist/components/modals/AlertModal.d.ts +1 -1
  33. package/dist/components/modals/AlertModal.js +5 -4
  34. package/dist/components/modals/ConfirmModal.d.ts +1 -1
  35. package/dist/components/modals/ConfirmModal.js +5 -4
  36. package/dist/components/modals/CustomModal.js +1 -0
  37. package/dist/components/modals/Modal.js +1 -0
  38. package/dist/components/modals/ModalBase.js +1 -0
  39. package/dist/components/modals/ModalFooter.d.ts +2 -2
  40. package/dist/components/modals/ModalFooter.js +3 -1
  41. package/dist/components/modals/Prompt.d.ts +3 -3
  42. package/dist/components/modals/Prompt.js +9 -6
  43. package/dist/components/modals/image-gallery/ImageGallery.css +24 -6
  44. package/dist/components/modals/image-gallery/ImageGallery.d.ts +1 -1
  45. package/dist/components/modals/image-gallery/ImageGallery.js +1 -0
  46. package/dist/components/modals/image-gallery/ImageGallerySwiper.js +1 -1
  47. package/dist/components/modals/image-gallery/internal/ImageGalleryContainer.d.ts +1 -1
  48. package/dist/components/pagination/Pagination.d.ts +3 -4
  49. package/dist/components/pagination/Pagination.js +17 -13
  50. package/dist/components/popovers/legend/Legend.d.ts +6 -4
  51. package/dist/components/popovers/legend/Legend.js +8 -4
  52. package/dist/components/popovers/popover/Popover.css +5 -52
  53. package/dist/components/popovers/popover/Popover.d.ts +12 -14
  54. package/dist/components/popovers/popover/Popover.js +81 -91
  55. package/dist/components/popovers/popover-menu/PopoverMenu.d.ts +6 -4
  56. package/dist/components/popovers/popover-menu/PopoverMenu.js +23 -27
  57. package/dist/components/popovers/popover-menu/PopoverMenuContext.d.ts +2 -1
  58. package/dist/components/popovers/popover-menu/PopoverMenuContext.js +1 -1
  59. package/dist/components/popovers/popover-menu/popover-menu-item/PopoverMenuItem.d.ts +9 -0
  60. package/dist/components/popovers/popover-menu/popover-menu-item/PopoverMenuItem.js +31 -0
  61. package/dist/components/popovers/tooltip/Tooltip.d.ts +4 -3
  62. package/dist/components/popovers/tooltip/Tooltip.js +7 -6
  63. package/dist/components/progress/Progress.d.ts +2 -3
  64. package/dist/components/progress/Progress.js +6 -2
  65. package/dist/components/search-input/ClearButton.d.ts +1 -2
  66. package/dist/components/search-input/ClearButton.js +5 -4
  67. package/dist/components/search-input/SearchInput.d.ts +3 -4
  68. package/dist/components/search-input/SearchInput.js +9 -5
  69. package/dist/components/snackbar/Snackbar.d.ts +4 -4
  70. package/dist/components/snackbar/Snackbar.js +11 -7
  71. package/dist/components/snackbar/SnackbarProvider.d.ts +3 -3
  72. package/dist/components/snackbar/SnackbarProvider.js +7 -4
  73. package/dist/components/stepper-horizontal/StepperHorizontal.d.ts +2 -2
  74. package/dist/components/stepper-horizontal/StepperHorizontal.js +4 -3
  75. package/dist/components/stepper-horizontal/step-horizontal/StepHorizontal.js +2 -1
  76. package/dist/components/stepper-vertical/StepperVertical.js +1 -1
  77. package/dist/components/stepper-vertical/step-vertical/StepVertical.js +1 -0
  78. package/dist/components/tab/Tabs.js +3 -3
  79. package/dist/components/tab/tab-pane/TabPane.d.ts +3 -4
  80. package/dist/components/tab/tab-pane/TabPane.js +6 -2
  81. package/dist/components/table-header-cell/TableHeaderCell.d.ts +2 -1
  82. package/dist/components/table-header-cell/TableHeaderCell.js +1 -0
  83. package/dist/forms/checkbox/Checkbox.d.ts +3 -6
  84. package/dist/forms/checkbox/Checkbox.js +5 -2
  85. package/dist/forms/combobox/ComboBox.css +124 -0
  86. package/dist/forms/combobox/ComboBox.d.ts +27 -0
  87. package/dist/forms/combobox/ComboBox.js +174 -0
  88. package/dist/forms/multi-select/MultiSelect.css +13 -0
  89. package/dist/forms/multi-select/MultiSelect.d.ts +20 -0
  90. package/dist/forms/multi-select/MultiSelect.js +192 -0
  91. package/dist/forms/radio/RadioButton.d.ts +4 -4
  92. package/dist/forms/radio/RadioButton.js +11 -10
  93. package/dist/forms/radio/RadioGroup.d.ts +4 -4
  94. package/dist/forms/radio/RadioGroup.js +1 -0
  95. package/dist/forms/segment/Segment.d.ts +4 -5
  96. package/dist/forms/segment/Segment.js +10 -9
  97. package/dist/forms/segment/segment-control/SegmentControl.d.ts +4 -8
  98. package/dist/forms/segment/segment-control/SegmentControl.js +8 -6
  99. package/dist/forms/select/Select.d.ts +16 -17
  100. package/dist/forms/select/Select.js +80 -82
  101. package/dist/forms/select/internal/SelectButton.d.ts +0 -12
  102. package/dist/forms/select/internal/SelectButton.js +0 -49
  103. package/dist/forms/select/internal/SelectButtonContent.d.ts +0 -7
  104. package/dist/forms/select/internal/SelectButtonContent.js +0 -31
  105. package/dist/forms/select/internal/SelectOptionsContainer.d.ts +0 -17
  106. package/dist/forms/select/internal/SelectOptionsContainer.js +0 -103
  107. package/dist/forms/slider/Slider.d.ts +4 -7
  108. package/dist/forms/slider/Slider.js +11 -6
  109. package/dist/forms/switch/Switch.d.ts +4 -6
  110. package/dist/forms/switch/Switch.js +12 -6
  111. package/dist/forms/text-area/TextArea.d.ts +6 -15
  112. package/dist/forms/text-area/TextArea.js +42 -25
  113. package/dist/forms/text-input/TextInput.css +31 -0
  114. package/dist/forms/text-input/TextInput.d.ts +6 -17
  115. package/dist/forms/text-input/TextInput.js +16 -25
  116. package/dist/forms/time-picker/TimePicker.d.ts +7 -6
  117. package/dist/forms/time-picker/TimePicker.js +16 -31
  118. package/dist/forms/time-picker/time-picker-dropdown/TimePickerDropdown.js +1 -0
  119. package/dist/forms/time-picker/time-picker-dropdown/TimePickerInput.js +1 -0
  120. package/dist/index.d.ts +7 -5
  121. package/dist/index.js +4 -3
  122. package/dist/utils/types.d.ts +0 -6
  123. package/dist/utils/useControlled.js +4 -4
  124. package/dist/utils/useForkRef.d.ts +2 -2
  125. package/dist/utils/useForkRef.js +2 -2
  126. package/dist/utils/useOnClickOutside.d.ts +1 -1
  127. package/package.json +17 -28
  128. package/dist/components/popovers/popover-menu-item/PopoverMenuItem.d.ts +0 -9
  129. package/dist/components/popovers/popover-menu-item/PopoverMenuItem.js +0 -29
  130. package/dist/forms/select/Select.css +0 -160
  131. package/dist/forms/select/internal/HiddenInput.d.ts +0 -8
  132. package/dist/forms/select/internal/HiddenInput.js +0 -15
  133. package/dist/forms/select/internal/ListItem.d.ts +0 -18
  134. package/dist/forms/select/internal/ListItem.js +0 -69
  135. package/dist/forms/select/internal/SelectCheckbox.d.ts +0 -4
  136. package/dist/forms/select/internal/SelectCheckbox.js +0 -13
  137. package/dist/forms/select/internal/SelectLabel.d.ts +0 -7
  138. package/dist/forms/select/internal/SelectLabel.js +0 -12
  139. package/dist/forms/select/internal/SelectScrollContainer.d.ts +0 -8
  140. package/dist/forms/select/internal/SelectScrollContainer.js +0 -15
  141. package/dist/forms/select/internal/SelectWrapper.d.ts +0 -6
  142. package/dist/forms/select/internal/SelectWrapper.js +0 -12
  143. package/dist/forms/select/internal/index.d.ts +0 -6
  144. package/dist/forms/select/internal/index.js +0 -7
  145. package/dist/forms/select/internal/utils.d.ts +0 -7
  146. package/dist/forms/select/internal/utils.js +0 -30
  147. package/dist/forms/select/select-option/SelectOption.d.ts +0 -14
  148. package/dist/forms/select/select-option/SelectOption.js +0 -12
  149. package/dist/forms/select/utils.d.ts +0 -2
  150. package/dist/forms/select/utils.js +0 -12
@@ -1,106 +1,96 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import "./Popover.css";
3
+ import { FloatingArrow, FloatingPortal, arrow, autoUpdate, flip, offset, shift, useClick, useDismiss, useFloating, useHover, useInteractions } from "@floating-ui/react";
3
4
  import classnames from "classnames";
4
- import { useRef, useState } from "react";
5
- import { usePopper } from "react-popper";
5
+ import { forwardRef, useRef } from "react";
6
6
  import { useControlled } from "../../../utils/useControlled.js";
7
7
  import { useForkRef } from "../../../utils/useForkRef.js";
8
- import { useOnClickOutside } from "../../../utils/useOnClickOutside.js";
9
- function Popover({ popoverContent, children, position, fallbackPositions, openOnHover = false, defaultOpen = false, open, onStatusChange, wrapper, className, flip = true, containerClassName, popoverClassName, stopPropagation = false, arrow = true, onClick }) {
10
- const [showPopper, setShowPopper] = useControlled({
11
- controlled: open,
12
- default: defaultOpen
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
13
12
  });
14
- const [popperElement, setPopperElement] = useState(null);
15
- const [arrowElement, setArrowElement] = useState(null);
16
- const referenceElement = useRef(null);
17
- const popperElRef = useRef(null);
18
- const combinedRef = useForkRef(popperElRef, setPopperElement);
19
- const { styles, attributes } = usePopper(referenceElement.current, popperElement, {
13
+ const arrowRef = useRef(null);
14
+ const triggerRef = useRef(null);
15
+ const handleRef = useForkRef(ref, triggerRef);
16
+ const { refs, floatingStyles, context } = useFloating({
20
17
  placement: position,
21
- modifiers: [
22
- {
23
- name: 'arrow',
24
- options: {
25
- element: arrowElement
26
- }
27
- },
28
- {
29
- name: 'offset',
30
- options: {
31
- offset: [
32
- 0,
33
- 24
34
- ]
35
- }
36
- },
37
- {
38
- name: 'flip',
39
- options: {
40
- fallbackPlacements: flip ? fallbackPositions : [
41
- position || 'auto'
42
- ]
43
- }
44
- }
45
- ]
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
46
44
  });
47
- const handleChange = (e, status)=>{
48
- if (stopPropagation) {
49
- e?.stopPropagation();
50
- e?.preventDefault();
51
- }
52
- setShowPopper(status);
53
- onStatusChange?.(status);
54
- };
55
- function closePopover(event) {
56
- handleChange(event, false);
57
- }
58
- useOnClickOutside(popperElRef, closePopover, referenceElement);
59
- function handleKeyDown(event) {
60
- if ('Enter' === event.key) handleChange(void 0, true);
61
- if ('Escape' === event.key) handleChange(void 0, false);
62
- }
63
- function handleKeyUp(event) {
64
- if (' ' === event.key) handleChange(void 0, true);
65
- }
66
- function handleTriggerClick(event) {
67
- onClick?.(event);
68
- if (event.defaultPrevented) setShowPopper(!showPopper);
69
- else handleChange(event, !showPopper);
70
- }
71
- const childrenWrapper = /*#__PURE__*/ jsx("div", {
72
- tabIndex: 0,
73
- role: "button",
74
- className: className,
75
- ref: referenceElement,
76
- onKeyDown: handleKeyDown,
77
- onKeyUp: handleKeyUp,
78
- onClick: handleTriggerClick,
79
- onMouseEnter: openOnHover ? (e)=>handleChange(e, true) : void 0,
80
- onMouseLeave: openOnHover ? (e)=>handleChange(e, false) : void 0,
81
- children: children
45
+ const hover = useHover(context, {
46
+ enabled: openOnHover
82
47
  });
48
+ const { getReferenceProps, getFloatingProps } = useInteractions([
49
+ dismiss,
50
+ click,
51
+ hover
52
+ ]);
83
53
  return /*#__PURE__*/ jsxs(Fragment, {
84
54
  children: [
85
- wrapper ? wrapper(childrenWrapper) : childrenWrapper,
86
- showPopper && /*#__PURE__*/ jsxs("div", {
87
- className: classnames('fwe-popover-container', containerClassName),
88
- ref: combinedRef,
89
- style: styles.popper,
90
- ...attributes.popper,
91
- children: [
92
- /*#__PURE__*/ jsx("div", {
93
- className: classnames('fwe-popover', popoverClassName),
94
- children: popoverContent
95
- }),
96
- arrow && /*#__PURE__*/ jsx("div", {
97
- ref: setArrowElement,
98
- style: styles.arrow,
99
- id: "arrow"
100
- })
101
- ]
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: (event)=>{
65
+ if (stopPropagation) event.stopPropagation();
66
+ onTriggerClick?.(event);
67
+ }
68
+ }),
69
+ children: children
70
+ }),
71
+ showPopover && /*#__PURE__*/ jsx(FloatingPortal, {
72
+ children: /*#__PURE__*/ jsxs("div", {
73
+ className: "fwe-popover-container",
74
+ ref: refs.setFloating,
75
+ style: floatingStyles,
76
+ ...getFloatingProps(),
77
+ children: [
78
+ showArrow && /*#__PURE__*/ jsx(FloatingArrow, {
79
+ ref: arrowRef,
80
+ context: context,
81
+ fill: "white",
82
+ width: 16,
83
+ height: 8
84
+ }),
85
+ /*#__PURE__*/ jsx("div", {
86
+ className: classnames('fwe-popover', containerClassName),
87
+ children: content
88
+ })
89
+ ]
90
+ })
102
91
  })
103
92
  ]
104
93
  });
105
- }
94
+ });
95
+ Popover.displayName = 'Popover';
106
96
  export { Popover };
@@ -1,7 +1,9 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import { type PopoverProps } from '../popover/Popover';
3
- import { type PopoverMenuItemProps } from '../popover-menu-item/PopoverMenuItem';
4
- export interface PopoverMenuProps extends Omit<PopoverProps, 'popoverContent' | 'open' | 'onStatusChange'> {
5
- menu: PopoverMenuItemProps[] | ReactNode[];
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
6
  }
7
- export declare function PopoverMenu({ menu, ...props }: Readonly<PopoverMenuProps>): import("react/jsx-runtime").JSX.Element;
7
+ export declare const PopoverMenu: (props: PopoverMenuProps & {
8
+ children?: ReactNode | undefined;
9
+ } & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null;
@@ -1,37 +1,33 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import classnames from "classnames";
3
- import { useMemo, useState } from "react";
3
+ import { forwardRef, useMemo, useState } from "react";
4
4
  import { Popover } from "../popover/Popover.js";
5
- import { PopoverMenuItem } from "../popover-menu-item/PopoverMenuItem.js";
6
5
  import { PopoverMenuContext } from "./PopoverMenuContext.js";
7
- function PopoverMenu({ menu, ...props }) {
8
- const [showPopper, setShowPopper] = useState(false);
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
9
  const isPopoverMenuItemPropsArray = (items)=>Array.isArray(items) && items.length > 0 && 'text' in items[0];
10
10
  let content = null;
11
- content = isPopoverMenuItemPropsArray(menu) ? menu.map((item)=>/*#__PURE__*/ jsx(PopoverMenuItem, {
12
- item: item
13
- }, item.text)) : menu;
14
- const popoverMenuContext = useMemo(()=>({
15
- setShowPopper
11
+ content = isPopoverMenuItemPropsArray(items) ? items.map((item)=>/*#__PURE__*/ jsx(PopoverMenuItem, {
12
+ ...item
13
+ }, item.text)) : items;
14
+ const popoverMenuContextValue = useMemo(()=>({
15
+ setShowPopoverMenu: setShowPopoverMenu
16
16
  }), []);
17
- return /*#__PURE__*/ jsx("div", {
18
- className: classnames('fwe-popover-menu-trigger', props.className),
19
- children: /*#__PURE__*/ jsx(PopoverMenuContext.Provider, {
20
- value: popoverMenuContext,
21
- children: /*#__PURE__*/ jsx(Popover, {
22
- popoverClassName: "fwe-popover--menu",
23
- popoverContent: content,
24
- position: "right",
25
- open: showPopper,
26
- onStatusChange: setShowPopper,
27
- ...props,
28
- children: /*#__PURE__*/ jsx("div", {
29
- "data-testid": "fwe-popover-menu-trigger-button",
30
- className: "fwe-popover-menu-trigger-button",
31
- children: props.children
32
- })
33
- })
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
34
29
  })
35
30
  });
36
- }
31
+ });
32
+ PopoverMenu.displayName = 'PopoverMenu';
37
33
  export { PopoverMenu };
@@ -1,3 +1,4 @@
1
+ import { type Dispatch, type SetStateAction } from 'react';
1
2
  export declare const PopoverMenuContext: import("react").Context<{
2
- setShowPopper: React.Dispatch<React.SetStateAction<boolean>>;
3
+ setShowPopoverMenu: Dispatch<SetStateAction<boolean>>;
3
4
  }>;
@@ -1,5 +1,5 @@
1
1
  import { createContext } from "react";
2
2
  const PopoverMenuContext = createContext({
3
- setShowPopper: ()=>{}
3
+ setShowPopoverMenu: ()=>{}
4
4
  });
5
5
  export { PopoverMenuContext };
@@ -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 };
@@ -1,5 +1,6 @@
1
1
  import type { PopoverProps } from '../popover/Popover';
2
- export interface TooltipProps extends Omit<PopoverProps, 'popoverContent' | 'openOnHover'> {
3
- title: React.ReactNode;
2
+ export interface TooltipProps extends Omit<PopoverProps, 'openOnHover'> {
4
3
  }
5
- export declare function Tooltip({ title, ...props }: Readonly<TooltipProps>): import("react/jsx-runtime").JSX.Element;
4
+ export declare const Tooltip: (props: TooltipProps & {
5
+ children?: import("react").ReactNode | undefined;
6
+ } & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null;
@@ -1,12 +1,13 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
2
3
  import { Popover } from "../popover/Popover.js";
3
- function Tooltip({ title, ...props }) {
4
- return /*#__PURE__*/ jsx(Popover, {
4
+ const Tooltip = /*#__PURE__*/ forwardRef(({ content, children, ...props }, ref)=>/*#__PURE__*/ jsx(Popover, {
5
5
  position: "bottom",
6
- popoverContent: title,
7
6
  openOnHover: true,
7
+ content: content,
8
+ ref: ref,
8
9
  ...props,
9
- children: props.children
10
- });
11
- }
10
+ children: children
11
+ }));
12
+ Tooltip.displayName = 'Tooltip';
12
13
  export { Tooltip };
@@ -1,7 +1,6 @@
1
- import type { ClassNameProps } from '../../utils/types';
2
- export interface ProgressProps extends ClassNameProps {
1
+ export interface ProgressProps extends React.ComponentPropsWithoutRef<'div'> {
3
2
  readonly progress: number;
4
3
  readonly background?: 'white' | 'black' | 'background';
5
4
  readonly error?: boolean;
6
5
  }
7
- export declare function Progress({ background, error, progress, className, }: ProgressProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare const Progress: (props: ProgressProps & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null;
@@ -1,6 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import classnames from "classnames";
3
- function Progress({ background = 'white', error = false, progress, className }) {
3
+ import { forwardRef } from "react";
4
+ const Progress = /*#__PURE__*/ forwardRef(({ background = 'white', error = false, progress, className, ...props }, ref)=>{
4
5
  const classes = classnames('fwe-progress-bar', {
5
6
  'fwe-bg-red': error
6
7
  }, {
@@ -10,6 +11,8 @@ function Progress({ background = 'white', error = false, progress, className })
10
11
  });
11
12
  return /*#__PURE__*/ jsx("div", {
12
13
  className: classnames('fwe-progress', className),
14
+ ref: ref,
15
+ ...props,
13
16
  children: /*#__PURE__*/ jsx("div", {
14
17
  className: classes,
15
18
  role: "progressbar",
@@ -22,5 +25,6 @@ function Progress({ background = 'white', error = false, progress, className })
22
25
  "aria-label": "progressbar"
23
26
  })
24
27
  });
25
- }
28
+ });
29
+ Progress.displayName = 'Progress';
26
30
  export { Progress };
@@ -1,2 +1 @@
1
- import type { ComponentPropsWithoutRef } from 'react';
2
- export declare function ClearButton(props: ComponentPropsWithoutRef<'button'>): import("react/jsx-runtime").JSX.Element;
1
+ export declare const ClearButton: (props: Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>) => React.ReactElement | null;
@@ -1,10 +1,11 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- function ClearButton(props) {
3
- return /*#__PURE__*/ jsx("button", {
2
+ import { forwardRef } from "react";
3
+ const ClearButton = /*#__PURE__*/ forwardRef((props, ref)=>/*#__PURE__*/ jsx("button", {
4
4
  type: "button",
5
5
  className: "fwe-clear-icon fr-search-input-clear-button",
6
6
  "aria-label": "Clear",
7
+ ref: ref,
7
8
  ...props
8
- });
9
- }
9
+ }));
10
+ ClearButton.displayName = 'ClearButton';
10
11
  export { ClearButton };
@@ -1,7 +1,7 @@
1
1
  import './SearchInput.scss';
2
+ import { type ComponentPropsWithoutRef } from 'react';
2
3
  import type { SearchSuggestion } from './SearchSuggestion';
3
- export interface SearchInputProps {
4
- readonly disabled?: boolean;
4
+ export interface SearchInputProps extends Omit<ComponentPropsWithoutRef<'input'>, 'onChange' | 'value' | 'defaultValue'> {
5
5
  readonly label?: string;
6
6
  readonly defaultValue?: string;
7
7
  readonly value?: string;
@@ -9,6 +9,5 @@ export interface SearchInputProps {
9
9
  readonly onChange?: (value: string) => void;
10
10
  readonly onKeyboardNavigate?: (value: string) => void;
11
11
  readonly onSearch?: (value: string) => void;
12
- readonly className?: string;
13
12
  }
14
- export declare function SearchInput({ defaultValue, disabled, label, value, suggestions, onChange, onSearch, onKeyboardNavigate, className, }: SearchInputProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare const SearchInput: (props: SearchInputProps & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null;
@@ -1,19 +1,21 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import "./SearchInput.css";
3
3
  import classnames from "classnames";
4
- import { useRef } from "react";
4
+ import { forwardRef, useRef } from "react";
5
+ import { useForkRef } from "../../utils/useForkRef.js";
5
6
  import { useOnClickOutside } from "../../utils/useOnClickOutside.js";
6
7
  import { ClearButton } from "./ClearButton.js";
7
8
  import { useSearchInput } from "./useSearchInput.js";
8
- function SearchInput({ defaultValue, disabled, label, value, suggestions, onChange, onSearch, onKeyboardNavigate, className }) {
9
+ const SearchInput = /*#__PURE__*/ forwardRef(({ defaultValue, disabled, label, value, suggestions, onChange, onSearch, onKeyboardNavigate, className, ...props }, ref)=>{
9
10
  const inputRef = useRef(null);
10
11
  const containerRef = useRef(null);
12
+ const handleRef = useForkRef(ref, containerRef);
11
13
  const cappedSuggestions = suggestions?.slice(0, 10) ?? [];
12
14
  const { handleFocus, handleInput, handleClearQuery, handleSuggestionClick, handleOutsideClick, handleKeyDown, hideSuggestionList, selectedSuggestionIndex, innerValue } = useSearchInput(inputRef, cappedSuggestions, value, defaultValue, onChange, onSearch, onKeyboardNavigate);
13
15
  useOnClickOutside(containerRef, handleOutsideClick);
14
16
  return /*#__PURE__*/ jsxs("div", {
15
17
  className: classnames('fwe-search-input', className),
16
- ref: containerRef,
18
+ ref: handleRef,
17
19
  children: [
18
20
  /*#__PURE__*/ jsx("input", {
19
21
  ref: inputRef,
@@ -24,7 +26,8 @@ function SearchInput({ defaultValue, disabled, label, value, suggestions, onChan
24
26
  "aria-label": "Search",
25
27
  onInput: handleInput,
26
28
  onKeyDown: handleKeyDown,
27
- value: innerValue
29
+ value: innerValue,
30
+ ...props
28
31
  }),
29
32
  /*#__PURE__*/ jsx("div", {
30
33
  className: "fwe-search-icon"
@@ -57,5 +60,6 @@ function SearchInput({ defaultValue, disabled, label, value, suggestions, onChan
57
60
  })
58
61
  ]
59
62
  });
60
- }
63
+ });
64
+ SearchInput.displayName = 'SearchInput';
61
65
  export { SearchInput };
@@ -1,6 +1,5 @@
1
1
  import './Snackbar.scss';
2
- import type { ClassNameProps } from '../../utils/types';
3
- export interface SnackbarConfig extends ClassNameProps {
2
+ export interface SnackbarConfig {
4
3
  type?: 'info' | 'warning' | 'error';
5
4
  variant?: 'a' | 'b' | 'c';
6
5
  darkBackground?: boolean;
@@ -8,14 +7,15 @@ export interface SnackbarConfig extends ClassNameProps {
8
7
  action?: string;
9
8
  disappearAfter?: number | null;
10
9
  key?: string | number;
10
+ 'data-testid'?: string;
11
11
  }
12
12
  export interface SnackbarData extends SnackbarConfig {
13
13
  text: string;
14
14
  }
15
- export interface SnackbarProps {
15
+ export interface SnackbarProps extends React.ComponentPropsWithoutRef<'div'> {
16
16
  readonly data?: SnackbarData;
17
17
  readonly onAction?: () => void;
18
18
  readonly onClose?: () => void;
19
19
  readonly first?: boolean;
20
20
  }
21
- export declare function Snackbar(props: SnackbarProps): import("react/jsx-runtime").JSX.Element;
21
+ export declare const Snackbar: (props: SnackbarProps & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null;
@@ -1,12 +1,13 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import "./Snackbar.css";
3
3
  import classnames from "classnames";
4
- import { useEffect, useRef, useState } from "react";
4
+ import { forwardRef, useEffect, useRef, useState } from "react";
5
5
  import { CSSTransition } from "react-transition-group";
6
- function Snackbar(props) {
7
- const { data, onAction, onClose, first = false } = props;
6
+ import { useForkRef } from "../../utils/useForkRef.js";
7
+ const Snackbar = /*#__PURE__*/ forwardRef(({ data, onAction, onClose, first = false, className, ...props }, ref)=>{
8
8
  const [show, setShow] = useState(true);
9
9
  const nodeRef = useRef(null);
10
+ const handleRef = useForkRef(ref, nodeRef);
10
11
  useEffect(()=>{
11
12
  let disappearAfter = 5000;
12
13
  if (data?.disappearAfter !== null) {
@@ -34,8 +35,9 @@ function Snackbar(props) {
34
35
  classNames: classes,
35
36
  appear: true,
36
37
  children: /*#__PURE__*/ jsx("div", {
37
- ref: nodeRef,
38
- className: classes,
38
+ ref: handleRef,
39
+ className: classnames(classes, className),
40
+ ...props,
39
41
  children: /*#__PURE__*/ jsxs("div", {
40
42
  className: classnames({
41
43
  'fwe-snackbar': true,
@@ -45,7 +47,8 @@ function Snackbar(props) {
45
47
  'fwe-snackbar-warning': data?.type === 'warning',
46
48
  'fwe-snackbar-error': data?.type === 'error',
47
49
  'fwe-snackbar-shadow': data?.darkBackground
48
- }, data?.className),
50
+ }),
51
+ "data-testid": data?.['data-testid'],
49
52
  children: [
50
53
  /*#__PURE__*/ jsx("span", {
51
54
  children: data?.text
@@ -74,5 +77,6 @@ function Snackbar(props) {
74
77
  })
75
78
  })
76
79
  });
77
- }
80
+ });
81
+ Snackbar.displayName = 'Snackbar';
78
82
  export { Snackbar };
@@ -1,7 +1,7 @@
1
- import type { ClassNamePropsWithChildren } from '../../utils/types';
1
+ import type React from 'react';
2
2
  import { type SnackbarConfig, type SnackbarData } from './Snackbar';
3
- export interface SnackbarProviderProps extends ClassNamePropsWithChildren {
3
+ export interface SnackbarProviderProps extends React.ComponentPropsWithoutRef<'div'> {
4
4
  readonly config?: SnackbarConfig;
5
5
  }
6
- export declare function SnackbarProvider(props: SnackbarProviderProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare const SnackbarProvider: (props: SnackbarProviderProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
7
7
  export declare const addSnackbar: (snackData: SnackbarData, onAction?: () => void, onClose?: () => void) => string | number;
@@ -1,13 +1,13 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import classnames from "classnames";
3
- import { useCallback, useMemo, useState } from "react";
3
+ import { forwardRef, useCallback, useMemo, useState } from "react";
4
4
  import { Snackbar } from "./Snackbar.js";
5
5
  import { SnackbarContext } from "./SnackbarContext.js";
6
6
  let addSnackbarFunction;
7
- function SnackbarProvider(props) {
7
+ const SnackbarProvider = /*#__PURE__*/ forwardRef((props, ref)=>{
8
8
  const { config = {
9
9
  darkBackground: true
10
- }, children, className } = props;
10
+ }, children, className, ...rest } = props;
11
11
  const [snacks, setSnacks] = useState([]);
12
12
  const addSnackbar = useCallback((snackData, onAction, onClose)=>{
13
13
  const key = snackData.key ?? Date.now() + Math.random();
@@ -49,6 +49,8 @@ function SnackbarProvider(props) {
49
49
  children,
50
50
  /*#__PURE__*/ jsx("div", {
51
51
  className: classnames('fwe-snackbar-container', className),
52
+ ref: ref,
53
+ ...rest,
52
54
  children: snacks.map((snack)=>/*#__PURE__*/ jsx(Snackbar, {
53
55
  data: snack.data,
54
56
  onAction: ()=>snack.onAction ? snack.onAction() : void 0,
@@ -58,9 +60,10 @@ function SnackbarProvider(props) {
58
60
  })
59
61
  ]
60
62
  });
61
- }
63
+ });
62
64
  const SnackbarProvider_addSnackbar = (snackData, onAction, onClose)=>{
63
65
  if (!addSnackbarFunction) throw new Error('SnackbarProvider is not mounted.');
64
66
  return addSnackbarFunction(snackData, onAction, onClose);
65
67
  };
68
+ SnackbarProvider.displayName = 'SnackbarProvider';
66
69
  export { SnackbarProvider, SnackbarProvider_addSnackbar as addSnackbar };
@@ -1,7 +1,7 @@
1
1
  import './StepperHorizontal.scss';
2
2
  import React, { type ComponentPropsWithoutRef } from 'react';
3
- export interface StepperHorizontalProps extends Omit<ComponentPropsWithoutRef<'button'>, 'onChange'> {
3
+ export interface StepperHorizontalProps extends Omit<ComponentPropsWithoutRef<'div'>, 'onChange'> {
4
4
  stepIndex?: number;
5
5
  onChange?: (stepIndex: number) => void;
6
6
  }
7
- export declare const StepperHorizontal: (props: StepperHorizontalProps & React.RefAttributes<HTMLButtonElement>) => React.ReactElement | null;
7
+ export declare const StepperHorizontal: (props: StepperHorizontalProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
@@ -13,10 +13,11 @@ const StepperHorizontal = /*#__PURE__*/ forwardRef(({ children, className, stepI
13
13
  return /*#__PURE__*/ jsxs(Fragment, {
14
14
  children: [
15
15
  /*#__PURE__*/ jsx("div", {
16
- className: "fwe-stepper-horizontal",
16
+ className: classnames('fwe-stepper-horizontal', className),
17
+ ref: ref,
18
+ ...props,
17
19
  children: stepComponents?.map((step, i)=>/*#__PURE__*/ jsx("button", {
18
20
  type: "button",
19
- ref: ref,
20
21
  className: classnames('fwe-step-container fr-step-container', {
21
22
  'fwe-step-done': stepIndex > i,
22
23
  'fwe-step-active': i === stepIndex
@@ -25,7 +26,6 @@ const StepperHorizontal = /*#__PURE__*/ forwardRef(({ children, className, stepI
25
26
  disabled: stepIndex <= i,
26
27
  "aria-label": `Step ${i + 1}: ${step.props.title}`,
27
28
  "aria-current": i === stepIndex ? 'step' : void 0,
28
- ...props,
29
29
  children: /*#__PURE__*/ jsxs("div", {
30
30
  className: "fwe-step",
31
31
  children: [
@@ -45,4 +45,5 @@ const StepperHorizontal = /*#__PURE__*/ forwardRef(({ children, className, stepI
45
45
  ]
46
46
  });
47
47
  });
48
+ StepperHorizontal.displayName = 'StepperHorizontal';
48
49
  export { StepperHorizontal };