@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.
- package/BarList.d.ts +2 -0
- package/BarList.js +2 -0
- package/README.md +4 -0
- package/SaveableDateInput.d.ts +2 -0
- package/SaveableDateInput.js +2 -0
- package/SvgImage.d.ts +2 -0
- package/SvgImage.js +2 -0
- package/TableCol.d.ts +2 -0
- package/TableCol.js +2 -0
- package/TableHead.d.ts +2 -0
- package/TableHead.js +2 -0
- package/components/actionBarItem/ActionBarItemIcon.js +1 -1
- package/components/actionBarItem/ActionBarOverlay.js +1 -1
- package/components/activity/Activity.d.ts +2 -2
- package/components/applicationHeader/CollapsedNavItem.js +1 -0
- package/components/assetTree/Tree.d.ts +20 -0
- package/components/assetTree/Tree.js +75 -38
- package/components/assetTree/TreeLeaf.js +1 -1
- package/components/assetTree/TreeNodeContainer.d.ts +1 -1
- package/components/assetTree/TreeSearch.js +1 -1
- package/components/assetTree/TreeSummary.js +1 -1
- package/components/assetTree/TypeCounter.d.ts +2 -0
- package/components/assetTree/TypeCounter.js +1 -1
- package/components/assetTree/useTreeExpansion.d.ts +4 -0
- package/components/assetTree/useTreeExpansion.js +25 -0
- package/components/assetTree/useTreeHeight.d.ts +1 -0
- package/components/assetTree/useTreeHeight.js +60 -0
- package/components/assetTree/useTreeScrollPosition.d.ts +3 -0
- package/components/assetTree/useTreeScrollPosition.js +19 -0
- package/components/assetTree/useTreeVirtualization.d.ts +17 -0
- package/components/assetTree/useTreeVirtualization.js +71 -0
- package/components/autosuggest/AutoSuggest.js +2 -1
- package/components/barList/BarList.d.ts +97 -0
- package/components/barList/BarList.js +42 -0
- package/components/barList/useSortedBars.d.ts +2 -0
- package/components/barList/useSortedBars.js +14 -0
- package/components/button/ButtonToolbar.d.ts +1 -1
- package/components/button/ButtonToolbar.js +1 -1
- package/components/button/ToggleButton.js +0 -1
- package/components/charts/PieChart.js +1 -1
- package/components/clearableInput/ClearableInput.d.ts +20 -7
- package/components/clearableInput/ClearableInput.js +68 -8
- package/components/dialog/Dialog.js +1 -1
- package/components/dialog/FrameDialog.js +1 -1
- package/components/dropdown/ButtonDropdown.d.ts +11 -3
- package/components/dropdown/ButtonDropdown.js +79 -64
- package/components/dropdown/DropdownToggleButton.d.ts +7 -4
- package/components/dropdown/DropdownToggleButton.js +11 -3
- package/components/formLabel/FormLabel.d.ts +2 -2
- package/components/formLabel/FormLabel.js +1 -1
- package/components/listMenu/ListMenu.js +4 -1
- package/components/map/components/Map.js +21 -6
- package/components/map/components/constants.d.ts +2 -0
- package/components/map/components/constants.js +3 -0
- package/components/map/components/features/basics/InfoBubble.js +1 -1
- package/components/map/components/features/layers/overlayLayers/IncidentsLayer.js +1 -1
- package/components/map/utils/mapTypes.d.ts +5 -0
- package/components/map/utils/rendering.d.ts +5 -2
- package/components/map/utils/rendering.js +46 -39
- package/components/menuItems/MenuItem.js +1 -1
- package/components/notification/Notification.js +1 -1
- package/components/overlay/OverlayTrigger.js +3 -3
- package/components/saveableInput/SaveableDateInput.d.ts +83 -0
- package/components/saveableInput/SaveableDateInput.js +122 -0
- package/components/selects/BaseSelectDropdown.js +1 -1
- package/components/selects/Multiselect.d.ts +8 -0
- package/components/selects/Multiselect.js +4 -4
- package/components/smoothScrollbars/SmoothScrollbars.d.ts +1 -0
- package/components/smoothScrollbars/SmoothScrollbars.js +3 -3
- package/components/statsWidget/StatsWidget.d.ts +2 -2
- package/components/statsWidget/StatsWidgets.d.ts +2 -2
- package/components/svgImage/SvgElement.d.ts +8 -0
- package/components/svgImage/SvgElement.js +11 -0
- package/components/svgImage/SvgImage.d.ts +30 -0
- package/components/svgImage/SvgImage.js +20 -0
- package/components/svgImage/svgConverter.d.ts +17 -0
- package/components/svgImage/svgConverter.js +78 -0
- package/components/svgImage/useSvgLoader.d.ts +9 -0
- package/components/svgImage/useSvgLoader.js +43 -0
- package/components/switch/Switch.d.ts +4 -0
- package/components/switch/Switch.js +5 -6
- package/components/table/TableCardsSorting.d.ts +0 -1
- package/components/table/TableCol.d.ts +18 -0
- package/components/table/TableCol.js +11 -0
- package/components/table/TableHead.d.ts +33 -0
- package/components/table/TableHead.js +11 -0
- package/components/table/TableSettingsDialog.js +1 -1
- package/components/tag/Tag.js +1 -1
- package/components/timepicker/TimePicker.d.ts +1 -2
- package/components/timepicker/TimePicker.js +35 -8
- package/components/tooltip/SimpleTooltip.d.ts +1 -1
- package/components/virtualList/VirtualList.js +1 -1
- package/hooks/useIsFocusWithin.d.ts +33 -0
- package/hooks/useIsFocusWithin.js +55 -0
- package/hooks/useLocationSuggestions.d.ts +27 -0
- package/hooks/useLocationSuggestions.js +94 -0
- package/hooks/useOnboarding.d.ts +17 -5
- package/hooks/useOnboarding.js +7 -1
- package/hooks/usePostMessage.js +0 -1
- package/hooks/useSearch.d.ts +63 -0
- package/hooks/useSearch.js +73 -0
- package/hooks/useSorting.d.ts +6 -0
- package/hooks/useSorting.js +7 -4
- package/hooks/useTableExport.d.ts +49 -0
- package/hooks/useTableExport.js +57 -0
- package/hooks/useTableSelection.d.ts +166 -0
- package/hooks/useTableSelection.js +201 -0
- package/lib/es/BarList.d.ts +2 -0
- package/lib/es/BarList.js +7 -0
- package/lib/es/SaveableDateInput.d.ts +2 -0
- package/lib/es/SaveableDateInput.js +7 -0
- package/lib/es/SvgImage.d.ts +2 -0
- package/lib/es/SvgImage.js +7 -0
- package/lib/es/TableCol.d.ts +2 -0
- package/lib/es/TableCol.js +7 -0
- package/lib/es/TableHead.d.ts +2 -0
- package/lib/es/TableHead.js +7 -0
- package/lib/es/components/actionBarItem/ActionBarItemIcon.js +1 -1
- package/lib/es/components/actionBarItem/ActionBarOverlay.js +1 -1
- package/lib/es/components/activity/Activity.d.ts +2 -2
- package/lib/es/components/applicationHeader/CollapsedNavItem.js +1 -0
- package/lib/es/components/assetTree/Tree.d.ts +20 -0
- package/lib/es/components/assetTree/Tree.js +74 -37
- package/lib/es/components/assetTree/TreeLeaf.js +1 -1
- package/lib/es/components/assetTree/TreeNodeContainer.d.ts +1 -1
- package/lib/es/components/assetTree/TreeSearch.js +1 -1
- package/lib/es/components/assetTree/TreeSummary.js +1 -1
- package/lib/es/components/assetTree/TypeCounter.d.ts +2 -0
- package/lib/es/components/assetTree/TypeCounter.js +1 -1
- package/lib/es/components/assetTree/useTreeExpansion.d.ts +4 -0
- package/lib/es/components/assetTree/useTreeExpansion.js +29 -0
- package/lib/es/components/assetTree/useTreeHeight.d.ts +1 -0
- package/lib/es/components/assetTree/useTreeHeight.js +64 -0
- package/lib/es/components/assetTree/useTreeScrollPosition.d.ts +3 -0
- package/lib/es/components/assetTree/useTreeScrollPosition.js +23 -0
- package/lib/es/components/assetTree/useTreeVirtualization.d.ts +17 -0
- package/lib/es/components/assetTree/useTreeVirtualization.js +76 -0
- package/lib/es/components/autosuggest/AutoSuggest.js +2 -1
- package/lib/es/components/barList/BarList.d.ts +97 -0
- package/lib/es/components/barList/BarList.js +45 -0
- package/lib/es/components/barList/useSortedBars.d.ts +2 -0
- package/lib/es/components/barList/useSortedBars.js +17 -0
- package/lib/es/components/button/ButtonToolbar.d.ts +1 -1
- package/lib/es/components/button/ButtonToolbar.js +1 -1
- package/lib/es/components/button/ToggleButton.js +0 -1
- package/lib/es/components/charts/PieChart.js +1 -1
- package/lib/es/components/clearableInput/ClearableInput.d.ts +20 -7
- package/lib/es/components/clearableInput/ClearableInput.js +67 -7
- package/lib/es/components/dialog/Dialog.js +1 -1
- package/lib/es/components/dialog/FrameDialog.js +1 -1
- package/lib/es/components/dropdown/ButtonDropdown.d.ts +11 -3
- package/lib/es/components/dropdown/ButtonDropdown.js +79 -64
- package/lib/es/components/dropdown/DropdownToggleButton.d.ts +7 -4
- package/lib/es/components/dropdown/DropdownToggleButton.js +11 -3
- package/lib/es/components/formLabel/FormLabel.d.ts +2 -2
- package/lib/es/components/formLabel/FormLabel.js +1 -1
- package/lib/es/components/listMenu/ListMenu.js +4 -1
- package/lib/es/components/map/components/Map.js +20 -5
- package/lib/es/components/map/components/constants.d.ts +2 -0
- package/lib/es/components/map/components/constants.js +4 -1
- package/lib/es/components/map/components/features/basics/InfoBubble.js +1 -1
- package/lib/es/components/map/components/features/layers/overlayLayers/IncidentsLayer.js +1 -1
- package/lib/es/components/map/utils/mapTypes.d.ts +5 -0
- package/lib/es/components/map/utils/rendering.d.ts +5 -2
- package/lib/es/components/map/utils/rendering.js +46 -39
- package/lib/es/components/menuItems/MenuItem.js +1 -1
- package/lib/es/components/notification/Notification.js +1 -1
- package/lib/es/components/overlay/OverlayTrigger.js +3 -3
- package/lib/es/components/saveableInput/SaveableDateInput.d.ts +83 -0
- package/lib/es/components/saveableInput/SaveableDateInput.js +125 -0
- package/lib/es/components/selects/BaseSelectDropdown.js +1 -1
- package/lib/es/components/selects/Multiselect.d.ts +8 -0
- package/lib/es/components/selects/Multiselect.js +4 -4
- package/lib/es/components/smoothScrollbars/SmoothScrollbars.d.ts +1 -0
- package/lib/es/components/smoothScrollbars/SmoothScrollbars.js +3 -3
- package/lib/es/components/statsWidget/StatsWidget.d.ts +2 -2
- package/lib/es/components/statsWidget/StatsWidgets.d.ts +2 -2
- package/lib/es/components/svgImage/SvgElement.d.ts +8 -0
- package/lib/es/components/svgImage/SvgElement.js +14 -0
- package/lib/es/components/svgImage/SvgImage.d.ts +30 -0
- package/lib/es/components/svgImage/SvgImage.js +23 -0
- package/lib/es/components/svgImage/svgConverter.d.ts +17 -0
- package/lib/es/components/svgImage/svgConverter.js +84 -0
- package/lib/es/components/svgImage/useSvgLoader.d.ts +9 -0
- package/lib/es/components/svgImage/useSvgLoader.js +48 -0
- package/lib/es/components/switch/Switch.d.ts +4 -0
- package/lib/es/components/switch/Switch.js +5 -6
- package/lib/es/components/table/TableCardsSorting.d.ts +0 -1
- package/lib/es/components/table/TableCol.d.ts +18 -0
- package/lib/es/components/table/TableCol.js +13 -0
- package/lib/es/components/table/TableHead.d.ts +33 -0
- package/lib/es/components/table/TableHead.js +14 -0
- package/lib/es/components/table/TableSettingsDialog.js +1 -1
- package/lib/es/components/tag/Tag.js +1 -1
- package/lib/es/components/timepicker/TimePicker.d.ts +1 -2
- package/lib/es/components/timepicker/TimePicker.js +35 -8
- package/lib/es/components/tooltip/SimpleTooltip.d.ts +1 -1
- package/lib/es/components/virtualList/VirtualList.js +1 -1
- package/lib/es/hooks/useIsFocusWithin.d.ts +33 -0
- package/lib/es/hooks/useIsFocusWithin.js +57 -0
- package/lib/es/hooks/useLocationSuggestions.d.ts +27 -0
- package/lib/es/hooks/useLocationSuggestions.js +97 -0
- package/lib/es/hooks/useOnboarding.d.ts +17 -5
- package/lib/es/hooks/useOnboarding.js +7 -1
- package/lib/es/hooks/usePostMessage.js +0 -1
- package/lib/es/hooks/useSearch.d.ts +63 -0
- package/lib/es/hooks/useSearch.js +75 -0
- package/lib/es/hooks/useSorting.d.ts +6 -0
- package/lib/es/hooks/useSorting.js +7 -4
- package/lib/es/hooks/useTableExport.d.ts +49 -0
- package/lib/es/hooks/useTableExport.js +59 -0
- package/lib/es/hooks/useTableSelection.d.ts +166 -0
- package/lib/es/hooks/useTableSelection.js +210 -0
- package/lib/es/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js +1 -1
- package/lib/es/useIsFocusWithin.d.ts +2 -0
- package/lib/es/useIsFocusWithin.js +7 -0
- package/lib/es/useLocationSuggestions.d.ts +2 -0
- package/lib/es/useLocationSuggestions.js +7 -0
- package/lib/es/useSearch.d.ts +2 -0
- package/lib/es/useSearch.js +7 -0
- package/lib/es/useTableExport.d.ts +2 -0
- package/lib/es/useTableExport.js +7 -0
- package/lib/es/useTableSelection.d.ts +2 -0
- package/lib/es/useTableSelection.js +7 -0
- package/lib/es/utils/storageUtils.d.ts +2 -2
- package/lib/es/utils/storageUtils.js +2 -0
- package/lib/es/utils/urlFeatureToggles.d.ts +12 -6
- package/lib/es/utils/urlFeatureToggles.js +14 -8
- package/lib/es/utils/useDropDirection.js +1 -0
- package/lib/es/version.json +1 -1
- package/package.json +48 -40
- package/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js +1 -1
- package/useIsFocusWithin.d.ts +2 -0
- package/useIsFocusWithin.js +2 -0
- package/useLocationSuggestions.d.ts +2 -0
- package/useLocationSuggestions.js +2 -0
- package/useSearch.d.ts +2 -0
- package/useSearch.js +2 -0
- package/useTableExport.d.ts +2 -0
- package/useTableExport.js +2 -0
- package/useTableSelection.d.ts +2 -0
- package/useTableSelection.js +2 -0
- package/utils/storageUtils.d.ts +2 -2
- package/utils/storageUtils.js +2 -0
- package/utils/urlFeatureToggles.d.ts +12 -6
- package/utils/urlFeatureToggles.js +10 -7
- package/utils/useDropDirection.js +1 -0
- package/version.json +1 -1
|
@@ -146,6 +146,14 @@ export type MultiselectProps<T extends MultiselectOption> = Omit<WithFeedbackAnd
|
|
|
146
146
|
* @default false
|
|
147
147
|
*/
|
|
148
148
|
showUnselectedItemIcons?: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Additional classes to be set to the dropdown.
|
|
151
|
+
*/
|
|
152
|
+
dropdownClassName?: string;
|
|
153
|
+
/**
|
|
154
|
+
* Additional classes to be set to the select/input.
|
|
155
|
+
*/
|
|
156
|
+
btnClassName?: string;
|
|
149
157
|
/**
|
|
150
158
|
* Additional classes to be set to the select wrapper
|
|
151
159
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
//
|
|
2
|
+
// biome-ignore lint/style/useImportType: required for JSX runtime compatibility with older toolchains
|
|
3
3
|
import { useRef, useState } from 'react';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import isEqual from 'lodash/fp/isEqual';
|
|
@@ -15,7 +15,7 @@ import useMergeRefs from '../../hooks/useMergeRefs';
|
|
|
15
15
|
import WithFeedbackAndAddon from './WithFeedbackAndAddon';
|
|
16
16
|
const DEFAULT_FOCUSED_ITEM_INDEX = -1;
|
|
17
17
|
const Multiselect = (props) => {
|
|
18
|
-
const { name, id = name, options = [], value, onChange = noop, placeholder, isLoading = false, dropup = false, pullRight = false, autoDropDirection = true, bsSize = 'md', disabled = false, tabIndex = 0, hasError = false, useFilter = false, multiline = false, noItemMessage, counterMessage, renderCounterMessage, showSelectedItemIcon = false, showUnselectedItemIcons = false, className, inputAddon, errorMessage, warningMessage, messageWhiteSpace = 'normal', ...remainingProps } = props;
|
|
18
|
+
const { name, id = name, options = [], value, onChange = noop, placeholder, isLoading = false, dropup = false, pullRight = false, autoDropDirection = true, bsSize = 'md', disabled = false, tabIndex = 0, hasError = false, useFilter = false, multiline = false, noItemMessage, counterMessage, renderCounterMessage, showSelectedItemIcon = false, showUnselectedItemIcons = false, className, inputAddon, errorMessage, warningMessage, messageWhiteSpace = 'normal', btnClassName, dropdownClassName, ...remainingProps } = props;
|
|
19
19
|
const [isOpen, setIsOpen] = useState(false);
|
|
20
20
|
const [selectedItemIds, setSelectedItemIds] = useState(value || []);
|
|
21
21
|
const [isFilterActive, setIsFilterActive] = useState(false);
|
|
@@ -73,7 +73,7 @@ const Multiselect = (props) => {
|
|
|
73
73
|
return (_jsx(MultiselectToggleSelection, { options: options, selectedItemIds: selectedItemIds, showSelectedItemIcon: showSelectedItemIcon, showUnselectedItemIcons: showUnselectedItemIcons, onRemoveItem: handleRemoveSelectedItem, multiline: multiline, hasInputAddon: !!inputAddon, hasFilter: useFilter, children: multiline && renderFilter() }));
|
|
74
74
|
};
|
|
75
75
|
const renderToggle = () => {
|
|
76
|
-
const wrapperClassNames = classNames('dropdown-toggle', 'form-control', 'text-left', bsSize === 'sm' && 'input-sm', bsSize === 'lg' && 'input-lg', multiline && 'height-auto', disabled && 'disabled');
|
|
76
|
+
const wrapperClassNames = classNames('dropdown-toggle', 'form-control', 'text-left', btnClassName && btnClassName, bsSize === 'sm' && 'input-sm', bsSize === 'lg' && 'input-lg', multiline && 'height-auto', disabled && 'disabled');
|
|
77
77
|
const showPlaceholder = isEmpty(selectedItemIds) && !showUnselectedItemIcons;
|
|
78
78
|
const showFilter = useFilter && isOpen && !counterMessage && !renderCounterMessage;
|
|
79
79
|
const toggleButton = (_jsxs("button", { type: 'button', id: id, name: name, className: wrapperClassNames, "data-toggle": 'dropdown', tabIndex: tabIndex, "aria-haspopup": 'true', "aria-expanded": isOpen, onClick: onToggle, onKeyDown: handleToggleKeyDown, ref: refToggle, children: [showPlaceholder ? (_jsxs(_Fragment, { children: [_jsx(MultiselectTogglePlaceholder, { placeholder: placeholder }), showFilter && renderFilter()] })) : (renderSelection()), showFilter && !multiline && renderFilter(), _jsx("span", { className: 'caret' })] }));
|
|
@@ -87,7 +87,7 @@ const Multiselect = (props) => {
|
|
|
87
87
|
option.selected = selectedItemIds.indexOf(option.id) !== -1;
|
|
88
88
|
return option;
|
|
89
89
|
});
|
|
90
|
-
return (_jsx(BaseSelectDropdown, { isOpen: isOpen, isLoading: isLoading, options: nonSelectedOptions, focusedItemIndex: focusedItemIndex, keyboardUsed: keyboardUsed, updateDOMValues: updateDOMValues, onSelect: onOptionChange, onClose: closeMenu, noItemMessage: noItemMessage, pullRight: pullRight, useActiveClass: true, dropup: dropup, autoDropDirection: autoDropDirection }));
|
|
90
|
+
return (_jsx(BaseSelectDropdown, { isOpen: isOpen, isLoading: isLoading, options: nonSelectedOptions, focusedItemIndex: focusedItemIndex, keyboardUsed: keyboardUsed, updateDOMValues: updateDOMValues, onSelect: onOptionChange, onClose: closeMenu, noItemMessage: noItemMessage, pullRight: pullRight, useActiveClass: true, dropup: dropup, autoDropDirection: autoDropDirection, dropdownClassName: dropdownClassName }));
|
|
91
91
|
};
|
|
92
92
|
const handleFilterChange = (event) => {
|
|
93
93
|
event.preventDefault();
|
|
@@ -9,6 +9,7 @@ export type SmoothScrollbarsProps = {
|
|
|
9
9
|
autoHeightMin?: number;
|
|
10
10
|
autoHeightMax?: number;
|
|
11
11
|
onScroll?: (event: React.UIEvent<any> | undefined) => void;
|
|
12
|
+
style?: React.CSSProperties;
|
|
12
13
|
};
|
|
13
14
|
declare const SmoothScrollbars: React.ForwardRefExoticComponent<SmoothScrollbarsProps & {
|
|
14
15
|
children?: React.ReactNode | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
//
|
|
2
|
+
// biome-ignore lint/style/useImportType: required for JSX runtime compatibility with older toolchains
|
|
3
3
|
import { forwardRef, useEffect, useImperativeHandle, useRef, } from 'react';
|
|
4
4
|
import { Scrollbars } from 'react-custom-scrollbars-2';
|
|
5
5
|
import classNames from 'classnames';
|
|
@@ -7,7 +7,7 @@ import noop from 'lodash/fp/noop';
|
|
|
7
7
|
import debounce from 'lodash/fp/debounce';
|
|
8
8
|
const RESIZE_THROTTLING = 100;
|
|
9
9
|
const SmoothScrollbars = forwardRef((componentProps, ref) => {
|
|
10
|
-
const { slideIn = false, largeTrack = false, trackOffset = false, className = '', onScroll = noop, tagName = 'div', autoHeight = false, autoHeightMin = 0, autoHeightMax = 200, children, } = componentProps;
|
|
10
|
+
const { slideIn = false, largeTrack = false, trackOffset = false, className = '', onScroll = noop, tagName = 'div', autoHeight = false, autoHeightMin = 0, autoHeightMax = 200, children, style, ...remainingProps } = componentProps;
|
|
11
11
|
const scrollbarsRef = useRef(null);
|
|
12
12
|
const contentRef = useRef(null);
|
|
13
13
|
useImperativeHandle(ref, () => scrollbarsRef.current);
|
|
@@ -36,7 +36,7 @@ const SmoothScrollbars = forwardRef((componentProps, ref) => {
|
|
|
36
36
|
const renderThumbVerticalNames = classNames('scrollbar-thumb-vertical', largeTrack && 'scrollbar-thumb-size-large');
|
|
37
37
|
const renderTrackHorizontalNames = classNames('scrollbar-track-horizontal', largeTrack && 'scrollbar-track-size-large', trackOffset && 'scrollbar-track-offset');
|
|
38
38
|
const renderThumbHorizontalNames = classNames('scrollbar-thumb-horizontal', largeTrack && 'scrollbar-thumb-size-large');
|
|
39
|
-
return (_jsx(Scrollbars, { ref: scrollbarsRef, tagName: tagName, onScroll: onScroll, className: wrapperClassNames, hideTracksWhenNotNeeded: true, autoHeight: autoHeight, autoHeightMin: autoHeightMin, autoHeightMax: autoHeightMax, renderView: props => {
|
|
39
|
+
return (_jsx(Scrollbars, { ...remainingProps, ref: scrollbarsRef, tagName: tagName, onScroll: onScroll, className: wrapperClassNames, hideTracksWhenNotNeeded: true, autoHeight: autoHeight, autoHeightMin: autoHeightMin, autoHeightMax: autoHeightMax, renderView: props => {
|
|
40
40
|
return _jsx("div", { ...props, className: 'scrollbar-view' });
|
|
41
41
|
}, renderTrackVertical: props => {
|
|
42
42
|
return _jsx("div", { ...props, className: renderTrackVerticalNames });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ComponentProps, MouseEventHandler, PropsWithChildren } from 'react';
|
|
2
2
|
import { type StatsWidgetHeaderProps } from './StatsWidgetHeader';
|
|
3
3
|
import { type StatsWidgetBodyProps } from './StatsWidgetBody';
|
|
4
4
|
import { type StatsWidgetFooterProps } from './StatsWidgetFooter';
|
|
5
|
-
export type StatsWidgetProps = {
|
|
5
|
+
export type StatsWidgetProps = ComponentProps<'div'> & {
|
|
6
6
|
/**
|
|
7
7
|
* Callback to reset the filter.
|
|
8
8
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type StatsWidgetsProps = {
|
|
1
|
+
import type { ComponentProps, PropsWithChildren } from 'react';
|
|
2
|
+
export type StatsWidgetsProps = ComponentProps<'div'> & {
|
|
3
3
|
/**
|
|
4
4
|
* Additional class names to be added to the element.
|
|
5
5
|
*/
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ColorOverridesMap } from './svgConverter';
|
|
3
|
+
type SvgElementProps = {
|
|
4
|
+
node: Element;
|
|
5
|
+
colorMap: ColorOverridesMap;
|
|
6
|
+
};
|
|
7
|
+
declare const SvgElement: ({ node, colorMap }: SvgElementProps) => React.DOMElement<React.DOMAttributes<Element>, Element>;
|
|
8
|
+
export default SvgElement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { convertAttributes } from './svgConverter';
|
|
4
|
+
const SvgElement = ({ node, colorMap }) => {
|
|
5
|
+
const attributes = convertAttributes(node, colorMap);
|
|
6
|
+
return React.createElement(node.tagName.toLowerCase(), {
|
|
7
|
+
...attributes,
|
|
8
|
+
key: attributes.id || Math.random(),
|
|
9
|
+
}, Array.from(node.childNodes).map((child, idx) => child.nodeType === 1 ? _jsx(SvgElement, { node: child, colorMap: colorMap }, idx) : null));
|
|
10
|
+
};
|
|
11
|
+
export default SvgElement;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ColorOverridesMap } from './svgConverter';
|
|
3
|
+
type SvgImageProps = {
|
|
4
|
+
/**
|
|
5
|
+
* The name of the image file without extension.
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
/**
|
|
9
|
+
* The height and width of the SVG image in pixels.
|
|
10
|
+
*
|
|
11
|
+
* @default 150
|
|
12
|
+
*/
|
|
13
|
+
size?: number;
|
|
14
|
+
/**
|
|
15
|
+
* The CDN base URL where the images are located.
|
|
16
|
+
*
|
|
17
|
+
* @default 'https://cdn.rio.cloud/riosvg'
|
|
18
|
+
*/
|
|
19
|
+
baseUrl?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Customize color using the color map and define the CSS variable name that shall be used.
|
|
22
|
+
*/
|
|
23
|
+
colorMap?: ColorOverridesMap;
|
|
24
|
+
/**
|
|
25
|
+
* Additional class names added to the SVG element.
|
|
26
|
+
*/
|
|
27
|
+
className?: string;
|
|
28
|
+
};
|
|
29
|
+
declare const SvgImage: (props: SvgImageProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
|
|
30
|
+
export default SvgImage;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useSvgLoader } from './useSvgLoader';
|
|
3
|
+
const BASE_CDN_URL = 'https://cdn.rio.cloud/riosvg';
|
|
4
|
+
const SvgImage = (props) => {
|
|
5
|
+
const { name, className = '', size = 150, baseUrl = BASE_CDN_URL, colorMap } = props;
|
|
6
|
+
const { svgElement, error } = useSvgLoader(name, baseUrl, colorMap);
|
|
7
|
+
if (error) {
|
|
8
|
+
console.error(`Icon "${name}" not found`);
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
if (!svgElement) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return React.cloneElement(svgElement, {
|
|
15
|
+
width: size,
|
|
16
|
+
height: size,
|
|
17
|
+
className,
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
export default SvgImage;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type CSSColorVar = 'color-white' | 'color-black' | 'always-color-white' | 'always-color-black' | 'gray-darkest' | 'gray-darker' | 'gray-dark' | 'gray' | 'gray-light' | 'gray-lighter' | 'gray-lightest' | 'gray-decent' | 'brand-primary' | 'brand-secondary' | 'brand-primary-decent' | 'brand-secondary-decent' | 'brand-info' | 'brand-success' | 'brand-warning' | 'brand-danger' | 'brand-info-decent' | 'brand-success-decent' | 'brand-warning-decent' | 'brand-danger-decent' | 'color-code' | 'color-status-available' | 'color-status-driving' | 'color-status-resting' | 'color-status-working' | 'color-map-marker-asset' | 'color-map-marker-poi' | 'color-map-marker-geofence' | 'color-map-marker-route' | 'color-map-marker-info' | 'color-map-marker-success' | 'color-map-marker-warning' | 'color-map-marker-danger' | 'color-map-marker-restrictions' | 'color-map-marker-text' | 'color-map-marker-active' | 'color-highlight-darkest' | 'color-highlight-darker' | 'color-highlight-dark' | 'color-highlight' | 'color-highlight-light' | 'color-highlight-lighter' | 'color-highlight-lightest' | 'color-highlight-decent' | 'color-rating-1' | 'color-rating-2' | 'color-rating-3' | 'color-rating-4' | 'color-rating-5' | 'color-coldplay-wine' | 'color-coldplay-aubergine' | 'color-coldplay-kashmir' | 'color-coldplay-fountain' | 'color-coldplay-turquoise' | 'color-coldplay-bermuda' | 'color-coldplay-moos' | 'color-coldplay-primrose' | 'color-coldplay-khaki' | 'color-warmup-crimson' | 'color-warmup-victoria' | 'color-warmup-cadillac' | 'color-warmup-raspberry' | 'color-warmup-cerise' | 'color-warmup-charm' | 'color-warmup-salmon' | 'color-warmup-cherokee' | 'color-warmup-corn' | 'color-spectrum-indigo' | 'color-spectrum-violet' | 'color-spectrum-purple' | 'color-spectrum-fuchsia' | 'color-spectrum-pink' | 'color-spectrum-rose';
|
|
2
|
+
export type ColorOverridesMap = {
|
|
3
|
+
mainStrokeColor?: CSSColorVar;
|
|
4
|
+
mainFillColor?: CSSColorVar;
|
|
5
|
+
secondaryStrokeColor?: CSSColorVar;
|
|
6
|
+
backgroundFillColor?: CSSColorVar;
|
|
7
|
+
};
|
|
8
|
+
export declare const defaultColorMap: ColorOverridesMap;
|
|
9
|
+
type StyleObject = Record<string, string>;
|
|
10
|
+
export declare const parseStyleString: (style: string) => StyleObject;
|
|
11
|
+
export declare const camelCase: (str: string) => string;
|
|
12
|
+
type ConvertedAttributes = {
|
|
13
|
+
style?: React.CSSProperties;
|
|
14
|
+
[key: string]: string | React.CSSProperties | undefined;
|
|
15
|
+
};
|
|
16
|
+
export declare const convertAttributes: (node: Element, colorOverrides: ColorOverridesMap) => ConvertedAttributes;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Define the color replacements - handle hex colors and fallbacks
|
|
2
|
+
// const svgColorReplacement: Record<string, string> = {
|
|
3
|
+
// 'rgb(255, 255, 255)': 'var(--color-white)',
|
|
4
|
+
// '#fff': 'var(--color-white)',
|
|
5
|
+
// '#ffffff': 'var(--color-white)',
|
|
6
|
+
export const defaultColorMap = {
|
|
7
|
+
mainStrokeColor: 'brand-info',
|
|
8
|
+
mainFillColor: 'color-highlight-lighter',
|
|
9
|
+
secondaryStrokeColor: 'gray',
|
|
10
|
+
backgroundFillColor: 'gray-lighter',
|
|
11
|
+
};
|
|
12
|
+
// Utility function to normalize RGB values (removes spaces, converts case)
|
|
13
|
+
const normalizeColor = (color) => color.replace(/\s+/g, '').toLowerCase();
|
|
14
|
+
export const parseStyleString = (style) => {
|
|
15
|
+
return style.split(';').reduce((acc, rule) => {
|
|
16
|
+
const [key, value] = rule.split(':').map(s => s.trim());
|
|
17
|
+
if (key && value) {
|
|
18
|
+
acc[camelCase(key)] = value;
|
|
19
|
+
}
|
|
20
|
+
return acc;
|
|
21
|
+
}, {});
|
|
22
|
+
};
|
|
23
|
+
export const camelCase = (str) => str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
24
|
+
const REACT_ATTRIBUTE_MAP = {
|
|
25
|
+
'xml:space': 'xmlSpace',
|
|
26
|
+
'xmlns:xlink': 'xmlnsXlink',
|
|
27
|
+
'stroke-width': 'strokeWidth',
|
|
28
|
+
'fill-opacity': 'fillOpacity',
|
|
29
|
+
'stroke-opacity': 'strokeOpacity',
|
|
30
|
+
'clip-path': 'clipPath',
|
|
31
|
+
};
|
|
32
|
+
export const convertAttributes = (node, colorOverrides) => {
|
|
33
|
+
const attributes = {};
|
|
34
|
+
const attrs = node.attributes;
|
|
35
|
+
// Create a dynamic color map based on the overrides
|
|
36
|
+
const colorMap = {
|
|
37
|
+
// Main fill color
|
|
38
|
+
'rgb(207, 240, 243)': `var(--${colorOverrides.mainFillColor || defaultColorMap.mainFillColor})`,
|
|
39
|
+
'#cff0f3': `var(--${colorOverrides.mainFillColor || defaultColorMap.mainFillColor})`,
|
|
40
|
+
// Main stroke color
|
|
41
|
+
'rgb(75, 128, 166)': `var(--${colorOverrides.mainStrokeColor || defaultColorMap.mainStrokeColor})`,
|
|
42
|
+
'#4b80a6': `var(--${colorOverrides.mainStrokeColor || defaultColorMap.mainStrokeColor})`,
|
|
43
|
+
// Secondary stroke color (gray elements)
|
|
44
|
+
'rgb(188, 192, 196)': `var(--${colorOverrides.secondaryStrokeColor || defaultColorMap.secondaryStrokeColor})`,
|
|
45
|
+
'#bcc0c4': `var(--${colorOverrides.secondaryStrokeColor || defaultColorMap.secondaryStrokeColor})`,
|
|
46
|
+
// Background fill color
|
|
47
|
+
'rgb(233, 235, 236)': `var(--${colorOverrides.backgroundFillColor || defaultColorMap.backgroundFillColor})`,
|
|
48
|
+
'#e9ebec': `var(--${colorOverrides.backgroundFillColor || defaultColorMap.backgroundFillColor})`,
|
|
49
|
+
// Static colors that don't change
|
|
50
|
+
'rgb(255, 255, 255)': 'var(--color-white)',
|
|
51
|
+
'#fff': 'var(--color-white)',
|
|
52
|
+
'#ffffff': 'var(--color-white)',
|
|
53
|
+
};
|
|
54
|
+
for (const attr of attrs) {
|
|
55
|
+
const attrName = REACT_ATTRIBUTE_MAP[attr.name] || attr.name;
|
|
56
|
+
let value = attr.value;
|
|
57
|
+
if (attrName === 'style') {
|
|
58
|
+
const parsedStyle = parseStyleString(value);
|
|
59
|
+
if (parsedStyle.fill) {
|
|
60
|
+
const normalizedFill = normalizeColor(parsedStyle.fill);
|
|
61
|
+
parsedStyle.fill = colorMap[normalizedFill] || parsedStyle.fill;
|
|
62
|
+
}
|
|
63
|
+
if (parsedStyle.stroke) {
|
|
64
|
+
const normalizedStroke = normalizeColor(parsedStyle.stroke);
|
|
65
|
+
parsedStyle.stroke = colorMap[normalizedStroke] || parsedStyle.stroke;
|
|
66
|
+
}
|
|
67
|
+
attributes.style = parsedStyle;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
if (attrName === 'fill' || attrName === 'stroke') {
|
|
71
|
+
const normalizedColor = normalizeColor(value);
|
|
72
|
+
value = colorMap[normalizedColor] || value;
|
|
73
|
+
}
|
|
74
|
+
attributes[attrName] = value;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return attributes;
|
|
78
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ColorOverridesMap } from './svgConverter';
|
|
3
|
+
type UseSvgLoaderResult = {
|
|
4
|
+
svgElement: ReactNode | null;
|
|
5
|
+
error: boolean;
|
|
6
|
+
colorMap?: ColorOverridesMap;
|
|
7
|
+
};
|
|
8
|
+
export declare const useSvgLoader: (name: string, baseUrl: string, colorMap?: ColorOverridesMap) => UseSvgLoaderResult;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { convertAttributes, defaultColorMap } from './svgConverter';
|
|
4
|
+
import SvgElement from './SvgElement';
|
|
5
|
+
export const useSvgLoader = (name, baseUrl, colorMap = defaultColorMap) => {
|
|
6
|
+
const [svgElement, setSvgElement] = useState(null);
|
|
7
|
+
const [error, setError] = useState(false);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const fetchSvg = async () => {
|
|
10
|
+
try {
|
|
11
|
+
const url = `${baseUrl}/${name}.svg`;
|
|
12
|
+
const response = await fetch(url);
|
|
13
|
+
if (!response.ok) {
|
|
14
|
+
throw new Error('Failed to load SVG');
|
|
15
|
+
}
|
|
16
|
+
const svgText = await response.text();
|
|
17
|
+
if (svgText.startsWith('<html>')) {
|
|
18
|
+
// When fetching from RIO CDN, a default index page is returned when something cannot be found.
|
|
19
|
+
// Hence, we need to check for this to throw a proper error message.
|
|
20
|
+
throw new Error(`Could not load SVG with URL: ${url}`);
|
|
21
|
+
}
|
|
22
|
+
const parser = new DOMParser();
|
|
23
|
+
const doc = parser.parseFromString(svgText, 'image/svg+xml');
|
|
24
|
+
const svgNode = doc.querySelector('svg');
|
|
25
|
+
if (!svgNode) {
|
|
26
|
+
throw new Error('Invalid SVG format');
|
|
27
|
+
}
|
|
28
|
+
const attributes = convertAttributes(svgNode, colorMap);
|
|
29
|
+
const svgJsx = (_jsx("svg", { ...attributes, children: Array.from(svgNode.childNodes).map((node, idx) => node.nodeType === 1 ? (
|
|
30
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
|
|
31
|
+
_jsx(SvgElement, { node: node, colorMap: colorMap }, idx)) : null) }));
|
|
32
|
+
setSvgElement(svgJsx);
|
|
33
|
+
setError(false);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
console.error(`Error loading SVG "${name}":`, err);
|
|
37
|
+
setError(true);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
fetchSvg();
|
|
41
|
+
}, [name, baseUrl, colorMap]);
|
|
42
|
+
return { svgElement, error };
|
|
43
|
+
};
|
|
@@ -45,6 +45,10 @@ export type SwitchProps = {
|
|
|
45
45
|
* Possible values are `left` and `right`.
|
|
46
46
|
*/
|
|
47
47
|
labelPosition?: 'left' | 'right';
|
|
48
|
+
/**
|
|
49
|
+
* Additional class names added to the SVG element.
|
|
50
|
+
*/
|
|
51
|
+
className?: string;
|
|
48
52
|
};
|
|
49
53
|
declare const Switch: React.ForwardRefExoticComponent<PropsWithChildren<SwitchProps> & React.RefAttributes<HTMLDivElement>> & {
|
|
50
54
|
LABEL_POSITION_LEFT: "left";
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
//
|
|
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';
|
|
6
6
|
import { getCurrentBackgroundColor } from '../../utils/currentColors';
|
|
7
7
|
const Switch = forwardRef((props, ref) => {
|
|
8
|
-
const { keyName, checked = false, enabledText, minWidth = 40, disabled = false, color = 'primary', disabledText, children, labelPosition = children ? 'right' : undefined, onChange = noop, ...remainingProps } = props;
|
|
8
|
+
const { keyName, checked = false, enabledText, minWidth = 40, disabled = false, color = 'primary', disabledText, children, className = '', labelPosition = children ? 'right' : undefined, onChange = noop, ...remainingProps } = props;
|
|
9
9
|
const handleChange = (event) => {
|
|
10
10
|
onChange(event.target.checked);
|
|
11
11
|
};
|
|
12
12
|
const hasMultipleText = enabledText && disabledText;
|
|
13
13
|
const hasSingleText = enabledText && !disabledText;
|
|
14
|
+
const switchClasses = classNames('uikit-switch', className);
|
|
14
15
|
const switchLabelClasses = classNames('switch-label', disabled && 'cursor-not-allowed', labelPosition && `label-position-${labelPosition}`);
|
|
15
|
-
const switchContentClasses = classNames('switch-content'
|
|
16
|
-
// !hasMultipleText && !hasSingleText && 'width-40'
|
|
17
|
-
);
|
|
16
|
+
const switchContentClasses = classNames('switch-content');
|
|
18
17
|
const switchBackgroundColor = getCurrentBackgroundColor(color);
|
|
19
|
-
return (_jsx("div", { ref: ref, ...remainingProps, className:
|
|
18
|
+
return (_jsx("div", { ref: ref, ...remainingProps, className: switchClasses, children: _jsxs("label", { className: switchLabelClasses, children: [_jsx("input", { onChange: handleChange, checked: checked, type: 'checkbox', id: keyName, className: 'switch-input', disabled: disabled }, keyName), _jsxs("div", { className: switchContentClasses, style: { color: switchBackgroundColor, minWidth }, children: [hasMultipleText ? (_jsx("div", { className: 'switch-text', "data-on": enabledText, "data-off": disabledText })) : (hasSingleText && _jsx("div", { className: 'switch-text', "data-on": enabledText, "data-off": enabledText })), _jsx("div", { className: 'switch-handle' })] }), children && children] }) }));
|
|
20
19
|
});
|
|
21
20
|
Switch.LABEL_POSITION_LEFT = 'left';
|
|
22
21
|
Switch.LABEL_POSITION_RIGHT = 'right';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type ColumnDetails = {
|
|
2
|
+
[key: string]: number;
|
|
3
|
+
};
|
|
4
|
+
export type ColumnDetailsMap = {
|
|
5
|
+
[key: string]: ColumnDetails;
|
|
6
|
+
};
|
|
7
|
+
type TableColProps = {
|
|
8
|
+
/**
|
|
9
|
+
* The width of the column as part of the column details object used for the TableSettingsDialog.
|
|
10
|
+
*/
|
|
11
|
+
columnDetails?: ColumnDetails;
|
|
12
|
+
/**
|
|
13
|
+
* Additional classes added to the col tag element.
|
|
14
|
+
*/
|
|
15
|
+
className?: string;
|
|
16
|
+
};
|
|
17
|
+
declare const TableCol: ({ columnDetails, className, ...remainingProps }: TableColProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export default TableCol;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const TableCol = ({ columnDetails, className = '', ...remainingProps }) => {
|
|
3
|
+
const style = columnDetails?.width
|
|
4
|
+
? {
|
|
5
|
+
minWidth: columnDetails.width,
|
|
6
|
+
width: columnDetails.width,
|
|
7
|
+
}
|
|
8
|
+
: {};
|
|
9
|
+
return _jsx("col", { ...remainingProps, style: style, className: className });
|
|
10
|
+
};
|
|
11
|
+
export default TableCol;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
type TableHeadProps = {
|
|
3
|
+
/**
|
|
4
|
+
* The unique name of the column used as identifier
|
|
5
|
+
*/
|
|
6
|
+
column?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The label that shall be rendered in the table head next to the sorting icons.
|
|
9
|
+
*/
|
|
10
|
+
label?: string | React.ReactElement;
|
|
11
|
+
/**
|
|
12
|
+
* The string title of a column used as native title attribute on the th tag.
|
|
13
|
+
*/
|
|
14
|
+
title?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The sorting key stored as data attribute for later usage for click events.
|
|
17
|
+
*/
|
|
18
|
+
sortBy?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The column sorting direction.
|
|
21
|
+
*/
|
|
22
|
+
sortDir?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The click handler for the th tag.
|
|
25
|
+
*/
|
|
26
|
+
onClick?: (event: React.MouseEvent<HTMLTableCellElement>) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Additional class names assigned to the wrapper element.
|
|
29
|
+
*/
|
|
30
|
+
className?: string;
|
|
31
|
+
};
|
|
32
|
+
declare const TableHead: (props: PropsWithChildren<TableHeadProps>) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export default TableHead;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import SortArrows from './SortArrows';
|
|
4
|
+
const TableHead = (props) => {
|
|
5
|
+
const { column, title, label, sortBy, sortDir, onClick = () => { }, className = '', children, ...remainingProps } = props;
|
|
6
|
+
const tableHeadClassNames = classNames('user-select-none', 'sort-column', className);
|
|
7
|
+
const labelString = typeof label === 'string' ? label : '';
|
|
8
|
+
const thTitle = title ?? labelString;
|
|
9
|
+
return (_jsxs("th", { ...remainingProps, className: tableHeadClassNames, onClick: onClick, "data-field": column, "data-sortby": column, title: thTitle, children: [label && (_jsxs("span", { children: [column !== undefined && sortBy === column ? _jsx(SortArrows, { direction: sortDir }) : _jsx(SortArrows, {}), _jsx("span", { children: label })] })), children] }));
|
|
10
|
+
};
|
|
11
|
+
export default TableHead;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
//
|
|
2
|
+
// biome-ignore lint/style/useImportType: required for JSX runtime compatibility with older toolchains
|
|
3
3
|
import { useState, useEffect, useRef } from 'react';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import isEqual from 'lodash/fp/isEqual';
|
package/components/tag/Tag.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
//
|
|
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 Tag = forwardRef((props, ref) => {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type Props as InputMaskProps } from 'react-input-mask';
|
|
3
2
|
export type TimePickerProps = {
|
|
4
3
|
/**
|
|
5
4
|
* Value of the time as string. Note, when value is given the component is treated as controlled.
|
|
@@ -40,7 +39,7 @@ export type TimePickerProps = {
|
|
|
40
39
|
/**
|
|
41
40
|
* Additional properties to be set on the input element.
|
|
42
41
|
*/
|
|
43
|
-
inputProps?: Omit<
|
|
42
|
+
inputProps?: Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange'>;
|
|
44
43
|
/**
|
|
45
44
|
* Additional classes to be set on the wrapper element.
|
|
46
45
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import { IMask, IMaskInput } from 'react-imask';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import isNil from 'lodash/fp/isNil';
|
|
6
6
|
import isEmpty from 'lodash/fp/isEmpty';
|
|
@@ -8,7 +8,7 @@ import moment from 'moment';
|
|
|
8
8
|
import noop from 'lodash/fp/noop';
|
|
9
9
|
import invariant from 'tiny-invariant';
|
|
10
10
|
const MINUTES_OFFSET = 15;
|
|
11
|
-
const mask =
|
|
11
|
+
const mask = '00:00';
|
|
12
12
|
const fullRegexp = /^(?:\d|[01]\d|2[0-3]):[0-5]\d$/;
|
|
13
13
|
const getPadded = (value) => (value >= 10 ? `${value}` : `0${value}`);
|
|
14
14
|
const formatTimeString = (hours, minutes) => `${getPadded(hours)}:${getPadded(minutes)}`;
|
|
@@ -39,11 +39,23 @@ const TimePicker = (props) => {
|
|
|
39
39
|
onChange(value);
|
|
40
40
|
}
|
|
41
41
|
}, [value]);
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
if (
|
|
46
|
-
|
|
42
|
+
const handleFocus = (event) => {
|
|
43
|
+
const input = event.target;
|
|
44
|
+
// Check if value is empty or partially filled
|
|
45
|
+
if (!input.value || input.value.startsWith('-')) {
|
|
46
|
+
// Move cursor to the first empty position (usually 0)
|
|
47
|
+
// Timeout needed to wait for IMask internal focus handling
|
|
48
|
+
setTimeout(() => {
|
|
49
|
+
input.setSelectionRange(0, 0);
|
|
50
|
+
}, 0);
|
|
51
|
+
}
|
|
52
|
+
// If you want to preserve custom onFocus from props
|
|
53
|
+
inputProps.onFocus?.(event);
|
|
54
|
+
};
|
|
55
|
+
const handleAcceptTime = (val, maskRef) => {
|
|
56
|
+
setTimeValue(val);
|
|
57
|
+
if (maskRef.masked.isComplete) {
|
|
58
|
+
onChange(val);
|
|
47
59
|
}
|
|
48
60
|
};
|
|
49
61
|
const isValid = isTimeValid(timeValue);
|
|
@@ -67,6 +79,21 @@ const TimePicker = (props) => {
|
|
|
67
79
|
};
|
|
68
80
|
const { className: inputClassName, ...otherInputProps } = inputProps;
|
|
69
81
|
const hasFeedback = errorMessage || warningMessage;
|
|
70
|
-
return (_jsxs("div", { ...remainingProps, className: classNames('TimePicker', 'input-group', className), children: [showIcon && (_jsx("span", { className: 'input-group-addon', children: _jsx("span", { className: 'rioglyph rioglyph-time-alt' }) })), _jsxs("div", { className: 'form-control-feedback-wrapper', children: [_jsx(
|
|
82
|
+
return (_jsxs("div", { ...remainingProps, className: classNames('TimePicker', 'input-group', className), children: [showIcon && (_jsx("span", { className: 'input-group-addon', children: _jsx("span", { className: 'rioglyph rioglyph-time-alt' }) })), _jsxs("div", { className: 'form-control-feedback-wrapper', children: [_jsx(IMaskInput, { ...otherInputProps, className: classNames('TimePickerInput', 'form-control', inputClassName),
|
|
83
|
+
// mask={mask}
|
|
84
|
+
mask: 'HH:MM', blocks: {
|
|
85
|
+
HH: {
|
|
86
|
+
mask: IMask.MaskedRange,
|
|
87
|
+
from: 0,
|
|
88
|
+
to: 23,
|
|
89
|
+
maxLength: 2,
|
|
90
|
+
},
|
|
91
|
+
MM: {
|
|
92
|
+
mask: IMask.MaskedRange,
|
|
93
|
+
from: 0,
|
|
94
|
+
to: 59,
|
|
95
|
+
maxLength: 2,
|
|
96
|
+
},
|
|
97
|
+
}, value: timeValue, onAccept: handleAcceptTime, onFocus: handleFocus, lazy: !alwaysShowMask, placeholderChar: '-', overwrite: true }), hasFeedback && (_jsxs(_Fragment, { children: [errorMessage && _jsx("span", { className: 'form-control-feedback rioglyph rioglyph-error-sign' }), warningMessage && _jsx("span", { className: 'form-control-feedback rioglyph rioglyph-warning-sign' }), _jsx("span", { className: `help-block white-space-${messageWhiteSpace}`, children: _jsx("span", { children: errorMessage || warningMessage }) })] }))] }), isValid && (_jsxs("div", { className: 'TimePickerIncreaseButton input-group-addon', children: [_jsx("div", { className: 'text-color-gray hover-text-color-dark display-grid place-items-center cursor-pointer', onClick: handleDecrease, children: _jsx("div", { className: 'rioglyph rioglyph-chevron-left scale-90' }) }), _jsx("div", { className: 'text-color-gray hover-text-color-dark margin-left-5 display-grid place-items-center cursor-pointer', onClick: handleIncrease, children: _jsx("div", { className: 'rioglyph rioglyph-chevron-right scale-90' }) })] }))] }));
|
|
71
98
|
};
|
|
72
99
|
export default TimePicker;
|
|
@@ -21,7 +21,7 @@ export type SimpleTooltipProps = Omit<TooltipProps, 'content'> & {
|
|
|
21
21
|
*/
|
|
22
22
|
targetRef?: MutableRefObject<HTMLDivElement>;
|
|
23
23
|
/**
|
|
24
|
-
* A millisecond delay amount to show
|
|
24
|
+
* A millisecond delay amount to show the Overlay once triggered.
|
|
25
25
|
* If passed an Object, you can control the show and hide timeouts individually.
|
|
26
26
|
*/
|
|
27
27
|
delay?: number | delayProp;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
//
|
|
2
|
+
// biome-ignore lint/style/useImportType: required for JSX runtime compatibility with older toolchains
|
|
3
3
|
import { useRef, useState, useEffect, useCallback } from 'react';
|
|
4
4
|
import VirtualListItemWrapper from './VirtualListItemWrapper';
|
|
5
5
|
import useWindowResize from '../../hooks/useWindowResize';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
type UseIsFocusWithinOptions<T extends HTMLElement> = {
|
|
2
|
+
/**
|
|
3
|
+
* Optional external ref to the DOM element to track.
|
|
4
|
+
* If not provided, the hook will return its own internal ref.
|
|
5
|
+
*/
|
|
6
|
+
ref?: React.RefObject<T>;
|
|
7
|
+
/**
|
|
8
|
+
* Optional callback triggered when focus enters the element or its children.
|
|
9
|
+
*/
|
|
10
|
+
onFocusWithin?: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Optional callback triggered when focus leaves the element and all its children.
|
|
13
|
+
*/
|
|
14
|
+
onBlurWithin?: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* Optional delay (in ms) before calling onBlurWithin.
|
|
17
|
+
* Useful when focus might quickly shift between internal elements.
|
|
18
|
+
* @default 0
|
|
19
|
+
*/
|
|
20
|
+
delay?: number;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* React hook that tracks whether focus is currently within a given element or its children.
|
|
24
|
+
* Provides a boolean state and a ref to attach to the tracked element.
|
|
25
|
+
*
|
|
26
|
+
* @param options Hook configuration including external ref, callbacks, and optional delay.
|
|
27
|
+
* @returns An object containing the ref and whether focus is currently within the element.
|
|
28
|
+
*/
|
|
29
|
+
declare const useIsFocusWithin: <T extends HTMLElement>({ ref: externalRef, onFocusWithin, onBlurWithin, delay, }?: UseIsFocusWithinOptions<T>) => {
|
|
30
|
+
ref: import("react").RefObject<T>;
|
|
31
|
+
isFocusedWithin: boolean;
|
|
32
|
+
};
|
|
33
|
+
export default useIsFocusWithin;
|