@rio-cloud/rio-uikit 1.7.0 → 1.8.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 (176) hide show
  1. package/README.md +4 -0
  2. package/SvgImage.d.ts +2 -0
  3. package/SvgImage.js +2 -0
  4. package/TableCol.d.ts +2 -0
  5. package/TableCol.js +2 -0
  6. package/TableHead.d.ts +2 -0
  7. package/TableHead.js +2 -0
  8. package/components/actionBarItem/ActionBarItemIcon.js +1 -1
  9. package/components/actionBarItem/ActionBarOverlay.js +1 -1
  10. package/components/applicationHeader/CollapsedNavItem.js +1 -0
  11. package/components/assetTree/Tree.d.ts +8 -0
  12. package/components/assetTree/Tree.js +4 -2
  13. package/components/assetTree/TreeLeaf.js +1 -1
  14. package/components/assetTree/TreeSearch.js +1 -1
  15. package/components/assetTree/TreeSummary.js +1 -1
  16. package/components/assetTree/TypeCounter.d.ts +2 -0
  17. package/components/assetTree/TypeCounter.js +1 -1
  18. package/components/autosuggest/AutoSuggest.js +2 -1
  19. package/components/banner/Banner.d.ts +6 -0
  20. package/components/banner/Banner.js +33 -8
  21. package/components/button/ButtonToolbar.d.ts +1 -1
  22. package/components/button/ButtonToolbar.js +1 -1
  23. package/components/button/ToggleButton.js +0 -1
  24. package/components/clearableInput/ClearableInput.d.ts +20 -7
  25. package/components/clearableInput/ClearableInput.js +68 -8
  26. package/components/dialog/Dialog.js +1 -1
  27. package/components/dialog/FrameDialog.js +1 -1
  28. package/components/dropdown/ButtonDropdown.d.ts +11 -3
  29. package/components/dropdown/ButtonDropdown.js +79 -64
  30. package/components/dropdown/DropdownToggleButton.d.ts +7 -4
  31. package/components/dropdown/DropdownToggleButton.js +11 -3
  32. package/components/formLabel/FormLabel.js +24 -4
  33. package/components/listMenu/ListMenu.js +8 -4
  34. package/components/map/components/Map.js +1 -1
  35. package/components/map/components/features/basics/InfoBubble.js +1 -1
  36. package/components/map/components/features/layers/overlayLayers/IncidentsLayer.js +1 -1
  37. package/components/mapMarker/SingleMapMarker.js +1 -1
  38. package/components/menuItems/MenuItem.js +1 -1
  39. package/components/notification/Notification.js +1 -1
  40. package/components/overlay/OverlayTrigger.js +1 -1
  41. package/components/selects/BaseSelectDropdown.js +1 -1
  42. package/components/selects/Multiselect.d.ts +8 -0
  43. package/components/selects/Multiselect.js +4 -4
  44. package/components/smoothScrollbars/SmoothScrollbars.js +1 -1
  45. package/components/svgImage/SvgElement.d.ts +8 -0
  46. package/components/svgImage/SvgElement.js +11 -0
  47. package/components/svgImage/SvgImage.d.ts +30 -0
  48. package/components/svgImage/SvgImage.js +20 -0
  49. package/components/svgImage/svgConverter.d.ts +17 -0
  50. package/components/svgImage/svgConverter.js +78 -0
  51. package/components/svgImage/useSvgLoader.d.ts +9 -0
  52. package/components/svgImage/useSvgLoader.js +43 -0
  53. package/components/switch/Switch.d.ts +4 -0
  54. package/components/switch/Switch.js +5 -6
  55. package/components/table/TableCardsSorting.d.ts +0 -1
  56. package/components/table/TableCol.d.ts +18 -0
  57. package/components/table/TableCol.js +11 -0
  58. package/components/table/TableHead.d.ts +33 -0
  59. package/components/table/TableHead.js +11 -0
  60. package/components/table/TableSettingsDialog.js +1 -1
  61. package/components/tag/Tag.js +1 -1
  62. package/components/timepicker/TimePicker.d.ts +1 -2
  63. package/components/timepicker/TimePicker.js +35 -8
  64. package/components/virtualList/VirtualList.js +1 -1
  65. package/hooks/useLocationSuggestions.d.ts +27 -0
  66. package/hooks/useLocationSuggestions.js +94 -0
  67. package/hooks/useOnboarding.d.ts +17 -5
  68. package/hooks/useOnboarding.js +7 -1
  69. package/hooks/usePostMessage.js +0 -1
  70. package/hooks/useSearch.d.ts +63 -0
  71. package/hooks/useSearch.js +73 -0
  72. package/hooks/useSorting.d.ts +6 -0
  73. package/hooks/useSorting.js +7 -4
  74. package/hooks/useTableSelection.d.ts +151 -0
  75. package/hooks/useTableSelection.js +196 -0
  76. package/lib/es/SvgImage.d.ts +2 -0
  77. package/lib/es/SvgImage.js +7 -0
  78. package/lib/es/TableCol.d.ts +2 -0
  79. package/lib/es/TableCol.js +7 -0
  80. package/lib/es/TableHead.d.ts +2 -0
  81. package/lib/es/TableHead.js +7 -0
  82. package/lib/es/components/actionBarItem/ActionBarItemIcon.js +1 -1
  83. package/lib/es/components/actionBarItem/ActionBarOverlay.js +1 -1
  84. package/lib/es/components/applicationHeader/CollapsedNavItem.js +1 -0
  85. package/lib/es/components/assetTree/Tree.d.ts +8 -0
  86. package/lib/es/components/assetTree/Tree.js +4 -2
  87. package/lib/es/components/assetTree/TreeLeaf.js +1 -1
  88. package/lib/es/components/assetTree/TreeSearch.js +1 -1
  89. package/lib/es/components/assetTree/TreeSummary.js +1 -1
  90. package/lib/es/components/assetTree/TypeCounter.d.ts +2 -0
  91. package/lib/es/components/assetTree/TypeCounter.js +1 -1
  92. package/lib/es/components/autosuggest/AutoSuggest.js +2 -1
  93. package/lib/es/components/banner/Banner.d.ts +6 -0
  94. package/lib/es/components/banner/Banner.js +31 -6
  95. package/lib/es/components/button/ButtonToolbar.d.ts +1 -1
  96. package/lib/es/components/button/ButtonToolbar.js +1 -1
  97. package/lib/es/components/button/ToggleButton.js +0 -1
  98. package/lib/es/components/clearableInput/ClearableInput.d.ts +20 -7
  99. package/lib/es/components/clearableInput/ClearableInput.js +67 -7
  100. package/lib/es/components/dialog/Dialog.js +1 -1
  101. package/lib/es/components/dialog/FrameDialog.js +1 -1
  102. package/lib/es/components/dropdown/ButtonDropdown.d.ts +11 -3
  103. package/lib/es/components/dropdown/ButtonDropdown.js +79 -64
  104. package/lib/es/components/dropdown/DropdownToggleButton.d.ts +7 -4
  105. package/lib/es/components/dropdown/DropdownToggleButton.js +11 -3
  106. package/lib/es/components/formLabel/FormLabel.js +24 -4
  107. package/lib/es/components/listMenu/ListMenu.js +7 -3
  108. package/lib/es/components/map/components/Map.js +1 -1
  109. package/lib/es/components/map/components/features/basics/InfoBubble.js +1 -1
  110. package/lib/es/components/map/components/features/layers/overlayLayers/IncidentsLayer.js +1 -1
  111. package/lib/es/components/mapMarker/SingleMapMarker.js +1 -1
  112. package/lib/es/components/menuItems/MenuItem.js +1 -1
  113. package/lib/es/components/notification/Notification.js +1 -1
  114. package/lib/es/components/overlay/OverlayTrigger.js +1 -1
  115. package/lib/es/components/selects/BaseSelectDropdown.js +1 -1
  116. package/lib/es/components/selects/Multiselect.d.ts +8 -0
  117. package/lib/es/components/selects/Multiselect.js +4 -4
  118. package/lib/es/components/smoothScrollbars/SmoothScrollbars.js +1 -1
  119. package/lib/es/components/svgImage/SvgElement.d.ts +8 -0
  120. package/lib/es/components/svgImage/SvgElement.js +14 -0
  121. package/lib/es/components/svgImage/SvgImage.d.ts +30 -0
  122. package/lib/es/components/svgImage/SvgImage.js +25 -0
  123. package/lib/es/components/svgImage/svgConverter.d.ts +17 -0
  124. package/lib/es/components/svgImage/svgConverter.js +84 -0
  125. package/lib/es/components/svgImage/useSvgLoader.d.ts +9 -0
  126. package/lib/es/components/svgImage/useSvgLoader.js +48 -0
  127. package/lib/es/components/switch/Switch.d.ts +4 -0
  128. package/lib/es/components/switch/Switch.js +5 -6
  129. package/lib/es/components/table/TableCardsSorting.d.ts +0 -1
  130. package/lib/es/components/table/TableCol.d.ts +18 -0
  131. package/lib/es/components/table/TableCol.js +13 -0
  132. package/lib/es/components/table/TableHead.d.ts +33 -0
  133. package/lib/es/components/table/TableHead.js +14 -0
  134. package/lib/es/components/table/TableSettingsDialog.js +1 -1
  135. package/lib/es/components/tag/Tag.js +1 -1
  136. package/lib/es/components/timepicker/TimePicker.d.ts +1 -2
  137. package/lib/es/components/timepicker/TimePicker.js +35 -8
  138. package/lib/es/components/virtualList/VirtualList.js +1 -1
  139. package/lib/es/hooks/useLocationSuggestions.d.ts +27 -0
  140. package/lib/es/hooks/useLocationSuggestions.js +97 -0
  141. package/lib/es/hooks/useOnboarding.d.ts +17 -5
  142. package/lib/es/hooks/useOnboarding.js +7 -1
  143. package/lib/es/hooks/usePostMessage.js +0 -1
  144. package/lib/es/hooks/useSearch.d.ts +63 -0
  145. package/lib/es/hooks/useSearch.js +75 -0
  146. package/lib/es/hooks/useSorting.d.ts +6 -0
  147. package/lib/es/hooks/useSorting.js +7 -4
  148. package/lib/es/hooks/useTableSelection.d.ts +151 -0
  149. package/lib/es/hooks/useTableSelection.js +205 -0
  150. package/lib/es/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js +1 -1
  151. package/lib/es/useLocationSuggestions.d.ts +2 -0
  152. package/lib/es/useLocationSuggestions.js +7 -0
  153. package/lib/es/useSearch.d.ts +2 -0
  154. package/lib/es/useSearch.js +7 -0
  155. package/lib/es/useTableSelection.d.ts +2 -0
  156. package/lib/es/useTableSelection.js +7 -0
  157. package/lib/es/utils/storageUtils.d.ts +2 -2
  158. package/lib/es/utils/storageUtils.js +2 -0
  159. package/lib/es/utils/urlFeatureToggles.d.ts +12 -6
  160. package/lib/es/utils/urlFeatureToggles.js +14 -8
  161. package/lib/es/utils/useDropDirection.js +1 -0
  162. package/lib/es/version.json +1 -1
  163. package/package.json +36 -39
  164. package/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js +1 -1
  165. package/useLocationSuggestions.d.ts +2 -0
  166. package/useLocationSuggestions.js +2 -0
  167. package/useSearch.d.ts +2 -0
  168. package/useSearch.js +2 -0
  169. package/useTableSelection.d.ts +2 -0
  170. package/useTableSelection.js +2 -0
  171. package/utils/storageUtils.d.ts +2 -2
  172. package/utils/storageUtils.js +2 -0
  173. package/utils/urlFeatureToggles.d.ts +12 -6
  174. package/utils/urlFeatureToggles.js +10 -7
  175. package/utils/useDropDirection.js +1 -0
  176. package/version.json +1 -1
package/README.md CHANGED
@@ -4,6 +4,10 @@
4
4
 
5
5
  The documentation and how to integrate the UIKIT in your project can be found here: https://uikit.developers.rio.cloud/
6
6
 
7
+ ## Changelog
8
+
9
+ All changes, updates, and improvements for each version are documented in the changelog (https://uikit.developers.rio.cloud/#start/changelog). Refer to it for a detailed overview of new features, bug fixes, and other modifications.
10
+
7
11
  ## Release
8
12
 
9
13
  Starting with version `0.12.8`, all versions of the uikit will be available under https://uikit.developers.rio.cloud/${VERSION}/.
package/SvgImage.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { default } from './components/svgImage/SvgImage';
2
+ export * from './components/svgImage/SvgImage';
package/SvgImage.js ADDED
@@ -0,0 +1,2 @@
1
+ export { default } from './components/svgImage/SvgImage';
2
+ export * from './components/svgImage/SvgImage';
package/TableCol.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { default } from './components/table/TableCol';
2
+ export * from './components/table/TableCol';
package/TableCol.js ADDED
@@ -0,0 +1,2 @@
1
+ export { default } from './components/table/TableCol';
2
+ export * from './components/table/TableCol';
package/TableHead.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { default } from './components/table/TableHead';
2
+ export * from './components/table/TableHead';
package/TableHead.js ADDED
@@ -0,0 +1,2 @@
1
+ export { default } from './components/table/TableHead';
2
+ export * from './components/table/TableHead';
@@ -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 { forwardRef } from 'react';
4
4
  import classNames from 'classnames';
5
5
  const ActionBarItemIcon = forwardRef((props, ref) => {
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, 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 { forwardRef } from 'react';
4
4
  import classNames from 'classnames';
5
5
  import noop from 'lodash/fp/noop';
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // biome-ignore lint/style/useImportType: required for JSX runtime compatibility with older toolchains
2
3
  import { forwardRef } from 'react';
3
4
  import isEmpty from 'lodash/fp/isEmpty';
4
5
  const CollapsedNavItem = forwardRef((props, ref) => {
@@ -150,6 +150,14 @@ export type TreeProps = {
150
150
  * @default false
151
151
  */
152
152
  hideSummary?: boolean;
153
+ /**
154
+ * Callback triggered when the built-in asset type filter changes.
155
+ * This is only available when the default summary is used.
156
+ *
157
+ * @param type
158
+ * @returns
159
+ */
160
+ onTypeFilterChange?: (currentTypes: string[]) => void;
153
161
  /**
154
162
  * Defines whether the entire area below the search field is shown or not. Note: Disabling the
155
163
  * tree head will hide the select all checkbox and the tree options as well as the tree summary.
@@ -37,7 +37,7 @@ const filterProps = omit([
37
37
  ]);
38
38
  const customCompare = (prevProps, nextProps) => isEqual(filterProps(prevProps), filterProps(nextProps));
39
39
  const Tree = React.memo((props) => {
40
- const { groups = [], items = [], selectedGroups = [], selectedItems = [], onSelectionChange = noop, hasMultiselect = true, showRadioButtons = false, hideSearch = false, hideTreeHead, treeHeaderContent, summary, hideSummary = false, search, searchPlaceholder = 'Type here to filter by name', onSearchChange = noop, className, scrollHeight, expandedGroups, onExpandGroupsChange = noop, showEmptyGroups = true, treeOptions = [], treeOptionsTooltip, disableAnimation = false, ...remainingProps } = props;
40
+ const { groups = [], items = [], selectedGroups = [], selectedItems = [], onSelectionChange = noop, hasMultiselect = true, showRadioButtons = false, hideSearch = false, hideTreeHead, treeHeaderContent, summary, hideSummary = false, search, searchPlaceholder = 'Type here to filter by name', onSearchChange = noop, className, scrollHeight, expandedGroups, onExpandGroupsChange = noop, showEmptyGroups = true, treeOptions = [], treeOptionsTooltip, disableAnimation = false, onTypeFilterChange = noop, ...remainingProps } = props;
41
41
  const [state, dispatch] = useReducer(treeReducer, {
42
42
  groupedItems: [],
43
43
  flatItems: [],
@@ -261,7 +261,9 @@ const Tree = React.memo((props) => {
261
261
  [otherwise, () => renderFlatList()],
262
262
  ])();
263
263
  const handleFilterByType = (type) => {
264
- dispatch(typeFilterChanged(addOrRemoveFromList(state.typeFilter, type)));
264
+ const updatedTypeFilter = addOrRemoveFromList(state.typeFilter, type);
265
+ dispatch(typeFilterChanged(updatedTypeFilter));
266
+ onTypeFilterChange(updatedTypeFilter);
265
267
  };
266
268
  const enableActivity = size(state.visibleTypeCounters) !== 1;
267
269
  const isFilterActive = notEmpty(state.typeFilter);
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } 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 React from 'react';
4
4
  import classNames from 'classnames';
5
5
  import isObject from 'lodash/fp/isObject';
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, 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 React from 'react';
4
4
  import classNames from 'classnames';
5
5
  import noop from 'lodash/fp/noop';
@@ -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 React from 'react';
4
4
  import classNames from 'classnames';
5
5
  import TypeCounter from './TypeCounter';
@@ -33,6 +33,8 @@ export type TypeCounterProps = {
33
33
  hideOnZero?: boolean;
34
34
  /**
35
35
  * Callback function when the counter is clicked. It returns the type value.
36
+ * Make sure the "type" prop is defined to receive the value in the callback.
37
+ *
36
38
  * @param type
37
39
  * @returns
38
40
  */
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, 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 { forwardRef, useRef } from 'react';
4
4
  import classNames from 'classnames';
5
5
  import noop from 'lodash/fp/noop';
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // biome-ignore lint/style/useImportType: <explanation>
2
3
  import { useEffect, useRef, useState } from 'react';
3
4
  import classNames from 'classnames';
4
5
  import isEmpty from 'lodash/fp/isEmpty';
@@ -21,7 +22,7 @@ export const AutoSuggest = (props) => {
21
22
  onClear: noop,
22
23
  onBlur: noop,
23
24
  onFocus: noop,
24
- placeholder: 'Start typing ...',
25
+ placeholder: 'Start typing',
25
26
  hasError: false,
26
27
  tabIndex: 0,
27
28
  value: undefined,
@@ -38,6 +38,12 @@ type BannerProps = {
38
38
  * @default true
39
39
  */
40
40
  border?: boolean;
41
+ /**
42
+ * Enables or disables initial animation.
43
+ *
44
+ * @default true
45
+ */
46
+ initialAnimation?: boolean;
41
47
  /**
42
48
  * Additional classname added to the wrapper element.
43
49
  */
@@ -1,21 +1,24 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState, useEffect, createContext } from 'react';
3
- import { motion, AnimatePresence } from 'framer-motion';
2
+ import { useState, useEffect, createContext, useRef } from 'react';
3
+ import { motion, AnimatePresence, useReducedMotion } from 'framer-motion';
4
4
  import classNames from 'classnames';
5
5
  import Card from '../card/Card';
6
6
  import Button from '../button/Button';
7
- import FadeExpander from '../fade/FadeExpander';
8
7
  import BannerPageActions from './BannerActions';
9
8
  import BannerPageContent from './BannerContent';
10
9
  import BannerPageIcon from './BannerIcon';
11
10
  import BannerPage from './BannerPage';
12
11
  const BannerContext = createContext(undefined);
13
12
  const Banner = (props) => {
14
- const { show = true, dismissible = true, onClose = () => { }, pageTimeout = 20_000, showPageNavigation = true, border = true, className = '', children, ...remainingProps } = props;
13
+ const { show = true, dismissible = true, onClose = () => { }, pageTimeout = 20_000, showPageNavigation = true, border = true, initialAnimation = true, className = '', children, ...remainingProps } = props;
15
14
  const pages = Array.isArray(children) ? children : [children];
16
15
  const pageAmount = pages.length;
17
16
  const hasMultiplePages = pageAmount > 1;
18
17
  const [currentPage, setCurrentPage] = useState(0);
18
+ const shouldReduceMotion = useReducedMotion();
19
+ const hasAnimation = !shouldReduceMotion && initialAnimation;
20
+ const contentRef = useRef(null);
21
+ const [contentHeight, setContentHeight] = useState(0);
19
22
  // biome-ignore lint/correctness/useExhaustiveDependencies: "currentPage" resets interval on manual page change
20
23
  useEffect(() => {
21
24
  if (!show || pageAmount === 1) {
@@ -26,6 +29,24 @@ const Banner = (props) => {
26
29
  }, pageTimeout);
27
30
  return () => clearInterval(interval);
28
31
  }, [pageAmount, pageTimeout, show, currentPage]);
32
+ // Update height measurement after layout is complete
33
+ // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
34
+ useEffect(() => {
35
+ if (!contentRef.current) {
36
+ return;
37
+ }
38
+ // Use ResizeObserver to get accurate measurements after layout
39
+ const resizeObserver = new ResizeObserver(entries => {
40
+ const entry = entries[0];
41
+ if (entry) {
42
+ // Use getBoundingClientRect for most accurate height
43
+ const height = entry.target.getBoundingClientRect().height;
44
+ setContentHeight(height);
45
+ }
46
+ });
47
+ resizeObserver.observe(contentRef.current);
48
+ return () => resizeObserver.disconnect();
49
+ }, [show, currentPage]);
29
50
  const nextPage = () => {
30
51
  if (hasMultiplePages) {
31
52
  setCurrentPage(prev => (prev + 1) % pageAmount);
@@ -37,10 +58,14 @@ const Banner = (props) => {
37
58
  }
38
59
  };
39
60
  const cardClasses = classNames('Banner display-flex text-color-darker overflow-hidden', 'position-relative', !border && 'border-color-white', className);
40
- return (_jsx(BannerContext.Provider, { value: { nextPage, prevPage }, children: _jsx(FadeExpander, { show: show, children: _jsxs(Card, { className: cardClasses, padding: 20, ...remainingProps, children: [_jsxs("div", { className: 'flex-1-1 overflow-hidden', children: [_jsx(AnimatePresence, { exitBeforeEnter: true, children: _jsx(motion.div, { initial: { opacity: 0, x: 100 }, animate: { opacity: 1, x: 0 }, exit: { opacity: 0, x: -100 }, layout: true, transition: {
41
- duration: 1.5,
42
- ease: [0.25, 1, 0.5, 1], // Custom cubic bezier: fast start, slow end
43
- }, children: pages[currentPage] }, currentPage) }), hasMultiplePages && showPageNavigation && (_jsx("div", { className: 'margin-5', children: _jsx("div", { className: 'position-absolute bottom-5', style: { right: '45px' }, children: _jsxs("div", { className: 'display-flex', children: [_jsx(Button, { bsStyle: 'muted', bsSize: 'xs', onClick: prevPage, iconName: 'rioglyph-arrow-left', iconOnly: true }), _jsx(Button, { bsStyle: 'muted', bsSize: 'xs', onClick: nextPage, iconName: 'rioglyph-arrow-right', iconOnly: true })] }) }) }))] }), dismissible && (_jsx("div", { className: 'flex-0 margin-left-10 margin-right--5 margin-top--5 margin-top-0-ls align-self-start align-self-center-ls', children: _jsx(Button, { bsStyle: 'muted', bsSize: 'sm', onClick: onClose, iconName: 'rioglyph-remove', iconOnly: true }) }))] }) }) }));
61
+ return (_jsx(BannerContext.Provider, { value: { nextPage, prevPage }, children: _jsx(AnimatePresence, { children: show && (_jsx(motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: contentHeight, opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: {
62
+ height: { duration: 0.2 },
63
+ opacity: { duration: 0.2 },
64
+ ease: 'easeInOut',
65
+ }, children: _jsx("div", { ref: contentRef, style: { position: 'relative' }, children: _jsxs(Card, { className: cardClasses, padding: 20, ...remainingProps, children: [_jsxs("div", { className: 'flex-1-1 overflow-hidden', children: [_jsx(AnimatePresence, { exitBeforeEnter: true, children: _jsx(motion.div, { initial: hasAnimation ? { opacity: 0, x: 100 } : false, animate: { opacity: 1, x: 0 }, exit: hasAnimation ? { opacity: 0, x: -100 } : undefined, transition: {
66
+ duration: 1.5,
67
+ ease: [0.25, 1, 0.5, 1],
68
+ }, children: pages[currentPage] }, currentPage) }), hasMultiplePages && showPageNavigation && (_jsx("div", { className: 'margin-5', children: _jsx("div", { className: 'position-absolute bottom-5', style: { right: '45px' }, children: _jsxs("div", { className: 'display-flex', children: [_jsx(Button, { bsStyle: 'muted', bsSize: 'xs', onClick: prevPage, iconName: 'rioglyph-arrow-left', iconOnly: true }), _jsx(Button, { bsStyle: 'muted', bsSize: 'xs', onClick: nextPage, iconName: 'rioglyph-arrow-right', iconOnly: true })] }) }) }))] }), dismissible && (_jsx("div", { className: 'flex-0 margin-left-10 margin-right--5 margin-top--5 margin-top-0-ls align-self-start align-self-center-ls', children: _jsx(Button, { bsStyle: 'muted', bsSize: 'sm', onClick: onClose, iconName: 'rioglyph-remove', iconOnly: true }) }))] }) }) })) }) }));
44
69
  };
45
70
  Banner.Page = BannerPage;
46
71
  Banner.Icon = BannerPageIcon;
@@ -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;
@@ -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, ref: 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;