@rio-cloud/rio-uikit 1.2.2 → 1.3.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/.DS_Store +0 -0
- package/DateRangePicker.d.ts +6 -7
- package/DateRangePicker.js +7 -3
- package/README.md +3 -3
- package/components/actionBarItem/ActionBarItem.js +5 -1
- package/components/actionBarItem/ActionBarItemIcon.d.ts +6 -8
- package/components/actionBarItem/ActionBarItemIcon.js +4 -4
- package/components/actionBarItem/ActionBarOverlay.d.ts +3 -2
- package/components/actionBarItem/ActionBarOverlay.js +7 -7
- package/components/applicationLayout/ApplicationLayout.js +1 -0
- package/components/applicationLayout/ApplicationLayoutHeader.js +0 -4
- package/components/assetTree/TreeOptions.js +1 -1
- package/components/assetTree/treeUtils.js +1 -1
- package/components/calendarStripe/CalendarStripe.d.ts +8 -0
- package/components/calendarStripe/CalendarStripe.js +7 -4
- package/components/dataTabs/DataTab.js +2 -1
- package/components/dialog/SimpleDialog.d.ts +2 -2
- package/components/dialog/SplitDialog.d.ts +6 -0
- package/components/expander/ExpanderList.js +2 -1
- package/components/listMenu/ListMenu.js +1 -1
- package/components/onboarding/OnboardingTip.d.ts +2 -2
- package/components/onboarding/OnboardingTip.js +2 -0
- package/components/overlay/OverlayTrigger.d.ts +92 -3
- package/components/overlay/OverlayTrigger.js +140 -8
- package/components/popover/Popover.d.ts +27 -9
- package/components/popover/Popover.js +18 -5
- package/components/slider/RangeSlider.d.ts +7 -0
- package/components/slider/RangeSlider.js +10 -4
- package/components/slider/Slider.d.ts +7 -0
- package/components/slider/Slider.js +5 -3
- package/components/states/CustomState.js +4 -5
- package/components/switch/Switch.d.ts +7 -0
- package/components/switch/Switch.js +4 -3
- package/components/tooltip/SimpleTooltip.d.ts +2 -2
- package/components/tooltip/Tooltip.d.ts +2 -2
- package/components/tooltip/Tooltip.js +6 -2
- package/hooks/useClickOutside.d.ts +1 -0
- package/hooks/useClickOutside.js +9 -3
- package/hooks/useElapsedTime.d.ts +26 -0
- package/hooks/useElapsedTime.js +36 -0
- package/hooks/useEvent.d.ts +1 -1
- package/hooks/useTimeout.d.ts +5 -0
- package/hooks/useTimeout.js +39 -1
- package/hooks/useUncontrollable.d.ts +13 -0
- package/hooks/useUncontrollable.js +41 -0
- package/lib/es/DateRangePicker.d.ts +6 -7
- package/lib/es/DateRangePicker.js +5 -1
- package/lib/es/components/actionBarItem/ActionBarItem.js +5 -1
- package/lib/es/components/actionBarItem/ActionBarItemIcon.d.ts +6 -8
- package/lib/es/components/actionBarItem/ActionBarItemIcon.js +4 -4
- package/lib/es/components/actionBarItem/ActionBarOverlay.d.ts +3 -2
- package/lib/es/components/actionBarItem/ActionBarOverlay.js +7 -7
- package/lib/es/components/applicationLayout/ApplicationLayout.js +1 -0
- package/lib/es/components/applicationLayout/ApplicationLayoutHeader.js +0 -4
- package/lib/es/components/assetTree/TreeOptions.js +1 -1
- package/lib/es/components/assetTree/treeUtils.js +1 -1
- package/lib/es/components/calendarStripe/CalendarStripe.d.ts +8 -0
- package/lib/es/components/calendarStripe/CalendarStripe.js +7 -4
- package/lib/es/components/dataTabs/DataTab.js +2 -1
- package/lib/es/components/dialog/SimpleDialog.d.ts +2 -2
- package/lib/es/components/dialog/SplitDialog.d.ts +6 -0
- package/lib/es/components/expander/ExpanderList.js +2 -1
- package/lib/es/components/listMenu/ListMenu.js +1 -1
- package/lib/es/components/onboarding/OnboardingTip.d.ts +2 -2
- package/lib/es/components/onboarding/OnboardingTip.js +2 -0
- package/lib/es/components/overlay/OverlayTrigger.d.ts +92 -3
- package/lib/es/components/overlay/OverlayTrigger.js +139 -7
- package/lib/es/components/popover/Popover.d.ts +27 -9
- package/lib/es/components/popover/Popover.js +20 -6
- package/lib/es/components/slider/RangeSlider.d.ts +7 -0
- package/lib/es/components/slider/RangeSlider.js +10 -4
- package/lib/es/components/slider/Slider.d.ts +7 -0
- package/lib/es/components/slider/Slider.js +5 -3
- package/lib/es/components/states/CustomState.js +4 -5
- package/lib/es/components/switch/Switch.d.ts +7 -0
- package/lib/es/components/switch/Switch.js +4 -3
- package/lib/es/components/tooltip/SimpleTooltip.d.ts +2 -2
- package/lib/es/components/tooltip/Tooltip.d.ts +2 -2
- package/lib/es/components/tooltip/Tooltip.js +5 -1
- package/lib/es/hooks/useClickOutside.d.ts +1 -0
- package/lib/es/hooks/useClickOutside.js +11 -3
- package/lib/es/hooks/useElapsedTime.d.ts +26 -0
- package/lib/es/hooks/useElapsedTime.js +38 -0
- package/lib/es/hooks/useEvent.d.ts +1 -1
- package/lib/es/hooks/useTimeout.d.ts +5 -0
- package/lib/es/hooks/useTimeout.js +40 -0
- package/lib/es/hooks/useUncontrollable.d.ts +13 -0
- package/lib/es/hooks/useUncontrollable.js +46 -0
- package/lib/es/styles/variables/colors/colors.json +3 -3
- package/lib/es/useElapsedTime.d.ts +2 -0
- package/lib/es/useElapsedTime.js +7 -0
- package/lib/es/utils/currentColors.d.ts +3 -0
- package/lib/es/utils/currentColors.js +14 -0
- package/lib/es/utils/hasUtilityClass.d.ts +30 -0
- package/lib/es/utils/hasUtilityClass.js +71 -0
- package/lib/es/utils/init/initCSS.js +12 -0
- package/lib/es/utils/mergeRefs.d.ts +1 -1
- package/lib/es/values/Trigger.d.ts +1 -2
- package/lib/es/version.json +1 -1
- package/package.json +18 -12
- package/styles/variables/colors/colors.json +3 -3
- package/useElapsedTime.d.ts +2 -0
- package/useElapsedTime.js +2 -0
- package/utils/currentColors.d.ts +3 -0
- package/utils/currentColors.js +10 -0
- package/utils/hasUtilityClass.d.ts +30 -0
- package/utils/hasUtilityClass.js +40 -0
- package/utils/init/initCSS.js +12 -0
- package/utils/mergeRefs.d.ts +1 -1
- package/values/Trigger.d.ts +1 -2
- package/version.json +1 -1
- package/components/.DS_Store +0 -0
- package/components/feedback/Feedback.d.ts +0 -2
- package/components/feedback/Feedback.js +0 -5
- package/components/map/.DS_Store +0 -0
- package/components/map/components/.DS_Store +0 -0
- package/lib/.DS_Store +0 -0
- package/lib/es/.DS_Store +0 -0
- package/lib/es/components/.DS_Store +0 -0
- package/lib/es/components/feedback/Feedback.d.ts +0 -2
- package/lib/es/components/feedback/Feedback.js +0 -7
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PLACEMENT_MAP = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
|
|
6
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
require("framer-motion");
|
|
7
8
|
const Placement_1 = require("../../values/Placement");
|
|
8
|
-
|
|
9
|
+
exports.PLACEMENT_MAP = {
|
|
9
10
|
AUTO: Placement_1.PLACEMENT.AUTO,
|
|
10
11
|
TOP: Placement_1.PLACEMENT.TOP,
|
|
11
12
|
RIGHT: Placement_1.PLACEMENT.RIGHT,
|
|
12
13
|
BOTTOM: Placement_1.PLACEMENT.BOTTOM,
|
|
13
14
|
LEFT: Placement_1.PLACEMENT.LEFT,
|
|
14
15
|
};
|
|
16
|
+
const PopoverTitle = ({ className = '', children }) => ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: `popover-header popover-title ${className}` }, { children: children })));
|
|
17
|
+
const PopoverContent = ({ className = '', children }) => ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: `popover-content popover-body ${className}` }, { children: children })));
|
|
18
|
+
const isPopoverTitleOrContent = (element) => {
|
|
19
|
+
return (0, react_1.isValidElement)(element) && (element.type === PopoverTitle || element.type === PopoverContent);
|
|
20
|
+
};
|
|
15
21
|
const Popover = (0, react_1.forwardRef)((props, ref) => {
|
|
16
|
-
const { title, titleClassName = '', contentClassName = '', children } = props, remainingProps = tslib_1.__rest(props, ["title", "titleClassName", "contentClassName", "children"]);
|
|
17
|
-
|
|
22
|
+
const { placement = 'bottom', arrowProps, title, titleClassName = '', contentClassName = '', children, className = '' } = props, remainingProps = tslib_1.__rest(props, ["placement", "arrowProps", "title", "titleClassName", "contentClassName", "children", "className"]);
|
|
23
|
+
const hasTitle = !!title;
|
|
24
|
+
const hasCustomContent = react_1.default.Children.toArray(children).some(isPopoverTitleOrContent);
|
|
25
|
+
// Mount the component but don't show it yet via CSS.
|
|
26
|
+
// After it is mounted, we set the visibility class to use CSS animation
|
|
27
|
+
const [isMounted, setIsMounted] = (0, react_1.useState)(false);
|
|
28
|
+
(0, react_1.useEffect)(() => setIsMounted(true), []);
|
|
29
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, remainingProps, { role: 'tooltip', "x-placement": placement, ref: ref, className: `popover fade ${isMounted ? 'show' : ''} ${className}` }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'arrow' }, arrowProps)), hasTitle && (0, jsx_runtime_1.jsx)(PopoverTitle, Object.assign({ className: titleClassName }, { children: title })), hasCustomContent ? children : (0, jsx_runtime_1.jsx)(PopoverContent, Object.assign({ className: contentClassName }, { children: children }))] })));
|
|
18
30
|
});
|
|
19
|
-
|
|
31
|
+
Popover.Title = PopoverTitle;
|
|
32
|
+
Popover.Content = PopoverContent;
|
|
33
|
+
Object.assign(Popover, exports.PLACEMENT_MAP);
|
|
20
34
|
exports.default = Popover;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { type HTMLAttributes } from 'react';
|
|
2
|
+
import { type CurrentColor } from '../../utils/currentColors';
|
|
2
3
|
export type RangeSliderProps = {
|
|
3
4
|
/**
|
|
4
5
|
* The current left value of the selected range.
|
|
@@ -36,6 +37,12 @@ export type RangeSliderProps = {
|
|
|
36
37
|
* @default 1
|
|
37
38
|
*/
|
|
38
39
|
step?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Defines the color of the slider.
|
|
42
|
+
*
|
|
43
|
+
* @default 'primary'
|
|
44
|
+
*/
|
|
45
|
+
color?: CurrentColor;
|
|
39
46
|
/**
|
|
40
47
|
* Disables all pointer events.
|
|
41
48
|
*
|
|
@@ -5,13 +5,14 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
7
7
|
const noop_1 = tslib_1.__importDefault(require("lodash/noop"));
|
|
8
|
+
const currentColors_1 = require("../../utils/currentColors");
|
|
8
9
|
const getRangeValues = (valueLeft, valueRight) => {
|
|
9
10
|
const finalLeftValue = valueRight <= valueLeft ? valueRight : valueLeft;
|
|
10
11
|
const finalRightValue = valueLeft >= valueRight ? valueLeft : valueRight;
|
|
11
12
|
return [finalLeftValue, finalRightValue];
|
|
12
13
|
};
|
|
13
14
|
const RangeSlider = (props) => {
|
|
14
|
-
const { minValue = 0, maxValue = Number.MAX_VALUE, valueLabels = false, valueLabelUnit, step = 1, leftValue, rightValue, className, disabled = false, onChange = noop_1.default, onDragEnd = noop_1.default } = props, remainingProps = tslib_1.__rest(props, ["minValue", "maxValue", "valueLabels", "valueLabelUnit", "step", "leftValue", "rightValue", "className", "disabled", "onChange", "onDragEnd"]);
|
|
15
|
+
const { minValue = 0, maxValue = Number.MAX_VALUE, valueLabels = false, valueLabelUnit, step = 1, color = 'primary', leftValue, rightValue, className, disabled = false, onChange = noop_1.default, onDragEnd = noop_1.default } = props, remainingProps = tslib_1.__rest(props, ["minValue", "maxValue", "valueLabels", "valueLabelUnit", "step", "color", "leftValue", "rightValue", "className", "disabled", "onChange", "onDragEnd"]);
|
|
15
16
|
const [activeLeft, setActiveLeft] = (0, react_1.useState)(false);
|
|
16
17
|
const [activeRight, setActiveRight] = (0, react_1.useState)(false);
|
|
17
18
|
const [valueLeft, setValueLeft] = (0, react_1.useState)(leftValue ? leftValue : minValue);
|
|
@@ -34,8 +35,12 @@ const RangeSlider = (props) => {
|
|
|
34
35
|
const [newLeftValue, newRightValue] = getRangeValues(newValueLeft, newValueRight);
|
|
35
36
|
onChange(newLeftValue, newRightValue);
|
|
36
37
|
};
|
|
37
|
-
const handleChangeValueLeft = (event) =>
|
|
38
|
-
|
|
38
|
+
const handleChangeValueLeft = (event) => {
|
|
39
|
+
changeValues({ valueLeft: Number.parseInt(event.target.value, 10) });
|
|
40
|
+
};
|
|
41
|
+
const handleChangeValueRight = (event) => {
|
|
42
|
+
changeValues({ valueRight: Number.parseInt(event.target.value, 10) });
|
|
43
|
+
};
|
|
39
44
|
const onMouseDownLeft = () => {
|
|
40
45
|
setIsChangingLeft(true);
|
|
41
46
|
setIsChangingRight(false);
|
|
@@ -100,6 +105,7 @@ const RangeSlider = (props) => {
|
|
|
100
105
|
const trackWidth = (100 * (finalRightValue - finalLeftValue)) / (maxValue - minValue);
|
|
101
106
|
const trackLeft = (100 * (finalLeftValue - minValue)) / (maxValue - minValue);
|
|
102
107
|
const wrapperClassNames = (0, classnames_1.default)('range-slider', disabled && 'disabled', valueLabels && 'show-value-labels', className && className);
|
|
103
|
-
|
|
108
|
+
const sliderBackgroundColor = (0, currentColors_1.getCurrentBackgroundColor)(color);
|
|
109
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, remainingProps, { className: wrapperClassNames, style: { color: sliderBackgroundColor } }, { children: [(0, jsx_runtime_1.jsx)("div", { className: 'range-whole-track' }), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'range-track', style: { width: `${trackWidth}%`, left: `${trackLeft}%` } }, { children: valueLabels && ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'user-select-none' }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'range-value' }, { children: (0, jsx_runtime_1.jsx)("span", { children: valueLabelUnit ? `${finalLeftValue} ${valueLabelUnit}` : finalLeftValue }) })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'range-value' }, { children: (0, jsx_runtime_1.jsx)("span", { children: valueLabelUnit ? `${finalRightValue} ${valueLabelUnit}` : finalRightValue }) }))] }))) })), (0, jsx_runtime_1.jsx)("input", { className: `${isChangingLeft ? 'changing' : ''}`, style: { zIndex: activeLeft ? '6' : '5' }, value: valueLeft, min: minValue, max: maxValue, step: step, type: 'range', onChange: handleChangeValueLeft, onMouseDown: onMouseDownLeft, onMouseMove: onMouseMoveLeft, onMouseUp: onMouseUpLeft }), (0, jsx_runtime_1.jsx)("input", { className: `${isChangingRight ? 'changing' : ''}`, style: { zIndex: activeRight ? '6' : '5' }, value: valueRight, min: minValue, max: maxValue, step: step, type: 'range', onChange: handleChangeValueRight, onMouseDown: onMouseDownRight, onMouseMove: onMouseMoveRight, onMouseUp: onMouseUpRight })] })));
|
|
104
110
|
};
|
|
105
111
|
exports.default = RangeSlider;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { type HTMLAttributes } from 'react';
|
|
2
|
+
import { type CurrentColor } from '../../utils/currentColors';
|
|
2
3
|
export type SliderProps = {
|
|
3
4
|
/**
|
|
4
5
|
* The current value.
|
|
@@ -46,6 +47,12 @@ export type SliderProps = {
|
|
|
46
47
|
* @default 1
|
|
47
48
|
*/
|
|
48
49
|
step?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Defines the color of the slider.
|
|
52
|
+
*
|
|
53
|
+
* @default 'primary'
|
|
54
|
+
*/
|
|
55
|
+
color?: CurrentColor;
|
|
49
56
|
/**
|
|
50
57
|
* Disables all pointer events.
|
|
51
58
|
*
|
|
@@ -5,8 +5,9 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
7
7
|
const noop_1 = tslib_1.__importDefault(require("lodash/noop"));
|
|
8
|
+
const currentColors_1 = require("../../utils/currentColors");
|
|
8
9
|
const Slider = (props) => {
|
|
9
|
-
const { value = 0, minValue = 0, maxValue = Number.MAX_VALUE, valueLabels = false, valueLabelUnit, largeValueLabels = false, hideValueBar = false, step = 1, onChange = noop_1.default, onDragEnd = noop_1.default, className, disabled = false } = props, remainingProps = tslib_1.__rest(props, ["value", "minValue", "maxValue", "valueLabels", "valueLabelUnit", "largeValueLabels", "hideValueBar", "step", "onChange", "onDragEnd", "className", "disabled"]);
|
|
10
|
+
const { value = 0, minValue = 0, maxValue = Number.MAX_VALUE, valueLabels = false, valueLabelUnit, largeValueLabels = false, hideValueBar = false, color = 'primary', step = 1, onChange = noop_1.default, onDragEnd = noop_1.default, className, disabled = false } = props, remainingProps = tslib_1.__rest(props, ["value", "minValue", "maxValue", "valueLabels", "valueLabelUnit", "largeValueLabels", "hideValueBar", "color", "step", "onChange", "onDragEnd", "className", "disabled"]);
|
|
10
11
|
const [currentValue, setCurrentValue] = (0, react_1.useState)(value ? value : minValue);
|
|
11
12
|
const [isChanging, setIsChanging] = (0, react_1.useState)(false);
|
|
12
13
|
(0, react_1.useEffect)(() => {
|
|
@@ -15,7 +16,7 @@ const Slider = (props) => {
|
|
|
15
16
|
}
|
|
16
17
|
}, [value, minValue, maxValue]);
|
|
17
18
|
const handleChange = (event) => {
|
|
18
|
-
const newValue = parseInt(event.target.value, 10);
|
|
19
|
+
const newValue = Number.parseInt(event.target.value, 10);
|
|
19
20
|
setCurrentValue(newValue);
|
|
20
21
|
setIsChanging(true);
|
|
21
22
|
onChange(newValue);
|
|
@@ -29,6 +30,7 @@ const Slider = (props) => {
|
|
|
29
30
|
};
|
|
30
31
|
const wrapperClassNames = (0, classnames_1.default)('range-slider', disabled && 'disabled', valueLabels && 'show-value-labels', hideValueBar && 'hide-value-bar', largeValueLabels && 'large-value-labels', className && className);
|
|
31
32
|
const trackWidth = (100 * (currentValue - minValue)) / (maxValue - minValue);
|
|
32
|
-
|
|
33
|
+
const sliderBackgroundColor = (0, currentColors_1.getCurrentBackgroundColor)(color);
|
|
34
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, remainingProps, { className: wrapperClassNames, style: { color: sliderBackgroundColor } }, { children: [(0, jsx_runtime_1.jsx)("div", { className: 'range-whole-track' }), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'range-track', style: { width: `${trackWidth}%` } }, { children: valueLabels && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'range-value' }, { children: (0, jsx_runtime_1.jsx)("span", { children: valueLabelUnit ? `${currentValue} ${valueLabelUnit}` : currentValue }) }))) })), (0, jsx_runtime_1.jsx)("input", { className: `${isChanging ? 'changing' : ''}`, value: currentValue, min: minValue, max: maxValue, step: step, type: 'range', onChange: handleChange, onMouseDown: onMouseDown, onMouseUp: onMouseUp })] })));
|
|
33
35
|
};
|
|
34
36
|
exports.default = Slider;
|
|
@@ -8,6 +8,7 @@ const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
|
8
8
|
const isEmpty_1 = tslib_1.__importDefault(require("lodash/fp/isEmpty"));
|
|
9
9
|
const StateButton_1 = tslib_1.__importDefault(require("./StateButton"));
|
|
10
10
|
const StateIcon_1 = tslib_1.__importDefault(require("./StateIcon"));
|
|
11
|
+
const hasUtilityClass_1 = require("../../utils/hasUtilityClass");
|
|
11
12
|
const justify = {
|
|
12
13
|
left: 'justify-content-start',
|
|
13
14
|
center: 'justify-content-center',
|
|
@@ -28,11 +29,9 @@ const renderButtons = (buttons) => {
|
|
|
28
29
|
}) }))] }));
|
|
29
30
|
};
|
|
30
31
|
const CustomState = (props) => {
|
|
31
|
-
const { icon, icons = [], image, headline, message, buttons = [], alignment = 'center', fullWidth = false, condensed = false, outerClassName, innerClassName, children } = props, remainingProps = tslib_1.__rest(props, ["icon", "icons", "image", "headline", "message", "buttons", "alignment", "fullWidth", "condensed", "outerClassName", "innerClassName", "children"]);
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const wrapperClasses = (0, classnames_1.default)('margin-0', 'width-100pct', !fullWidth && 'max-width-600', 'panel-default', 'panel', !hasCustomOuterPadding && condensed ? 'padding-10' : 'padding-15', outerClassName && outerClassName);
|
|
35
|
-
const innerClassNames = (0, classnames_1.default)('display-flex', 'flex-column', 'align-items-center', 'text-center', !hasCustomInnerPadding && condensed ? 'padding-15' : 'padding-25', innerClassName && innerClassName);
|
|
32
|
+
const { icon, icons = [], image, headline, message, buttons = [], alignment = 'center', fullWidth = false, condensed = false, outerClassName = '', innerClassName = '', children } = props, remainingProps = tslib_1.__rest(props, ["icon", "icons", "image", "headline", "message", "buttons", "alignment", "fullWidth", "condensed", "outerClassName", "innerClassName", "children"]);
|
|
33
|
+
const wrapperClasses = (0, classnames_1.default)('margin-0', 'width-100pct', !fullWidth && 'max-width-600', 'panel-default', 'panel', !(0, hasUtilityClass_1.hasPaddingClass)(outerClassName) && condensed ? 'padding-10' : 'padding-15', outerClassName);
|
|
34
|
+
const innerClassNames = (0, classnames_1.default)('display-flex', 'flex-column', 'align-items-center', 'text-center', !(0, hasUtilityClass_1.hasPaddingClass)(innerClassName) && condensed ? 'padding-15' : 'padding-25', innerClassName);
|
|
36
35
|
const iconClasses = (0, classnames_1.default)(condensed ? 'text-size-16 margin-bottom-10' : 'text-size-h2 margin-bottom-20');
|
|
37
36
|
const iconsClasses = (0, classnames_1.default)(condensed ? 'text-size-16 margin-bottom-10' : 'text-size-h2 margin-bottom-20', 'display-flex', 'align-items-center', 'max-width-100pct');
|
|
38
37
|
const headlineClassNames = (0, classnames_1.default)(condensed ? 'text-size-h4' : 'text-size-h3 text-size-h2-xl', 'line-height-125rel', 'text-color-dark', 'text-medium', 'width-500', 'max-width-100pct', 'text-wrap-balance');
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type PropsWithChildren } from 'react';
|
|
2
|
+
import { type CurrentColor } from '../../utils/currentColors';
|
|
2
3
|
export type SwitchProps = {
|
|
3
4
|
/**
|
|
4
5
|
* Optional key that is used as key and as the id on the internal input.
|
|
@@ -14,6 +15,12 @@ export type SwitchProps = {
|
|
|
14
15
|
* @default false
|
|
15
16
|
*/
|
|
16
17
|
checked?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Defines the color of the switch.
|
|
20
|
+
*
|
|
21
|
+
* @default 'primary'
|
|
22
|
+
*/
|
|
23
|
+
color?: CurrentColor;
|
|
17
24
|
/**
|
|
18
25
|
* The min-width of the switch.
|
|
19
26
|
*/
|
|
@@ -6,8 +6,9 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
6
6
|
require("react");
|
|
7
7
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
8
8
|
const noop_1 = tslib_1.__importDefault(require("lodash/fp/noop"));
|
|
9
|
+
const currentColors_1 = require("../../utils/currentColors");
|
|
9
10
|
const Switch = (props) => {
|
|
10
|
-
const { keyName, checked = false, enabledText, minWidth = 40, disabled = false, disabledText, children, labelPosition = !!children ? 'right' : undefined, onChange = noop_1.default } = props, remainingProps = tslib_1.__rest(props, ["keyName", "checked", "enabledText", "minWidth", "disabled", "disabledText", "children", "labelPosition", "onChange"]);
|
|
11
|
+
const { keyName, checked = false, enabledText, minWidth = 40, disabled = false, color = 'primary', disabledText, children, labelPosition = !!children ? 'right' : undefined, onChange = noop_1.default } = props, remainingProps = tslib_1.__rest(props, ["keyName", "checked", "enabledText", "minWidth", "disabled", "color", "disabledText", "children", "labelPosition", "onChange"]);
|
|
11
12
|
const handleChange = (event) => {
|
|
12
13
|
onChange(event.target.checked);
|
|
13
14
|
};
|
|
@@ -17,8 +18,8 @@ const Switch = (props) => {
|
|
|
17
18
|
const switchContentClasses = (0, classnames_1.default)('switch-content'
|
|
18
19
|
// !hasMultipleText && !hasSingleText && 'width-40'
|
|
19
20
|
);
|
|
20
|
-
const
|
|
21
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, remainingProps, { className: 'uikit-switch' }, { children: (0, jsx_runtime_1.jsxs)("label", Object.assign({ className: switchLabelClasses }, { children: [(0, jsx_runtime_1.jsx)("input", { onChange: handleChange, checked: checked, type: 'checkbox', id: keyName, className: 'switch-input', disabled: disabled }, keyName), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: switchContentClasses, style:
|
|
21
|
+
const switchBackgroundColor = (0, currentColors_1.getCurrentBackgroundColor)(color);
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, remainingProps, { className: 'uikit-switch' }, { children: (0, jsx_runtime_1.jsxs)("label", Object.assign({ className: switchLabelClasses }, { children: [(0, jsx_runtime_1.jsx)("input", { onChange: handleChange, checked: checked, type: 'checkbox', id: keyName, className: 'switch-input', disabled: disabled }, keyName), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: switchContentClasses, style: { color: switchBackgroundColor, minWidth } }, { children: [hasMultipleText ? ((0, jsx_runtime_1.jsx)("div", { className: 'switch-text', "data-on": enabledText, "data-off": disabledText })) : (hasSingleText && (0, jsx_runtime_1.jsx)("div", { className: 'switch-text', "data-on": enabledText, "data-off": enabledText })), (0, jsx_runtime_1.jsx)("div", { className: 'switch-handle' })] })), children && children] })) })));
|
|
22
23
|
};
|
|
23
24
|
Switch.LABEL_POSITION_LEFT = 'left';
|
|
24
25
|
Switch.LABEL_POSITION_RIGHT = 'right';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { type MutableRefObject, type PropsWithChildren } from 'react';
|
|
2
2
|
import { type TooltipProps } from './Tooltip';
|
|
3
|
-
import { type
|
|
3
|
+
import { type TriggerType } from '../../values/Trigger';
|
|
4
4
|
export type delayProp = {
|
|
5
5
|
show: number;
|
|
6
6
|
hide: number;
|
|
@@ -15,7 +15,7 @@ export type SimpleTooltipProps = Omit<TooltipProps, 'content'> & {
|
|
|
15
15
|
* Possible values are: `hover`, `click`, `focus`
|
|
16
16
|
* @default 'hover'
|
|
17
17
|
*/
|
|
18
|
-
trigger?:
|
|
18
|
+
trigger?: TriggerType;
|
|
19
19
|
/**
|
|
20
20
|
* The react ref object assigned to the target of the tooltip.
|
|
21
21
|
*/
|
|
@@ -47,9 +47,9 @@ export type TooltipProps = {
|
|
|
47
47
|
*/
|
|
48
48
|
allowOnTouch?: boolean;
|
|
49
49
|
/**
|
|
50
|
-
* Additional props assigned to the arrow element.
|
|
50
|
+
* Additional props assigned to the arrow element. Internally used.
|
|
51
51
|
*/
|
|
52
|
-
arrowProps?:
|
|
52
|
+
arrowProps?: Record<string, unknown>;
|
|
53
53
|
/**
|
|
54
54
|
* Additional style properties assigned to the wrapper element.
|
|
55
55
|
*/
|
|
@@ -19,13 +19,17 @@ const TEXT_ALIGNMENT_MAP = {
|
|
|
19
19
|
};
|
|
20
20
|
const Tooltip = (0, react_1.forwardRef)((props, ref) => {
|
|
21
21
|
const _a = (0, omit_1.default)(['popper', 'positionLeft', 'positionTop'], props), { allowOnTouch = false, arrowProps, children, className = '', innerClassName = '', placement = 'bottom', style, textAlignment = 'center', tooltipStyle = 'default', width = 'auto' } = _a, remainingProps = tslib_1.__rest(_a, ["allowOnTouch", "arrowProps", "children", "className", "innerClassName", "placement", "style", "textAlignment", "tooltipStyle", "width"]);
|
|
22
|
+
// Mount the component but don't show it yet via CSS.
|
|
23
|
+
// After it is mounted, we set the visibility class to use CSS animation
|
|
24
|
+
const [isMounted, setIsMounted] = (0, react_1.useState)(false);
|
|
25
|
+
(0, react_1.useEffect)(() => setIsMounted(true), []);
|
|
22
26
|
if (!(0, deviceUtils_1.isDesktop)() && !allowOnTouch) {
|
|
23
27
|
// Workaround: we have to return a DOM node as otherwise the
|
|
24
28
|
// react-transition library would throw an error on mobile
|
|
25
29
|
// when triggering a browser reflow and accessing the node directly.
|
|
26
30
|
return (0, jsx_runtime_1.jsx)("span", { className: 'display-none' });
|
|
27
31
|
}
|
|
28
|
-
const wrapperClasses = (0, classnames_1.default)('tooltip', tooltipStyle && `tooltip-${tooltipStyle}`, placement, className);
|
|
32
|
+
const wrapperClasses = (0, classnames_1.default)('tooltip', tooltipStyle && `tooltip-${tooltipStyle}`, placement, 'fade', isMounted && 'show', className);
|
|
29
33
|
const innerClasses = (0, classnames_1.default)('tooltip-inner', textAlignment && `text-${textAlignment}`, width && `width-${width}`, innerClassName && innerClassName);
|
|
30
34
|
/* eslint-disable react/no-unknown-property */
|
|
31
35
|
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, remainingProps, { role: 'tooltip', "x-placement": placement, ref: ref, className: wrapperClasses, style: Object.assign({}, style), "data-offset": 20 }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'tooltip-arrow' }, arrowProps)), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: innerClasses }, { children: children }))] })));
|
|
@@ -9,4 +9,5 @@ export type EventListenerType = keyof DocumentEventMap;
|
|
|
9
9
|
* @returns A mutable ref object representing the target element.
|
|
10
10
|
*/
|
|
11
11
|
declare const useClickOutside: <T extends HTMLElement = any>(callback: (event: MouseEvent | TouchEvent) => void, events?: EventListenerType[]) => import("react").MutableRefObject<T>;
|
|
12
|
+
export declare const useClickOutsideWithRef: <T extends HTMLElement = any>(ref: React.MutableRefObject<HTMLElement | null> | HTMLElement | null, callback: (event: MouseEvent | TouchEvent) => void, events?: EventListenerType[]) => void;
|
|
12
13
|
export default useClickOutside;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// eslint-disable-next-line max-len
|
|
4
4
|
// Inspired from https://github.com/mantinedev/mantine/blob/master/src/mantine-hooks/src/use-click-outside/use-click-outside.ts
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useClickOutsideWithRef = void 0;
|
|
6
7
|
const react_1 = require("react");
|
|
7
8
|
/**
|
|
8
9
|
* Custom hook to detect clicks outside a specified element.
|
|
@@ -14,10 +15,17 @@ const react_1 = require("react");
|
|
|
14
15
|
*/
|
|
15
16
|
const useClickOutside = (callback, events = ['mousedown', 'touchstart']) => {
|
|
16
17
|
const targetRef = (0, react_1.useRef)(null);
|
|
18
|
+
(0, exports.useClickOutsideWithRef)(targetRef, callback, events);
|
|
19
|
+
return targetRef;
|
|
20
|
+
};
|
|
21
|
+
// Internal use for now - extend it later to be used outside
|
|
22
|
+
const useClickOutsideWithRef = (ref, callback, events = ['mousedown', 'touchstart']) => {
|
|
17
23
|
(0, react_1.useEffect)(() => {
|
|
24
|
+
// In case the ref is actually a state and will be set via the state setter function
|
|
25
|
+
const element = ref && 'current' in ref ? ref.current : ref;
|
|
18
26
|
// Event listener function to check if the click is outside the target element
|
|
19
27
|
const listener = (event) => {
|
|
20
|
-
if (
|
|
28
|
+
if (element && !element.contains(event.target)) {
|
|
21
29
|
callback(event);
|
|
22
30
|
}
|
|
23
31
|
};
|
|
@@ -27,7 +35,7 @@ const useClickOutside = (callback, events = ['mousedown', 'touchstart']) => {
|
|
|
27
35
|
return () => {
|
|
28
36
|
events.forEach(eventType => document.removeEventListener(eventType, listener));
|
|
29
37
|
};
|
|
30
|
-
}, [
|
|
31
|
-
return targetRef;
|
|
38
|
+
}, [ref, callback, events]);
|
|
32
39
|
};
|
|
40
|
+
exports.useClickOutsideWithRef = useClickOutsideWithRef;
|
|
33
41
|
exports.default = useClickOutside;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom React hook to measure the elapsed time since a specified start time or the component's mount time.
|
|
3
|
+
*
|
|
4
|
+
* @param {number} [startTime=Date.now()] - The start time in milliseconds from which to measure the elapsed time.
|
|
5
|
+
* @returns {Function} A function that returns the elapsed time in milliseconds since the specified start time
|
|
6
|
+
* or the component's mount time.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import useElapsedTime from '@rio-cloud/rio-uikit/useElapsedTime';
|
|
10
|
+
* import Button from '@rio-cloud/rio-uikit/Button';
|
|
11
|
+
*
|
|
12
|
+
* const MyComponent = () => {
|
|
13
|
+
* const getElapsedTime = useElapsedTime();
|
|
14
|
+
*
|
|
15
|
+
* const handleClick = () => {
|
|
16
|
+
* const elapsedTime = getElapsedTime();
|
|
17
|
+
* console.log(`Elapsed time: ${elapsedTime} ms`);
|
|
18
|
+
* };
|
|
19
|
+
*
|
|
20
|
+
* return (
|
|
21
|
+
* <Button onClick={handleClick}>Get elapsed time</Button>
|
|
22
|
+
* );
|
|
23
|
+
* };
|
|
24
|
+
*/
|
|
25
|
+
declare const useElapsedTime: (startTime?: number) => (() => number);
|
|
26
|
+
export default useElapsedTime;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
4
|
+
/**
|
|
5
|
+
* Custom React hook to measure the elapsed time since a specified start time or the component's mount time.
|
|
6
|
+
*
|
|
7
|
+
* @param {number} [startTime=Date.now()] - The start time in milliseconds from which to measure the elapsed time.
|
|
8
|
+
* @returns {Function} A function that returns the elapsed time in milliseconds since the specified start time
|
|
9
|
+
* or the component's mount time.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* import useElapsedTime from '@rio-cloud/rio-uikit/useElapsedTime';
|
|
13
|
+
* import Button from '@rio-cloud/rio-uikit/Button';
|
|
14
|
+
*
|
|
15
|
+
* const MyComponent = () => {
|
|
16
|
+
* const getElapsedTime = useElapsedTime();
|
|
17
|
+
*
|
|
18
|
+
* const handleClick = () => {
|
|
19
|
+
* const elapsedTime = getElapsedTime();
|
|
20
|
+
* console.log(`Elapsed time: ${elapsedTime} ms`);
|
|
21
|
+
* };
|
|
22
|
+
*
|
|
23
|
+
* return (
|
|
24
|
+
* <Button onClick={handleClick}>Get elapsed time</Button>
|
|
25
|
+
* );
|
|
26
|
+
* };
|
|
27
|
+
*/
|
|
28
|
+
const useElapsedTime = (startTime = Date.now()) => {
|
|
29
|
+
const startTimeRef = (0, react_1.useRef)(startTime);
|
|
30
|
+
const getElapsedTime = () => {
|
|
31
|
+
return Date.now() - startTimeRef.current;
|
|
32
|
+
};
|
|
33
|
+
(0, react_1.useEffect)(() => {
|
|
34
|
+
startTimeRef.current = startTime;
|
|
35
|
+
}, [startTime]);
|
|
36
|
+
return getElapsedTime;
|
|
37
|
+
};
|
|
38
|
+
exports.default = useElapsedTime;
|
|
@@ -14,5 +14,5 @@ type WindowEventMapWithFullscreen = {
|
|
|
14
14
|
* @param options - Optional. An object that specifies characteristics about the event listener.
|
|
15
15
|
* @param target - Optional. The target element to which to attach the event listener.
|
|
16
16
|
*/
|
|
17
|
-
declare const useEvent: <K extends keyof WindowEventMap, W extends keyof WindowEventMapWithFullscreen, T extends HTMLElement = HTMLDivElement>(eventType: K | W, callback: EventListener, options?: boolean | AddEventListenerOptions, target?:
|
|
17
|
+
declare const useEvent: <K extends keyof WindowEventMap, W extends keyof WindowEventMapWithFullscreen, T extends HTMLElement = HTMLDivElement>(eventType: K | W, callback: EventListener, options?: boolean | AddEventListenerOptions, target?: Document | Window | T | null) => void;
|
|
18
18
|
export default useEvent;
|
|
@@ -8,4 +8,9 @@ import React from 'react';
|
|
|
8
8
|
* @returns A mutable ref object to manage the timeout ID.
|
|
9
9
|
*/
|
|
10
10
|
declare const useTimeout: (callback: () => void, delay: number | null) => React.MutableRefObject<number | null>;
|
|
11
|
+
export declare const useChainedTimeout: () => {
|
|
12
|
+
set: (fn: () => void, delayMs?: number) => void;
|
|
13
|
+
clear: () => void;
|
|
14
|
+
handleRef: React.MutableRefObject<any>;
|
|
15
|
+
};
|
|
11
16
|
export default useTimeout;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useChainedTimeout = void 0;
|
|
3
4
|
const react_1 = require("react");
|
|
4
5
|
// See www.joshwcomeau.com/snippets/react-hooks/use-timeout/
|
|
5
6
|
/**
|
|
@@ -33,4 +34,43 @@ const useTimeout = (callback, delay) => {
|
|
|
33
34
|
}, [delay]);
|
|
34
35
|
return timeoutRef;
|
|
35
36
|
};
|
|
37
|
+
const useChainedTimeout = () => {
|
|
38
|
+
const MAX_DELAY_MS = Math.pow(2, 31) - 1;
|
|
39
|
+
const setChainedTimeout = (ref, fn, timeoutAtMs) => {
|
|
40
|
+
const delayMs = timeoutAtMs - Date.now();
|
|
41
|
+
ref.current =
|
|
42
|
+
delayMs <= MAX_DELAY_MS
|
|
43
|
+
? setTimeout(fn, delayMs)
|
|
44
|
+
: setTimeout(() => setChainedTimeout(ref, fn, timeoutAtMs), MAX_DELAY_MS);
|
|
45
|
+
};
|
|
46
|
+
const handleRef = (0, react_1.useRef)();
|
|
47
|
+
const { set, clear } = (0, react_1.useMemo)(() => {
|
|
48
|
+
const clear = () => clearTimeout(handleRef.current);
|
|
49
|
+
const set = (fn, delayMs = 0) => {
|
|
50
|
+
clear();
|
|
51
|
+
if (delayMs <= MAX_DELAY_MS) {
|
|
52
|
+
// For simplicity, if the timeout is short, just set a normal timeout.
|
|
53
|
+
handleRef.current = setTimeout(fn, delayMs);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
setChainedTimeout(handleRef, fn, Date.now() + delayMs);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
set,
|
|
61
|
+
clear,
|
|
62
|
+
};
|
|
63
|
+
}, []);
|
|
64
|
+
(0, react_1.useEffect)(() => {
|
|
65
|
+
return () => {
|
|
66
|
+
clear();
|
|
67
|
+
};
|
|
68
|
+
}, [clear]);
|
|
69
|
+
return {
|
|
70
|
+
set,
|
|
71
|
+
clear,
|
|
72
|
+
handleRef,
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
exports.useChainedTimeout = useChainedTimeout;
|
|
36
76
|
exports.default = useTimeout;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type Handler = (value: any, ...args: any[]) => any;
|
|
2
|
+
export declare function defaultKey(key: string): string;
|
|
3
|
+
declare function useUncontrolledProp<TProp, THandler extends Handler = Handler>(propValue: TProp | undefined, defaultValue: TProp, handler?: THandler): readonly [TProp, THandler];
|
|
4
|
+
declare function useUncontrolledProp<TProp, THandler extends Handler = Handler>(propValue: TProp | undefined, defaultValue?: TProp | undefined, handler?: THandler): readonly [TProp | undefined, (...args: Parameters<THandler>) => ReturnType<THandler> | void];
|
|
5
|
+
export { useUncontrolledProp };
|
|
6
|
+
type FilterFlags<Base, Condition> = {
|
|
7
|
+
[Key in keyof Base]: NonNullable<Base[Key]> extends Condition ? Key : never;
|
|
8
|
+
};
|
|
9
|
+
type AllowedNames<Base, Condition> = FilterFlags<Base, Condition>[keyof Base];
|
|
10
|
+
type ConfigMap<TProps extends object> = {
|
|
11
|
+
[p in keyof TProps]?: AllowedNames<TProps, Function>;
|
|
12
|
+
};
|
|
13
|
+
export declare function useUncontrolled<TProps extends object, TDefaults extends string = never>(props: TProps, config: ConfigMap<TProps>): Omit<TProps, TDefaults>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useUncontrolled = exports.useUncontrolledProp = exports.defaultKey = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
/* eslint-disable prefer-arrow/prefer-arrow-functions */
|
|
6
|
+
// forked from https://github.com/jquense/uncontrollable/blob/master/src/index.ts
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
function defaultKey(key) {
|
|
9
|
+
return 'default' + key.charAt(0).toUpperCase() + key.substr(1);
|
|
10
|
+
}
|
|
11
|
+
exports.defaultKey = defaultKey;
|
|
12
|
+
function useUncontrolledProp(propValue, defaultValue, handler) {
|
|
13
|
+
const wasPropRef = (0, react_1.useRef)(propValue !== undefined);
|
|
14
|
+
const [stateValue, setState] = (0, react_1.useState)(defaultValue);
|
|
15
|
+
const isProp = propValue !== undefined;
|
|
16
|
+
const wasProp = wasPropRef.current;
|
|
17
|
+
wasPropRef.current = isProp;
|
|
18
|
+
/**
|
|
19
|
+
* If a prop switches from controlled to Uncontrolled
|
|
20
|
+
* reset its value to the defaultValue
|
|
21
|
+
*/
|
|
22
|
+
if (!isProp && wasProp && stateValue !== defaultValue) {
|
|
23
|
+
setState(defaultValue);
|
|
24
|
+
}
|
|
25
|
+
return [
|
|
26
|
+
isProp ? propValue : stateValue,
|
|
27
|
+
(0, react_1.useCallback)((...args) => {
|
|
28
|
+
const [value, ...rest] = args;
|
|
29
|
+
const returnValue = handler === null || handler === void 0 ? void 0 : handler(value, ...rest);
|
|
30
|
+
setState(value);
|
|
31
|
+
return returnValue;
|
|
32
|
+
}, [handler]),
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
exports.useUncontrolledProp = useUncontrolledProp;
|
|
36
|
+
function useUncontrolled(props, config) {
|
|
37
|
+
return Object.keys(config).reduce((result, fieldName) => {
|
|
38
|
+
const _a = result, _b = defaultKey(fieldName), defaultValue = _a[_b], _c = fieldName, propsValue = _a[_c], rest = tslib_1.__rest(_a, [typeof _b === "symbol" ? _b : _b + "", typeof _c === "symbol" ? _c : _c + ""]);
|
|
39
|
+
// @ts-ignore-next-line
|
|
40
|
+
const handlerName = config[fieldName];
|
|
41
|
+
// @ts-ignore-next-line
|
|
42
|
+
const [value, handler] = useUncontrolledProp(propsValue, defaultValue, props[handlerName]);
|
|
43
|
+
return Object.assign(Object.assign({}, rest), { [fieldName]: value, [handlerName]: handler });
|
|
44
|
+
}, props);
|
|
45
|
+
}
|
|
46
|
+
exports.useUncontrolled = useUncontrolled;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"brand-info": "#4B80A6",
|
|
19
19
|
"brand-success": "#5cb85c",
|
|
20
20
|
"brand-warning": "#ff8e3c",
|
|
21
|
-
"brand-danger": "#
|
|
21
|
+
"brand-danger": "#e22837",
|
|
22
22
|
"brand-info-decent": "#f5f8fb",
|
|
23
23
|
"brand-success-decent": "#f6fbf5",
|
|
24
24
|
"brand-warning-decent": "#fdf5f0",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"color-map-marker-info": "#3f759b",
|
|
38
38
|
"color-map-marker-success": "#5cb85c",
|
|
39
39
|
"color-map-marker-warning": "#ff8e3c",
|
|
40
|
-
"color-map-marker-danger": "#
|
|
41
|
-
"color-rating-1": "#
|
|
40
|
+
"color-map-marker-danger": "#e22837",
|
|
41
|
+
"color-rating-1": "#e22837",
|
|
42
42
|
"color-rating-2": "#ff8e3c",
|
|
43
43
|
"color-rating-3": "#f8c575",
|
|
44
44
|
"color-rating-4": "#5cb85c",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
var useElapsedTime_1 = require("./hooks/useElapsedTime");
|
|
6
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(useElapsedTime_1).default; } });
|
|
7
|
+
tslib_1.__exportStar(require("./hooks/useElapsedTime"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCurrentBackgroundColor = exports.currentColorOptions = void 0;
|
|
4
|
+
exports.currentColorOptions = ['primary', 'secondary', 'info', 'success', 'warning', 'danger'];
|
|
5
|
+
const currentColorMapping = {
|
|
6
|
+
primary: '--brand-primary',
|
|
7
|
+
secondary: '--brand-secondary',
|
|
8
|
+
info: '--brand-info',
|
|
9
|
+
success: '--brand-success',
|
|
10
|
+
warning: '--brand-warning',
|
|
11
|
+
danger: '--brand-danger',
|
|
12
|
+
};
|
|
13
|
+
const getCurrentBackgroundColor = (color) => `var(${currentColorMapping[`${color}`]})`;
|
|
14
|
+
exports.getCurrentBackgroundColor = getCurrentBackgroundColor;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
declare const hasAlignContentClass: (classes: string) => boolean;
|
|
2
|
+
declare const hasAlignItemsClass: (classes: string) => boolean;
|
|
3
|
+
declare const hasAlignSelfClass: (classes: string) => boolean;
|
|
4
|
+
declare const hasBgClass: (classes: string) => boolean;
|
|
5
|
+
declare const hasBorderClass: (classes: string) => boolean;
|
|
6
|
+
declare const hasBorderStyleClass: (classes: string) => boolean;
|
|
7
|
+
declare const hasBorderWidthClass: (classes: string) => boolean;
|
|
8
|
+
declare const hasCursorClass: (classes: string) => boolean;
|
|
9
|
+
declare const hasDisplayClass: (classes: string) => boolean;
|
|
10
|
+
declare const hasFlexClass: (classes: string) => boolean;
|
|
11
|
+
declare const hasGapClass: (classes: string) => boolean;
|
|
12
|
+
declare const hasHeightClass: (classes: string) => boolean;
|
|
13
|
+
declare const hasHoverBgClass: (classes: string) => boolean;
|
|
14
|
+
declare const hasHoverOpacityClass: (classes: string) => boolean;
|
|
15
|
+
declare const hasHoverScaleClass: (classes: string) => boolean;
|
|
16
|
+
declare const hasHoverTextColorClass: (classes: string) => boolean;
|
|
17
|
+
declare const hasMarginClass: (classes: string) => boolean;
|
|
18
|
+
declare const hasMaxHeightClass: (classes: string) => boolean;
|
|
19
|
+
declare const hasMinHeightClass: (classes: string) => boolean;
|
|
20
|
+
declare const hasOpacityClass: (classes: string) => boolean;
|
|
21
|
+
declare const hasOverflowClass: (classes: string) => boolean;
|
|
22
|
+
declare const hasPaddingClass: (classes: string) => boolean;
|
|
23
|
+
declare const hasRioglyphClass: (classes: string) => boolean;
|
|
24
|
+
declare const hasRoundedClass: (classes: string) => boolean;
|
|
25
|
+
declare const hasScaleClass: (classes: string) => boolean;
|
|
26
|
+
declare const hasSpaceClass: (classes: string) => boolean;
|
|
27
|
+
declare const hasTextColorClass: (classes: string) => boolean;
|
|
28
|
+
declare const hasTextSizeClass: (classes: string) => boolean;
|
|
29
|
+
declare const hasUserSelectClass: (classes: string) => boolean;
|
|
30
|
+
export { hasAlignContentClass, hasAlignItemsClass, hasAlignSelfClass, hasBgClass, hasBorderClass, hasBorderStyleClass, hasBorderWidthClass, hasCursorClass, hasDisplayClass, hasFlexClass, hasGapClass, hasHeightClass, hasHoverBgClass, hasHoverOpacityClass, hasHoverScaleClass, hasHoverTextColorClass, hasMarginClass, hasMaxHeightClass, hasMinHeightClass, hasOpacityClass, hasOverflowClass, hasPaddingClass, hasRioglyphClass, hasRoundedClass, hasScaleClass, hasSpaceClass, hasTextColorClass, hasTextSizeClass, hasUserSelectClass, };
|