@rio-cloud/rio-uikit 1.7.1 → 1.9.0

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 (248) hide show
  1. package/BarList.d.ts +2 -0
  2. package/BarList.js +2 -0
  3. package/README.md +4 -0
  4. package/SaveableDateInput.d.ts +2 -0
  5. package/SaveableDateInput.js +2 -0
  6. package/SvgImage.d.ts +2 -0
  7. package/SvgImage.js +2 -0
  8. package/TableCol.d.ts +2 -0
  9. package/TableCol.js +2 -0
  10. package/TableHead.d.ts +2 -0
  11. package/TableHead.js +2 -0
  12. package/components/actionBarItem/ActionBarItemIcon.js +1 -1
  13. package/components/actionBarItem/ActionBarOverlay.js +1 -1
  14. package/components/activity/Activity.d.ts +2 -2
  15. package/components/applicationHeader/CollapsedNavItem.js +1 -0
  16. package/components/assetTree/Tree.d.ts +20 -0
  17. package/components/assetTree/Tree.js +75 -38
  18. package/components/assetTree/TreeLeaf.js +1 -1
  19. package/components/assetTree/TreeNodeContainer.d.ts +1 -1
  20. package/components/assetTree/TreeSearch.js +1 -1
  21. package/components/assetTree/TreeSummary.js +1 -1
  22. package/components/assetTree/TypeCounter.d.ts +2 -0
  23. package/components/assetTree/TypeCounter.js +1 -1
  24. package/components/assetTree/useTreeExpansion.d.ts +4 -0
  25. package/components/assetTree/useTreeExpansion.js +25 -0
  26. package/components/assetTree/useTreeHeight.d.ts +1 -0
  27. package/components/assetTree/useTreeHeight.js +60 -0
  28. package/components/assetTree/useTreeScrollPosition.d.ts +3 -0
  29. package/components/assetTree/useTreeScrollPosition.js +19 -0
  30. package/components/assetTree/useTreeVirtualization.d.ts +17 -0
  31. package/components/assetTree/useTreeVirtualization.js +71 -0
  32. package/components/autosuggest/AutoSuggest.js +2 -1
  33. package/components/barList/BarList.d.ts +97 -0
  34. package/components/barList/BarList.js +42 -0
  35. package/components/barList/useSortedBars.d.ts +2 -0
  36. package/components/barList/useSortedBars.js +14 -0
  37. package/components/button/ButtonToolbar.d.ts +1 -1
  38. package/components/button/ButtonToolbar.js +1 -1
  39. package/components/button/ToggleButton.js +0 -1
  40. package/components/charts/PieChart.js +1 -1
  41. package/components/clearableInput/ClearableInput.d.ts +20 -7
  42. package/components/clearableInput/ClearableInput.js +68 -8
  43. package/components/dialog/Dialog.js +1 -1
  44. package/components/dialog/FrameDialog.js +1 -1
  45. package/components/dropdown/ButtonDropdown.d.ts +11 -3
  46. package/components/dropdown/ButtonDropdown.js +79 -64
  47. package/components/dropdown/DropdownToggleButton.d.ts +7 -4
  48. package/components/dropdown/DropdownToggleButton.js +11 -3
  49. package/components/formLabel/FormLabel.d.ts +2 -2
  50. package/components/formLabel/FormLabel.js +1 -1
  51. package/components/listMenu/ListMenu.js +4 -1
  52. package/components/map/components/Map.js +21 -6
  53. package/components/map/components/constants.d.ts +2 -0
  54. package/components/map/components/constants.js +3 -0
  55. package/components/map/components/features/basics/InfoBubble.js +1 -1
  56. package/components/map/components/features/layers/overlayLayers/IncidentsLayer.js +1 -1
  57. package/components/map/utils/mapTypes.d.ts +5 -0
  58. package/components/map/utils/rendering.d.ts +5 -2
  59. package/components/map/utils/rendering.js +46 -39
  60. package/components/menuItems/MenuItem.js +1 -1
  61. package/components/notification/Notification.js +1 -1
  62. package/components/overlay/OverlayTrigger.js +3 -3
  63. package/components/saveableInput/SaveableDateInput.d.ts +83 -0
  64. package/components/saveableInput/SaveableDateInput.js +122 -0
  65. package/components/selects/BaseSelectDropdown.js +1 -1
  66. package/components/selects/Multiselect.d.ts +8 -0
  67. package/components/selects/Multiselect.js +4 -4
  68. package/components/smoothScrollbars/SmoothScrollbars.d.ts +1 -0
  69. package/components/smoothScrollbars/SmoothScrollbars.js +3 -3
  70. package/components/statsWidget/StatsWidget.d.ts +2 -2
  71. package/components/statsWidget/StatsWidgets.d.ts +2 -2
  72. package/components/svgImage/SvgElement.d.ts +8 -0
  73. package/components/svgImage/SvgElement.js +11 -0
  74. package/components/svgImage/SvgImage.d.ts +30 -0
  75. package/components/svgImage/SvgImage.js +20 -0
  76. package/components/svgImage/svgConverter.d.ts +17 -0
  77. package/components/svgImage/svgConverter.js +78 -0
  78. package/components/svgImage/useSvgLoader.d.ts +9 -0
  79. package/components/svgImage/useSvgLoader.js +43 -0
  80. package/components/switch/Switch.d.ts +4 -0
  81. package/components/switch/Switch.js +5 -6
  82. package/components/table/TableCardsSorting.d.ts +0 -1
  83. package/components/table/TableCol.d.ts +18 -0
  84. package/components/table/TableCol.js +11 -0
  85. package/components/table/TableHead.d.ts +33 -0
  86. package/components/table/TableHead.js +11 -0
  87. package/components/table/TableSettingsDialog.js +1 -1
  88. package/components/tag/Tag.js +1 -1
  89. package/components/timepicker/TimePicker.d.ts +1 -2
  90. package/components/timepicker/TimePicker.js +35 -8
  91. package/components/tooltip/SimpleTooltip.d.ts +1 -1
  92. package/components/virtualList/VirtualList.js +1 -1
  93. package/hooks/useIsFocusWithin.d.ts +33 -0
  94. package/hooks/useIsFocusWithin.js +55 -0
  95. package/hooks/useLocationSuggestions.d.ts +27 -0
  96. package/hooks/useLocationSuggestions.js +94 -0
  97. package/hooks/useOnboarding.d.ts +17 -5
  98. package/hooks/useOnboarding.js +7 -1
  99. package/hooks/usePostMessage.js +0 -1
  100. package/hooks/useSearch.d.ts +63 -0
  101. package/hooks/useSearch.js +73 -0
  102. package/hooks/useSorting.d.ts +6 -0
  103. package/hooks/useSorting.js +7 -4
  104. package/hooks/useTableExport.d.ts +49 -0
  105. package/hooks/useTableExport.js +57 -0
  106. package/hooks/useTableSelection.d.ts +166 -0
  107. package/hooks/useTableSelection.js +201 -0
  108. package/lib/es/BarList.d.ts +2 -0
  109. package/lib/es/BarList.js +7 -0
  110. package/lib/es/SaveableDateInput.d.ts +2 -0
  111. package/lib/es/SaveableDateInput.js +7 -0
  112. package/lib/es/SvgImage.d.ts +2 -0
  113. package/lib/es/SvgImage.js +7 -0
  114. package/lib/es/TableCol.d.ts +2 -0
  115. package/lib/es/TableCol.js +7 -0
  116. package/lib/es/TableHead.d.ts +2 -0
  117. package/lib/es/TableHead.js +7 -0
  118. package/lib/es/components/actionBarItem/ActionBarItemIcon.js +1 -1
  119. package/lib/es/components/actionBarItem/ActionBarOverlay.js +1 -1
  120. package/lib/es/components/activity/Activity.d.ts +2 -2
  121. package/lib/es/components/applicationHeader/CollapsedNavItem.js +1 -0
  122. package/lib/es/components/assetTree/Tree.d.ts +20 -0
  123. package/lib/es/components/assetTree/Tree.js +74 -37
  124. package/lib/es/components/assetTree/TreeLeaf.js +1 -1
  125. package/lib/es/components/assetTree/TreeNodeContainer.d.ts +1 -1
  126. package/lib/es/components/assetTree/TreeSearch.js +1 -1
  127. package/lib/es/components/assetTree/TreeSummary.js +1 -1
  128. package/lib/es/components/assetTree/TypeCounter.d.ts +2 -0
  129. package/lib/es/components/assetTree/TypeCounter.js +1 -1
  130. package/lib/es/components/assetTree/useTreeExpansion.d.ts +4 -0
  131. package/lib/es/components/assetTree/useTreeExpansion.js +29 -0
  132. package/lib/es/components/assetTree/useTreeHeight.d.ts +1 -0
  133. package/lib/es/components/assetTree/useTreeHeight.js +64 -0
  134. package/lib/es/components/assetTree/useTreeScrollPosition.d.ts +3 -0
  135. package/lib/es/components/assetTree/useTreeScrollPosition.js +23 -0
  136. package/lib/es/components/assetTree/useTreeVirtualization.d.ts +17 -0
  137. package/lib/es/components/assetTree/useTreeVirtualization.js +76 -0
  138. package/lib/es/components/autosuggest/AutoSuggest.js +2 -1
  139. package/lib/es/components/barList/BarList.d.ts +97 -0
  140. package/lib/es/components/barList/BarList.js +45 -0
  141. package/lib/es/components/barList/useSortedBars.d.ts +2 -0
  142. package/lib/es/components/barList/useSortedBars.js +17 -0
  143. package/lib/es/components/button/ButtonToolbar.d.ts +1 -1
  144. package/lib/es/components/button/ButtonToolbar.js +1 -1
  145. package/lib/es/components/button/ToggleButton.js +0 -1
  146. package/lib/es/components/charts/PieChart.js +1 -1
  147. package/lib/es/components/clearableInput/ClearableInput.d.ts +20 -7
  148. package/lib/es/components/clearableInput/ClearableInput.js +67 -7
  149. package/lib/es/components/dialog/Dialog.js +1 -1
  150. package/lib/es/components/dialog/FrameDialog.js +1 -1
  151. package/lib/es/components/dropdown/ButtonDropdown.d.ts +11 -3
  152. package/lib/es/components/dropdown/ButtonDropdown.js +79 -64
  153. package/lib/es/components/dropdown/DropdownToggleButton.d.ts +7 -4
  154. package/lib/es/components/dropdown/DropdownToggleButton.js +11 -3
  155. package/lib/es/components/formLabel/FormLabel.d.ts +2 -2
  156. package/lib/es/components/formLabel/FormLabel.js +1 -1
  157. package/lib/es/components/listMenu/ListMenu.js +4 -1
  158. package/lib/es/components/map/components/Map.js +20 -5
  159. package/lib/es/components/map/components/constants.d.ts +2 -0
  160. package/lib/es/components/map/components/constants.js +4 -1
  161. package/lib/es/components/map/components/features/basics/InfoBubble.js +1 -1
  162. package/lib/es/components/map/components/features/layers/overlayLayers/IncidentsLayer.js +1 -1
  163. package/lib/es/components/map/utils/mapTypes.d.ts +5 -0
  164. package/lib/es/components/map/utils/rendering.d.ts +5 -2
  165. package/lib/es/components/map/utils/rendering.js +46 -39
  166. package/lib/es/components/menuItems/MenuItem.js +1 -1
  167. package/lib/es/components/notification/Notification.js +1 -1
  168. package/lib/es/components/overlay/OverlayTrigger.js +3 -3
  169. package/lib/es/components/saveableInput/SaveableDateInput.d.ts +83 -0
  170. package/lib/es/components/saveableInput/SaveableDateInput.js +125 -0
  171. package/lib/es/components/selects/BaseSelectDropdown.js +1 -1
  172. package/lib/es/components/selects/Multiselect.d.ts +8 -0
  173. package/lib/es/components/selects/Multiselect.js +4 -4
  174. package/lib/es/components/smoothScrollbars/SmoothScrollbars.d.ts +1 -0
  175. package/lib/es/components/smoothScrollbars/SmoothScrollbars.js +3 -3
  176. package/lib/es/components/statsWidget/StatsWidget.d.ts +2 -2
  177. package/lib/es/components/statsWidget/StatsWidgets.d.ts +2 -2
  178. package/lib/es/components/svgImage/SvgElement.d.ts +8 -0
  179. package/lib/es/components/svgImage/SvgElement.js +14 -0
  180. package/lib/es/components/svgImage/SvgImage.d.ts +30 -0
  181. package/lib/es/components/svgImage/SvgImage.js +23 -0
  182. package/lib/es/components/svgImage/svgConverter.d.ts +17 -0
  183. package/lib/es/components/svgImage/svgConverter.js +84 -0
  184. package/lib/es/components/svgImage/useSvgLoader.d.ts +9 -0
  185. package/lib/es/components/svgImage/useSvgLoader.js +48 -0
  186. package/lib/es/components/switch/Switch.d.ts +4 -0
  187. package/lib/es/components/switch/Switch.js +5 -6
  188. package/lib/es/components/table/TableCardsSorting.d.ts +0 -1
  189. package/lib/es/components/table/TableCol.d.ts +18 -0
  190. package/lib/es/components/table/TableCol.js +13 -0
  191. package/lib/es/components/table/TableHead.d.ts +33 -0
  192. package/lib/es/components/table/TableHead.js +14 -0
  193. package/lib/es/components/table/TableSettingsDialog.js +1 -1
  194. package/lib/es/components/tag/Tag.js +1 -1
  195. package/lib/es/components/timepicker/TimePicker.d.ts +1 -2
  196. package/lib/es/components/timepicker/TimePicker.js +35 -8
  197. package/lib/es/components/tooltip/SimpleTooltip.d.ts +1 -1
  198. package/lib/es/components/virtualList/VirtualList.js +1 -1
  199. package/lib/es/hooks/useIsFocusWithin.d.ts +33 -0
  200. package/lib/es/hooks/useIsFocusWithin.js +57 -0
  201. package/lib/es/hooks/useLocationSuggestions.d.ts +27 -0
  202. package/lib/es/hooks/useLocationSuggestions.js +97 -0
  203. package/lib/es/hooks/useOnboarding.d.ts +17 -5
  204. package/lib/es/hooks/useOnboarding.js +7 -1
  205. package/lib/es/hooks/usePostMessage.js +0 -1
  206. package/lib/es/hooks/useSearch.d.ts +63 -0
  207. package/lib/es/hooks/useSearch.js +75 -0
  208. package/lib/es/hooks/useSorting.d.ts +6 -0
  209. package/lib/es/hooks/useSorting.js +7 -4
  210. package/lib/es/hooks/useTableExport.d.ts +49 -0
  211. package/lib/es/hooks/useTableExport.js +59 -0
  212. package/lib/es/hooks/useTableSelection.d.ts +166 -0
  213. package/lib/es/hooks/useTableSelection.js +210 -0
  214. package/lib/es/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js +1 -1
  215. package/lib/es/useIsFocusWithin.d.ts +2 -0
  216. package/lib/es/useIsFocusWithin.js +7 -0
  217. package/lib/es/useLocationSuggestions.d.ts +2 -0
  218. package/lib/es/useLocationSuggestions.js +7 -0
  219. package/lib/es/useSearch.d.ts +2 -0
  220. package/lib/es/useSearch.js +7 -0
  221. package/lib/es/useTableExport.d.ts +2 -0
  222. package/lib/es/useTableExport.js +7 -0
  223. package/lib/es/useTableSelection.d.ts +2 -0
  224. package/lib/es/useTableSelection.js +7 -0
  225. package/lib/es/utils/storageUtils.d.ts +2 -2
  226. package/lib/es/utils/storageUtils.js +2 -0
  227. package/lib/es/utils/urlFeatureToggles.d.ts +12 -6
  228. package/lib/es/utils/urlFeatureToggles.js +14 -8
  229. package/lib/es/utils/useDropDirection.js +1 -0
  230. package/lib/es/version.json +1 -1
  231. package/package.json +48 -40
  232. package/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js +1 -1
  233. package/useIsFocusWithin.d.ts +2 -0
  234. package/useIsFocusWithin.js +2 -0
  235. package/useLocationSuggestions.d.ts +2 -0
  236. package/useLocationSuggestions.js +2 -0
  237. package/useSearch.d.ts +2 -0
  238. package/useSearch.js +2 -0
  239. package/useTableExport.d.ts +2 -0
  240. package/useTableExport.js +2 -0
  241. package/useTableSelection.d.ts +2 -0
  242. package/useTableSelection.js +2 -0
  243. package/utils/storageUtils.d.ts +2 -2
  244. package/utils/storageUtils.js +2 -0
  245. package/utils/urlFeatureToggles.d.ts +12 -6
  246. package/utils/urlFeatureToggles.js +10 -7
  247. package/utils/useDropDirection.js +1 -0
  248. package/version.json +1 -1
@@ -0,0 +1,97 @@
1
+ import React from 'react';
2
+ import { type SortDirectionType } from '../../utils/SortUtils';
3
+ export type BarListRow<T> = T & {
4
+ key?: string;
5
+ href?: string;
6
+ value: number;
7
+ name: string;
8
+ color?: string;
9
+ barColor?: string;
10
+ background?: string;
11
+ };
12
+ /**
13
+ * Props for the BarList component.
14
+ *
15
+ * @template T - The type of the custom data associated with each bar row.
16
+ */
17
+ type BarListProps<T = unknown> = React.HTMLAttributes<HTMLDivElement> & {
18
+ /**
19
+ * Array of bar row data to be rendered.
20
+ */
21
+ data: BarListRow<T>[];
22
+ /**
23
+ * Optional function to format the numeric value displayed on the right side of each bar.
24
+ * Can return a string or a React element.
25
+ *
26
+ * @example
27
+ * valueFormatter={(value) => `${value}%`}
28
+ */
29
+ valueFormatter?: (value: number) => string | React.ReactElement;
30
+ /**
31
+ * A reference value used to calculate relative widths.
32
+ * If not provided, the maximum value in `data` will be used.
33
+ *
34
+ * @default max(data.value)
35
+ */
36
+ referenceValue?: number;
37
+ /**
38
+ * Whether to animate the bar width transitions using Framer Motion.
39
+ *
40
+ * @default false
41
+ */
42
+ showAnimation?: boolean;
43
+ /**
44
+ * Callback fired when a bar is clicked.
45
+ *
46
+ * @param payload - The full data object of the clicked bar.
47
+ */
48
+ onSelectRow?: (payload: BarListRow<T>) => void;
49
+ /**
50
+ * The sort order for the bars. Options are 'asc', 'desc', or 'none'.
51
+ *
52
+ * @default 'none'
53
+ */
54
+ sortOrder?: SortDirectionType | 'none';
55
+ /**
56
+ * Height of each bar row in pixels.
57
+ *
58
+ * @default 32
59
+ */
60
+ rowHeight?: number;
61
+ /**
62
+ * Opacity applied to non-hovered bars (between 0 and 1).
63
+ *
64
+ * @default 0.5
65
+ */
66
+ opacity?: number;
67
+ /**
68
+ * CSS color string used for the active/progress portion of each bar.
69
+ *
70
+ * @default 'bg-highlight-light'
71
+ */
72
+ barColor?: string;
73
+ /**
74
+ * CSS color string used for the text labels.
75
+ *
76
+ * @default 'text-color-darker'
77
+ */
78
+ labelColor?: string;
79
+ /**
80
+ * CSS color string used for the bar background.
81
+ *
82
+ * @default 'bg-transparent'
83
+ */
84
+ background?: string;
85
+ /**
86
+ * Additional className added to the wrapper element.
87
+ */
88
+ className?: string;
89
+ };
90
+ declare const BarListInner: {
91
+ <T>(props: BarListProps<T>, forwardedRef: React.ForwardedRef<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
92
+ displayName: string;
93
+ };
94
+ declare const BarList: <T>(props: BarListProps<T> & {
95
+ ref?: React.ForwardedRef<HTMLDivElement>;
96
+ }) => ReturnType<typeof BarListInner>;
97
+ export default BarList;
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useMemo } from 'react';
3
+ import classNames from 'classnames';
4
+ import { motion } from 'framer-motion';
5
+ import { SortDirection } from '../../utils/SortUtils';
6
+ import { useSortedBars } from './useSortedBars';
7
+ // Animation variants
8
+ const containerVariants = {
9
+ animate: {
10
+ transition: {
11
+ staggerChildren: 0.1,
12
+ },
13
+ },
14
+ };
15
+ const barVariants = {
16
+ initial: { width: 0 },
17
+ animate: (width) => ({
18
+ width: `${width}%`,
19
+ transition: { duration: 0.8, ease: 'easeOut' },
20
+ }),
21
+ };
22
+ const DEFAULT_ROW_HEIGHT = 25;
23
+ const DEFAULT_OPACITY = 0.5;
24
+ const BarListInner = (props, forwardedRef) => {
25
+ const { data = [], valueFormatter = value => value.toString(), showAnimation = false, onSelectRow, referenceValue, sortOrder = SortDirection.DESCENDING, barColor = 'bg-highlight-light', labelColor = 'text-color-darker', background = 'bg-transparent', rowHeight = DEFAULT_ROW_HEIGHT, opacity = DEFAULT_OPACITY, className = '', ...remainingProps } = props;
26
+ const sortedData = useSortedBars(data, sortOrder, item => item.value);
27
+ const [hoveredIndex, setHoveredIndex] = React.useState(null);
28
+ const widths = useMemo(() => {
29
+ const base = referenceValue ?? Math.max(...sortedData.map(item => item.value), 0);
30
+ return sortedData.map(item => (base === 0 || item.value === 0 ? 0 : Math.max((item.value / base) * 100, 2)));
31
+ }, [sortedData, referenceValue]);
32
+ return (_jsxs("div", { ...remainingProps, ref: forwardedRef, className: classNames('display-flex justify-content-between gap-15', className), children: [_jsx(motion.div, { variants: showAnimation ? containerVariants : undefined, initial: 'initial', animate: 'animate', className: 'width-100pct space-y-5', children: sortedData.map((item, index) => {
33
+ const width = widths[index];
34
+ const itemLabelColor = item.color ?? labelColor;
35
+ const itemBarColor = item.barColor ?? barColor;
36
+ const itemBackground = item.background ?? background;
37
+ return (_jsxs("div", { onMouseEnter: () => setHoveredIndex(index), onMouseLeave: () => setHoveredIndex(null), onClick: () => onSelectRow?.(item), className: classNames('position-relative width-100pct rounded-small', 'transition-all transition-ease-in-out transition-duration-01', itemBackground, onSelectRow && 'cursor-pointer', hoveredIndex === index && 'bg-lightest'), children: [_jsx(motion.div, { custom: width, variants: showAnimation ? barVariants : undefined, className: classNames('display-flex align-items-center rounded-small', 'transition-all transition-ease-in-out transition-duration-01', itemBarColor), style: { height: `${rowHeight}px`, opacity: hoveredIndex === index ? 1 : opacity }, role: 'presentation' }), _jsx("div", { className: 'position-absolute left-0 top-50pct translate-y-50pct display-flex width-100pct padding-left-10', children: item.href ? (_jsx("a", { href: item.href, className: itemLabelColor, target: '_blank', rel: 'noreferrer', onClick: event => event.stopPropagation(), children: item.name })) : (_jsx("div", { className: itemLabelColor, children: item.name })) })] }, item.key ?? item.name));
38
+ }) }), _jsx("div", { className: 'space-y-5', children: sortedData.map(item => (_jsx("div", { className: classNames('display-flex align-items-center justify-content-end'), style: { height: `${rowHeight}px` }, children: _jsx("div", { className: 'text-color-darkest', children: valueFormatter(item.value) }) }, item.key ?? item.name))) })] }));
39
+ };
40
+ BarListInner.displayName = 'BarList';
41
+ const BarList = React.forwardRef(BarListInner);
42
+ export default BarList;
@@ -0,0 +1,2 @@
1
+ import { type SortDirectionType } from '../../utils/SortUtils';
2
+ export declare function useSortedBars<T>(data: T[], sortOrder: SortDirectionType | 'none', getValue: (item: T) => number): T[];
@@ -0,0 +1,14 @@
1
+ import { useMemo } from 'react';
2
+ import { SortDirection } from '../../utils/SortUtils';
3
+ export function useSortedBars(data, sortOrder, getValue) {
4
+ return useMemo(() => {
5
+ if (sortOrder === 'none') {
6
+ return data;
7
+ }
8
+ return [...data].sort((a, b) => {
9
+ const aVal = getValue(a);
10
+ const bVal = getValue(b);
11
+ return sortOrder === SortDirection.ASCENDING ? aVal - bVal : bVal - aVal;
12
+ });
13
+ }, [data, sortOrder, getValue]);
14
+ }
@@ -3,7 +3,7 @@ export type ButtonToolbarProps = ComponentProps<'div'> & {
3
3
  /**
4
4
  * Align buttons to a defined side or set them apart.
5
5
  */
6
- alignment?: 'left' | 'right' | 'space-between';
6
+ alignment?: 'left' | 'right' | 'center' | 'space-between';
7
7
  /**
8
8
  * Additional classes set to the outer element.
9
9
  */
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import classNames from 'classnames';
3
3
  const ButtonToolbar = (props) => {
4
4
  const { className = '', alignment, children, ...remainingProps } = props;
5
- const classes = classNames(className, 'btn-toolbar', alignment === 'left' && 'justify-content-start', alignment === 'right' && 'justify-content-end', alignment === 'space-between' && 'justify-content-between');
5
+ const classes = classNames(className, 'btn-toolbar', alignment === 'left' && 'justify-content-start', alignment === 'right' && 'justify-content-end', alignment === 'center' && 'justify-content-center', alignment === 'space-between' && 'justify-content-between');
6
6
  return (_jsx("div", { ...remainingProps, className: classes, children: children }));
7
7
  };
8
8
  export default ButtonToolbar;
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import Button from './Button';
3
- // @ts-ignore - the Button throws TS error due to refs that may be checked at a later point in time
4
3
  const ToggleButton = (props) => _jsx(Button, { ...props, asToggle: true });
5
4
  export default ToggleButton;
@@ -14,7 +14,7 @@ const renderCustomInnerLabel = (dataUnit) => ({ cx, cy, midAngle, innerRadius, o
14
14
  };
15
15
  const PieChart = (props) => {
16
16
  const { width, height, innerRadius, outerRadius, data = [], dataKey = 'value', dataUnit = '', nameKey = 'name', color, filled = false, labels = true, innerLabels = false, paddingAngle = 3, legend = _jsx(RechartsLegend, {}), tooltip = true, pieOptions, containerOptions, ...remainingProps } = props;
17
- // biome-ignore lint/suspicious/noExplicitAny:
17
+ // biome-ignore lint/suspicious/noExplicitAny: unknown type
18
18
  const renderLabels = (entry) => `${isFunction(dataKey) ? dataKey(entry) : entry[dataKey]} ${dataUnit}`;
19
19
  const pieLabel = labels && (innerLabels ? renderCustomInnerLabel(dataUnit) : renderLabels);
20
20
  const tooltipProps = isObject(tooltip) ? tooltip.props : {};
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  export declare const DEFAULT_TYPE = "text";
3
3
  export declare const SUPPORTED_TYPES: string[];
4
+ export type MaskVisibility = 'always' | 'onFocus' | 'never';
4
5
  export type ClearableInputProps = {
5
6
  /**
6
7
  * Gives the input element the id.
@@ -69,7 +70,7 @@ export type ClearableInputProps = {
69
70
  * @param event
70
71
  * @returns
71
72
  */
72
- onFocus?: (event: React.MouseEvent<HTMLSpanElement>) => void;
73
+ onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
73
74
  /**
74
75
  * Callback function for when the value is cleared via the clear button.
75
76
  * @param event
@@ -93,22 +94,24 @@ export type ClearableInputProps = {
93
94
  * It defines the pattern that should be followed.
94
95
  *
95
96
  * For more details on masking, checkout the third party documentation for the
96
- * input mask here: {@link https://github.com/sanniassin/react-input-mask}
97
+ * input mask here: {@link https://imask.js.org/guide.html}
97
98
  *
98
99
  * Simple masks can be defined as strings.
99
100
  *
100
101
  * The following characters will define mask format:
101
102
  *
102
- * Character: "9" = allowed input: "0-9"
103
+ * Character: "0" = allowed input: "0-9" (digit)
103
104
  *
104
- * Character: "a" = allowed input: "a-z, A-Z"
105
+ * Character: "a" = allowed input: "a-z, A-Z" (letter)
105
106
  *
106
- * Character: "*" = allowed input: 0-9, a-z, A-Z
107
+ * Character: "*" = allowed input: any character
107
108
  *
108
- * Any format character can be escaped with a backslash.
109
+ * Character: "#" = allowed input: "0-9, a-z, A-Z" (digit or letter)
110
+ *
111
+ * Any other character in the mask is considered a fixed value.
109
112
  *
110
113
  * @example
111
- * '-- *** *** ***' or '+4\\9 99 999 99'
114
+ * '-- ### ### ###' or '+49 00 000 00'
112
115
  *
113
116
  * @example
114
117
  * ['0', '0', /[0-9]/, ' ', /[a-zA-Z]/]
@@ -127,11 +130,21 @@ export type ClearableInputProps = {
127
130
  * @default false
128
131
  */
129
132
  disabled?: boolean;
133
+ /**
134
+ * Controls when the mask pattern is visible.
135
+ * - 'always': Mask is always visible
136
+ * - 'onFocus': Mask is hidden but shown when input is focused (default)
137
+ * - 'never': Mask is never shown
138
+ *
139
+ * @default 'always'
140
+ */
141
+ maskVisibility?: MaskVisibility;
130
142
  /**
131
143
  * Whether mask prefix and placeholder should be displayed when input is empty and
132
144
  * has no focus.
133
145
  *
134
146
  * @default false
147
+ * @deprecated please use maskVisibility='always' instead
135
148
  */
136
149
  alwaysShowMask?: boolean;
137
150
  /**
@@ -1,23 +1,45 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState, forwardRef } from 'react';
2
+ // biome-ignore lint/style/useImportType: <explanation>
3
+ import { useState, forwardRef, useRef } from 'react';
3
4
  import omit from 'lodash/fp/omit';
4
5
  import isNil from 'lodash/fp/isNil';
5
6
  import isEmpty from 'lodash/fp/isEmpty';
6
7
  import classNames from 'classnames';
7
8
  import isFunction from 'lodash/fp/isFunction';
8
9
  import noop from 'lodash/fp/noop';
9
- import InputMask from 'react-input-mask';
10
+ import { IMaskInput } from 'react-imask';
10
11
  import usePrevious from '../../hooks/usePrevious';
12
+ import useMergeRefs from '../../hooks/useMergeRefs';
11
13
  export const DEFAULT_TYPE = 'text';
12
14
  export const SUPPORTED_TYPES = ['text', 'password', 'email'];
13
15
  const hasValue = (value) => !isEmpty(`${value}`);
14
16
  const ClearableInput = forwardRef((props, ref) => {
15
- const { type = DEFAULT_TYPE, defaultValue, value, maxLength, tabIndex = 0, hasError = false, inputRef, autoComplete, onChange = noop, onBlur = noop, onFocus = noop, onClear = noop, onKeyPress = noop, onClick = noop, mask, maskPlaceholder = '_', alwaysShowMask = false, inputClassName = '', disabled = false, className = '', children, ...remainingProps } = props;
17
+ const { type = DEFAULT_TYPE, defaultValue, value, maxLength, tabIndex = 0, hasError = false, inputRef, autoComplete, onChange = noop, onBlur = noop, onFocus = noop, onClear = noop, onKeyPress = noop, onClick = noop, mask, maskPlaceholder = '_', maskVisibility = 'always', alwaysShowMask = false, inputClassName = '', disabled = false, className = '', children, ...remainingProps } = props;
16
18
  const initialValue = value || defaultValue || '';
17
19
  const [inputValue, setInputValue] = useState(initialValue);
18
20
  const [showClear, setShowClear] = useState(hasValue(initialValue));
21
+ const [isFocused, setIsFocused] = useState(false);
19
22
  const isControlled = !isNil(value);
23
+ const internalMaskRef = useRef(null);
24
+ const mergedInternalMaskRef = useMergeRefs(internalMaskRef, inputRef, ref);
20
25
  const hasMask = !!mask;
26
+ // Calculate if mask should be visible (lazy=false means visible, lazy=true means hidden)
27
+ const shouldShowMask = () => {
28
+ // For backward compatibility
29
+ if (alwaysShowMask) {
30
+ return true;
31
+ }
32
+ switch (maskVisibility) {
33
+ case 'always':
34
+ return true;
35
+ case 'onFocus':
36
+ return isFocused;
37
+ case 'never':
38
+ return false;
39
+ default:
40
+ return isFocused;
41
+ }
42
+ };
21
43
  // Handles new input value and saves it in the local state.
22
44
  // The value stored in the state is used for rendering.
23
45
  const changeInternalValue = (newValue = '') => {
@@ -44,6 +66,45 @@ const ClearableInput = forwardRef((props, ref) => {
44
66
  onChange(newValue, event);
45
67
  }
46
68
  };
69
+ const handleAccept = (newValue, maskRef, event) => {
70
+ if (!internalMaskRef.current) {
71
+ return;
72
+ }
73
+ // Simulate a ChangeEvent for backwards compatibility since react-imask does not return a change event itself
74
+ const syntheticEvent = {
75
+ target: internalMaskRef.current,
76
+ currentTarget: internalMaskRef.current,
77
+ // Standard synthetic event props
78
+ bubbles: true,
79
+ cancelable: true,
80
+ defaultPrevented: false,
81
+ isTrusted: true,
82
+ preventDefault: () => { },
83
+ stopPropagation: () => { },
84
+ persist: () => { },
85
+ nativeEvent: {},
86
+ type: 'change',
87
+ timeStamp: Date.now(),
88
+ };
89
+ // Set unmasked value manually if needed
90
+ // (you can use data-attributes or attach it directly)
91
+ syntheticEvent.target.unmaskedValue = maskRef.unmaskedValue;
92
+ if (isControlled) {
93
+ onChange(newValue, syntheticEvent);
94
+ }
95
+ else {
96
+ changeInternalValue(newValue);
97
+ onChange(newValue, syntheticEvent);
98
+ }
99
+ };
100
+ const handleInputFocus = (event) => {
101
+ setIsFocused(true);
102
+ onFocus(event);
103
+ };
104
+ const handleInputBlur = (event) => {
105
+ setIsFocused(false);
106
+ onBlur(event);
107
+ };
47
108
  // Will be triggered on every key press but also when pressing 'Enter' for example
48
109
  const handleKeyPress = (event) => {
49
110
  onKeyPress(event);
@@ -66,17 +127,16 @@ const ClearableInput = forwardRef((props, ref) => {
66
127
  autoComplete,
67
128
  type: inputType,
68
129
  value: inputValue,
69
- onChange: handleChange,
70
130
  onKeyPress: handleKeyPress,
71
- onBlur,
72
- onFocus,
131
+ onBlur: handleInputBlur,
132
+ onFocus: handleInputFocus,
133
+ onChange: hasMask ? undefined : handleChange, // In case of masked input, the onAccept callback is used
73
134
  onClick,
74
135
  disabled,
75
136
  maxLength: hasMask ? undefined : maxLength,
76
137
  tabIndex,
77
- ref: inputRef || ref,
78
138
  };
79
- const input = hasMask ? (_jsx(InputMask, { ...inputProps, disabled: disabled, mask: mask, maskPlaceholder: maskPlaceholder, alwaysShowMask: alwaysShowMask })) : (_jsx("input", { ...inputProps }));
139
+ const input = hasMask ? (_jsx(IMaskInput, { ...inputProps, inputRef: mergedInternalMaskRef, mask: mask, placeholderChar: maskPlaceholder, onAccept: handleAccept, lazy: !shouldShowMask(), overwrite: true })) : (_jsx("input", { ...inputProps, ref: inputRef || ref }));
80
140
  return (_jsxs("div", { className: classes, children: [children && isFunction(children) ? children(inputProps) : input, _jsx("span", { className: clearButtonClassNames, onClick: clearInputValue, children: _jsx("span", { className: 'clearButtonIcon rioglyph rioglyph-remove-sign' }) })] }));
81
141
  });
82
142
  export default ClearableInput;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- // @ts-ignore-next-line importsNotUsedAsValues
2
+ // biome-ignore lint/style/useImportType: required for JSX runtime compatibility with older toolchains
3
3
  import { useState, useRef } from 'react';
4
4
  import ReactDOM from 'react-dom';
5
5
  import classNames from 'classnames';
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- // @ts-ignore-next-line importsNotUsedAsValues
2
+ // biome-ignore lint/style/useImportType: required for JSX runtime compatibility with older toolchains
3
3
  import { useState } from 'react';
4
4
  import IframeResizer from 'iframe-resizer-react';
5
5
  import Dialog from './Dialog';
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
+ import { type DropdownToggleEvent, type DropdownToggleButtonType } from './DropdownToggleButton';
2
3
  import type { MenuItemProps as MenuItem } from '../menuItems/MenuItem';
3
4
  import type { BUTTON_SIZE, BUTTON_STYLE, BUTTON_VARIANT } from '../button/Button';
4
- export type ButtonDropdownProps = {
5
+ export type ButtonDropdownProps<T extends DropdownToggleButtonType = 'button'> = {
5
6
  /**
6
7
  * Unique button id. If not present a random id is generated.
7
8
  */
@@ -46,6 +47,13 @@ export type ButtonDropdownProps = {
46
47
  * Possible values are: `link`, `link-inline`, `outline`, `action`
47
48
  */
48
49
  variant?: BUTTON_VARIANT;
50
+ /**
51
+ * Specify the toggle element type.
52
+ * It supports the following types: "button" | "tag" | "label"
53
+ *
54
+ * @default 'button'
55
+ */
56
+ toggleButtonType?: DropdownToggleButtonType;
49
57
  /**
50
58
  * Optional prop to defines whether the dropdown title is icon only which
51
59
  * applies different padding so the button is a square.
@@ -90,7 +98,7 @@ export type ButtonDropdownProps = {
90
98
  * @param event
91
99
  * @returns
92
100
  */
93
- onOpen?: (event?: React.MouseEvent<HTMLButtonElement>) => void;
101
+ onOpen?: (event: DropdownToggleEvent<T>) => void;
94
102
  /**
95
103
  * Callback for when the toggle button was clicked to close it.
96
104
  * @returns
@@ -117,7 +125,7 @@ export type ButtonDropdownProps = {
117
125
  */
118
126
  className?: string;
119
127
  };
120
- declare const ButtonDropdown: React.ForwardRefExoticComponent<ButtonDropdownProps & {
128
+ declare const ButtonDropdown: React.ForwardRefExoticComponent<ButtonDropdownProps<"button"> & {
121
129
  children?: React.ReactNode | undefined;
122
130
  } & React.RefAttributes<HTMLButtonElement>>;
123
131
  export default ButtonDropdown;
@@ -25,71 +25,86 @@ const getPlacement = (pullRight, dropup) => {
25
25
  }
26
26
  return 'bottom-start';
27
27
  };
28
- const ButtonDropdown = forwardRef((props, ref) => {
29
- const { id = Math.random().toString(36).slice(2, 16), items = [], bsSize = 'md', bsStyle = 'default', variant, disabled = false, iconOnly = false, title, splitButton = false, customDropdown, open, dropup = false, pullRight = false, noCaret = false, onOpen = noop, onClose = noop, onLabelButtonClick = noop, usePortal = false, popperConfig, toggleClassName = '', dropdownClassName, className = '', ...remainingProps } = props;
30
- const [internalOpen, setInternalOpen] = useState(open);
31
- const [refDropdownToggle, setRefDropdownToggle] = useState(null);
32
- const [refDropdownMenu, setRefDropdownMenu] = useState(null);
33
- const [refSplitButtonToggle, setRefSplitButtonToggle] = useState(null);
34
- const defaultPopperConfig = {
35
- placement: getPlacement(pullRight, dropup),
36
- modifiers: [],
37
- };
38
- const popperParentRef = splitButton && pullRight ? refSplitButtonToggle : refDropdownToggle;
39
- const { styles, attributes } = usePopper(popperParentRef, refDropdownMenu, popperConfig || defaultPopperConfig);
40
- const isUncontrolled = isNil(open);
41
- const isOpen = isUncontrolled ? internalOpen : open;
42
- const wrapperRef = useClickOutside(event => {
43
- if (usePortal) {
44
- // In case the dropdown is rendered via portal the clickOutside the toggle button element is
45
- // triggered since the dropdown is not a child of the wrapper element.
46
- // In this case we need to check if the event target is inside the dropdown-menu and prevent closing
47
- // the dropdown
48
- if (!refDropdownMenu?.contains(event.target)) {
28
+ const createButtonDropdown = () => {
29
+ return forwardRef((props, ref) => {
30
+ const { id = Math.random().toString(36).slice(2, 16), items = [], bsSize = 'md', bsStyle = 'default', variant, disabled = false, iconOnly = false, title, splitButton = false, customDropdown, open, dropup = false, pullRight = false, noCaret = false, onOpen = noop, onClose = noop, onLabelButtonClick = noop, usePortal = false, popperConfig, toggleButtonType = 'button', toggleClassName = '', dropdownClassName, className = '', ...remainingProps } = props;
31
+ const [internalOpen, setInternalOpen] = useState(open);
32
+ const [refDropdownToggle, setRefDropdownToggle] = useState(null);
33
+ const [refDropdownMenu, setRefDropdownMenu] = useState(null);
34
+ const [refSplitButtonToggle, setRefSplitButtonToggle] = useState(null);
35
+ const defaultPopperConfig = {
36
+ placement: getPlacement(pullRight, dropup),
37
+ modifiers: [],
38
+ };
39
+ const popperParentRef = splitButton && pullRight ? refSplitButtonToggle : refDropdownToggle;
40
+ const { styles, attributes } = usePopper(popperParentRef, refDropdownMenu, popperConfig || defaultPopperConfig);
41
+ const isUncontrolled = isNil(open);
42
+ const isOpen = isUncontrolled ? internalOpen : open;
43
+ const wrapperRef = useClickOutside(event => {
44
+ if (usePortal) {
45
+ // In case the dropdown is rendered via portal the clickOutside the toggle button element is
46
+ // triggered since the dropdown is not a child of the wrapper element.
47
+ // In this case we need to check if the event target is inside the dropdown-menu and prevent closing
48
+ // the dropdown
49
+ if (!refDropdownMenu?.contains(event.target)) {
50
+ closeMenu();
51
+ }
52
+ }
53
+ else {
49
54
  closeMenu();
50
55
  }
51
- }
52
- else {
53
- closeMenu();
54
- }
55
- }, DEFAULT_EVENT_TYPES, Boolean(isOpen) // only listen to clicks outside when the dropdown is open
56
- );
57
- const dropdownRoot = getOrCreatePortalRoot();
58
- const shouldShowCaret = !noCaret && !splitButton && !iconOnly;
59
- useEffect(() => {
60
- if (!isUncontrolled) {
61
- setInternalOpen(open);
62
- }
63
- }, [isUncontrolled, open]);
64
- const toggleOpen = (event) => {
65
- const isDropdownOpen = isUncontrolled ? internalOpen : open;
66
- if (isDropdownOpen) {
56
+ }, DEFAULT_EVENT_TYPES, Boolean(isOpen) // only listen to clicks outside when the dropdown is open
57
+ );
58
+ const dropdownRoot = getOrCreatePortalRoot();
59
+ const shouldShowCaret = !noCaret && !splitButton && !iconOnly;
60
+ useEffect(() => {
61
+ if (!isUncontrolled) {
62
+ setInternalOpen(open);
63
+ }
64
+ }, [isUncontrolled, open]);
65
+ const toggleOpen = (event) => {
66
+ const isDropdownOpen = isUncontrolled ? internalOpen : open;
67
+ if (isDropdownOpen) {
68
+ closeMenu();
69
+ }
70
+ else {
71
+ openMenu(event);
72
+ }
73
+ };
74
+ const openMenu = (event) => {
75
+ if (isUncontrolled) {
76
+ setInternalOpen(true);
77
+ }
78
+ if (event) {
79
+ onOpen(event);
80
+ }
81
+ };
82
+ const closeMenu = () => {
83
+ if (isUncontrolled) {
84
+ setInternalOpen(false);
85
+ }
86
+ onClose();
87
+ };
88
+ const handleSplitLabelButtonClick = () => {
67
89
  closeMenu();
68
- }
69
- else {
70
- openMenu(event);
71
- }
72
- };
73
- const openMenu = (event) => {
74
- if (isUncontrolled) {
75
- setInternalOpen(true);
76
- }
77
- onOpen(event);
78
- };
79
- const closeMenu = () => {
80
- if (isUncontrolled) {
81
- setInternalOpen(false);
82
- }
83
- onClose();
84
- };
85
- const handleSplitLabelButtonClick = () => {
86
- closeMenu();
87
- onLabelButtonClick();
88
- };
89
- const handleDropdownButtonClick = splitButton ? handleSplitLabelButtonClick : toggleOpen;
90
- const wrapperClasses = classNames('dropdown', 'btn-group', isOpen && 'open', className);
91
- const dropdownClasses = classNames(usePortal && 'dropdown-portal', splitButton && pullRight && 'pull-right', dropdownClassName);
92
- const dropdownMenu = (_jsx(MenuItemList, { className: dropdownClasses, ref: setRefDropdownMenu, style: styles.popper, ...attributes.popper, children: customDropdown ? customDropdown : _jsx(MenuItems, { items: items, closeMenu: toggleOpen }) }));
93
- return (_jsxs("div", { ...remainingProps, className: wrapperClasses, ref: wrapperRef, children: [_jsx(DropdownToggleButton, { id: id, splitButton: splitButton, bsStyle: bsStyle, bsSize: bsSize, variant: variant, iconOnly: iconOnly, disabled: disabled, ref: setRefDropdownToggle, onClick: handleDropdownButtonClick, outerRef: ref, className: toggleClassName, children: _jsxs(_Fragment, { children: [title, shouldShowCaret && _jsx(Caret, {})] }) }), splitButton && (_jsx(SplitCaretButton, { id: id, bsStyle: bsStyle, bsSize: bsSize, disabled: disabled, className: toggleClassName, onClick: toggleOpen, ref: setRefSplitButtonToggle })), isOpen && usePortal && ReactDOM.createPortal(dropdownMenu, dropdownRoot), isOpen && !usePortal && dropdownMenu] }));
94
- });
90
+ onLabelButtonClick();
91
+ };
92
+ const handleSplitCaretButtonClick = (event) => {
93
+ toggleOpen(event);
94
+ };
95
+ const handleDropdownButtonClick = (event) => {
96
+ if (splitButton) {
97
+ handleSplitLabelButtonClick();
98
+ }
99
+ else {
100
+ toggleOpen(event);
101
+ }
102
+ };
103
+ const wrapperClasses = classNames('dropdown', 'btn-group', isOpen && 'open', className);
104
+ const dropdownClasses = classNames(usePortal && 'dropdown-portal', splitButton && pullRight && 'pull-right', dropdownClassName);
105
+ const dropdownMenu = (_jsx(MenuItemList, { className: dropdownClasses, ref: setRefDropdownMenu, style: styles.popper, ...attributes.popper, children: customDropdown ? customDropdown : _jsx(MenuItems, { items: items, closeMenu: toggleOpen }) }));
106
+ return (_jsxs("div", { ...remainingProps, className: wrapperClasses, ref: wrapperRef, children: [_jsx(DropdownToggleButton, { id: id, splitButton: splitButton, bsStyle: bsStyle, bsSize: bsSize, variant: variant, iconOnly: iconOnly, disabled: disabled, ref: setRefDropdownToggle, onClick: handleDropdownButtonClick, outerRef: ref, toggleButtonType: toggleButtonType, className: toggleClassName, children: _jsxs(_Fragment, { children: [title, shouldShowCaret && _jsx(Caret, {})] }) }), splitButton && (_jsx(SplitCaretButton, { id: id, bsStyle: bsStyle, bsSize: bsSize, disabled: disabled, className: toggleClassName, onClick: handleSplitCaretButtonClick, ref: setRefSplitButtonToggle })), isOpen && usePortal && ReactDOM.createPortal(dropdownMenu, dropdownRoot), isOpen && !usePortal && dropdownMenu] }));
107
+ });
108
+ };
109
+ const ButtonDropdown = createButtonDropdown();
95
110
  export default ButtonDropdown;
@@ -1,16 +1,19 @@
1
- import React, { type HTMLProps } from 'react';
1
+ import { type HTMLProps, type PropsWithChildren } from 'react';
2
2
  import { type BUTTON_VARIANT, type BUTTON_SIZE, type BUTTON_STYLE } from '../button/Button';
3
+ export type DropdownToggleButtonType = 'button' | 'tag' | 'label';
4
+ export type DropdownToggleEvent<T extends DropdownToggleButtonType = 'button'> = T extends 'button' ? React.MouseEvent<HTMLButtonElement> : React.MouseEvent<HTMLDivElement>;
3
5
  export type DropdownToggleButtonProps = HTMLProps<HTMLButtonElement> & {
4
6
  id?: string;
5
7
  disabled?: boolean;
6
8
  splitButton?: boolean;
7
9
  iconOnly?: boolean;
8
- onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
10
+ onClick: (event: React.MouseEvent<HTMLButtonElement | HTMLDivElement>) => void;
9
11
  bsSize: BUTTON_SIZE;
10
12
  bsStyle: BUTTON_STYLE;
11
13
  variant?: BUTTON_VARIANT;
12
- outerRef?: React.Ref<HTMLButtonElement>;
14
+ toggleButtonType?: DropdownToggleButtonType;
15
+ outerRef?: React.Ref<HTMLButtonElement | HTMLDivElement>;
13
16
  className?: string;
14
17
  };
15
- declare const DropdownToggleButton: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<DropdownToggleButtonProps>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
18
+ declare const DropdownToggleButton: import("react").ForwardRefExoticComponent<Omit<PropsWithChildren<DropdownToggleButtonProps>, "ref"> & import("react").RefAttributes<HTMLDivElement | HTMLButtonElement>>;
16
19
  export default DropdownToggleButton;