@monolith-forensics/monolith-ui 1.8.0 → 1.8.1-dev.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/dist/BarChart/BarChart.d.ts +3 -0
- package/dist/BarChart/BarChart.js +511 -0
- package/dist/BarChart/BarChart.lib.d.ts +31 -0
- package/dist/BarChart/BarChart.lib.js +136 -0
- package/dist/BarChart/BarChart.styled.d.ts +49 -0
- package/dist/BarChart/BarChart.styled.js +111 -0
- package/dist/BarChart/BarChart.types.d.ts +170 -0
- package/dist/BarChart/BarChart.types.js +1 -0
- package/dist/BarChart/index.d.ts +3 -0
- package/dist/BarChart/index.js +2 -0
- package/dist/Button/Button.js +9 -58
- package/dist/Calendar/Calendar.d.ts +3 -1
- package/dist/Calendar/Calendar.js +134 -33
- package/dist/Calendar/CalendarStyles.d.ts +3 -0
- package/dist/Calendar/CalendarStyles.js +92 -14
- package/dist/Calendar/calendarHelpers.d.ts +5 -1
- package/dist/Calendar/calendarHelpers.js +13 -5
- package/dist/ChartPrimitives/chartLegend.styled.d.ts +12 -0
- package/dist/ChartPrimitives/chartLegend.styled.js +52 -0
- package/dist/ChartPrimitives/chartTooltip.styled.d.ts +19 -0
- package/dist/ChartPrimitives/chartTooltip.styled.js +61 -0
- package/dist/ChartPrimitives/index.d.ts +2 -0
- package/dist/ChartPrimitives/index.js +2 -0
- package/dist/ChartUtils/chartColors.d.ts +8 -0
- package/dist/ChartUtils/chartColors.js +65 -0
- package/dist/ChartUtils/chartMath.d.ts +3 -0
- package/dist/ChartUtils/chartMath.js +3 -0
- package/dist/ChartUtils/index.d.ts +2 -0
- package/dist/ChartUtils/index.js +2 -0
- package/dist/Charts/BarChart/BarChart.d.ts +5 -0
- package/dist/Charts/BarChart/BarChart.js +549 -0
- package/dist/Charts/BarChart/BarChart.lib.d.ts +31 -0
- package/dist/Charts/BarChart/BarChart.lib.js +136 -0
- package/dist/Charts/BarChart/BarChart.styled.d.ts +51 -0
- package/dist/Charts/BarChart/BarChart.styled.js +115 -0
- package/dist/Charts/BarChart/BarChart.types.d.ts +171 -0
- package/dist/Charts/BarChart/BarChart.types.js +1 -0
- package/dist/Charts/BarChart/index.d.ts +3 -0
- package/dist/Charts/BarChart/index.js +2 -0
- package/dist/Charts/ChartPrimitives/ChartExportControl.d.ts +11 -0
- package/dist/Charts/ChartPrimitives/ChartExportControl.js +29 -0
- package/dist/Charts/ChartPrimitives/chartActions.styled.d.ts +1 -0
- package/dist/Charts/ChartPrimitives/chartActions.styled.js +8 -0
- package/dist/Charts/ChartPrimitives/chartLegend.styled.d.ts +12 -0
- package/dist/Charts/ChartPrimitives/chartLegend.styled.js +52 -0
- package/dist/Charts/ChartPrimitives/chartTooltip.styled.d.ts +19 -0
- package/dist/Charts/ChartPrimitives/chartTooltip.styled.js +61 -0
- package/dist/Charts/ChartPrimitives/index.d.ts +4 -0
- package/dist/Charts/ChartPrimitives/index.js +4 -0
- package/dist/Charts/ChartUtils/chartColors.d.ts +8 -0
- package/dist/Charts/ChartUtils/chartColors.js +65 -0
- package/dist/Charts/ChartUtils/chartExport.d.ts +47 -0
- package/dist/Charts/ChartUtils/chartExport.js +311 -0
- package/dist/Charts/ChartUtils/chartMath.d.ts +3 -0
- package/dist/Charts/ChartUtils/chartMath.js +3 -0
- package/dist/Charts/ChartUtils/index.d.ts +3 -0
- package/dist/Charts/ChartUtils/index.js +3 -0
- package/dist/Charts/HeatMap/HeatMap.d.ts +5 -0
- package/dist/Charts/HeatMap/HeatMap.js +212 -0
- package/dist/Charts/HeatMap/HeatMap.lib.d.ts +30 -0
- package/dist/Charts/HeatMap/HeatMap.lib.js +115 -0
- package/dist/Charts/HeatMap/HeatMap.styled.d.ts +37 -0
- package/dist/Charts/HeatMap/HeatMap.styled.js +91 -0
- package/dist/Charts/HeatMap/HeatMap.types.d.ts +80 -0
- package/dist/Charts/HeatMap/HeatMap.types.js +1 -0
- package/dist/Charts/HeatMap/index.d.ts +3 -0
- package/dist/Charts/HeatMap/index.js +2 -0
- package/dist/Charts/LineChart/LineChart.d.ts +5 -0
- package/dist/Charts/LineChart/LineChart.js +529 -0
- package/dist/Charts/LineChart/LineChart.lib.d.ts +24 -0
- package/dist/Charts/LineChart/LineChart.lib.js +132 -0
- package/dist/Charts/LineChart/LineChart.styled.d.ts +59 -0
- package/dist/Charts/LineChart/LineChart.styled.js +147 -0
- package/dist/Charts/LineChart/LineChart.types.d.ts +193 -0
- package/dist/Charts/LineChart/LineChart.types.js +1 -0
- package/dist/Charts/LineChart/index.d.ts +3 -0
- package/dist/Charts/LineChart/index.js +2 -0
- package/dist/Charts/PieChart/PieChart.d.ts +4 -0
- package/dist/Charts/PieChart/PieChart.js +199 -0
- package/dist/Charts/PieChart/PieChart.lib.d.ts +5 -0
- package/dist/Charts/PieChart/PieChart.lib.js +19 -0
- package/dist/Charts/PieChart/PieChart.styled.d.ts +51 -0
- package/dist/Charts/PieChart/PieChart.styled.js +163 -0
- package/dist/Charts/PieChart/PieChart.types.d.ts +100 -0
- package/dist/Charts/PieChart/PieChart.types.js +1 -0
- package/dist/Charts/PieChart/index.d.ts +2 -0
- package/dist/Charts/PieChart/index.js +1 -0
- package/dist/Charts/index.d.ts +5 -0
- package/dist/Charts/index.js +4 -0
- package/dist/CheckBox/CheckBox.js +2 -16
- package/dist/DateInput/DateInput.js +198 -143
- package/dist/DropDownMenu/components/MenuComponent.js +2 -1
- package/dist/DropDownMenu/components/MenuItem.js +5 -14
- package/dist/DropDownMenu/components/MenuItemList.js +7 -24
- package/dist/DropDownMenu/components/StyledFloatContainer.js +1 -1
- package/dist/FieldLabel/FieldLabel.js +4 -12
- package/dist/FileInputField/FileInputField.js +4 -23
- package/dist/FormSection/FormSection.js +5 -25
- package/dist/HeatMap/HeatMap.d.ts +3 -0
- package/dist/HeatMap/HeatMap.js +174 -0
- package/dist/HeatMap/HeatMap.lib.d.ts +30 -0
- package/dist/HeatMap/HeatMap.lib.js +115 -0
- package/dist/HeatMap/HeatMap.styled.d.ts +34 -0
- package/dist/HeatMap/HeatMap.styled.js +83 -0
- package/dist/HeatMap/HeatMap.types.d.ts +79 -0
- package/dist/HeatMap/HeatMap.types.js +1 -0
- package/dist/HeatMap/index.d.ts +3 -0
- package/dist/HeatMap/index.js +2 -0
- package/dist/IconButton/IconButton.js +2 -16
- package/dist/Input/Input.js +7 -56
- package/dist/LineChart/LineChart.d.ts +3 -0
- package/dist/LineChart/LineChart.js +491 -0
- package/dist/LineChart/LineChart.lib.d.ts +24 -0
- package/dist/LineChart/LineChart.lib.js +132 -0
- package/dist/LineChart/LineChart.styled.d.ts +57 -0
- package/dist/LineChart/LineChart.styled.js +150 -0
- package/dist/LineChart/LineChart.types.d.ts +192 -0
- package/dist/LineChart/LineChart.types.js +1 -0
- package/dist/LineChart/index.d.ts +3 -0
- package/dist/LineChart/index.js +2 -0
- package/dist/PieChart/PieChart.d.ts +2 -0
- package/dist/PieChart/PieChart.js +161 -0
- package/dist/PieChart/PieChart.lib.d.ts +5 -0
- package/dist/PieChart/PieChart.lib.js +19 -0
- package/dist/PieChart/PieChart.styled.d.ts +49 -0
- package/dist/PieChart/PieChart.styled.js +161 -0
- package/dist/PieChart/PieChart.types.d.ts +99 -0
- package/dist/PieChart/PieChart.types.js +1 -0
- package/dist/PieChart/index.d.ts +2 -0
- package/dist/PieChart/index.js +1 -0
- package/dist/Pill/Pill.js +8 -79
- package/dist/Popover/Popover.context.d.ts +2 -1
- package/dist/Popover/Popover.js +5 -2
- package/dist/Popover/Popover.styles.d.ts +1 -6
- package/dist/Popover/Popover.styles.js +11 -28
- package/dist/Popover/Popover.transitions.d.ts +4 -2
- package/dist/Popover/Popover.transitions.js +23 -49
- package/dist/Popover/PopoverDropdown.js +6 -8
- package/dist/Popover/PopoverTarget.js +6 -3
- package/dist/SegmentedControl/SegmentedControl.utils.d.ts +2 -2
- package/dist/SegmentedControl/SegmentedControl.utils.js +3 -30
- package/dist/SelectBox/SelectBox.js +3 -3
- package/dist/SelectBox/select-box.styled-components.d.ts +3 -1
- package/dist/SelectBox/select-box.styled-components.js +10 -48
- package/dist/SuperDatePicker/SuperDatePicker.d.ts +74 -0
- package/dist/SuperDatePicker/SuperDatePicker.js +557 -0
- package/dist/SuperDatePicker/index.d.ts +2 -0
- package/dist/SuperDatePicker/index.js +2 -0
- package/dist/Switch/Switch.d.ts +2 -2
- package/dist/Switch/Switch.js +18 -83
- package/dist/Table/StateStorage.d.ts +4 -0
- package/dist/Table/StateStorage.js +13 -0
- package/dist/Table/Table.js +160 -12
- package/dist/Table/TableComponents.d.ts +10 -0
- package/dist/Table/TableComponents.js +57 -0
- package/dist/Table/TableDefaults.d.ts +7 -0
- package/dist/Table/TableDefaults.js +7 -0
- package/dist/Table/TableProvider.js +263 -71
- package/dist/Table/TableRow.js +15 -10
- package/dist/Table/types.d.ts +64 -0
- package/dist/TagBox/TagBox.js +18 -76
- package/dist/TextArea/TextArea.js +4 -23
- package/dist/TextInput/TextInput.js +12 -6
- package/dist/Utilities/parseTimestamp.js +11 -6
- package/dist/core/ArrowButton.d.ts +2 -0
- package/dist/core/ArrowButton.js +7 -3
- package/dist/core/ClearButton.d.ts +2 -0
- package/dist/core/ClearButton.js +7 -3
- package/dist/core/controlSizes.d.ts +34 -0
- package/dist/core/controlSizes.js +190 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +5 -1
package/dist/Popover/Popover.js
CHANGED
|
@@ -23,8 +23,9 @@ const PopoverRoot = ({ children, opened, defaultOpened = false, onChange, trigge
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
placement: position,
|
|
26
|
+
transform: false,
|
|
26
27
|
middleware: [
|
|
27
|
-
offset(offsetValue + (withArrow ? resolvedArrowSize
|
|
28
|
+
offset(offsetValue + (withArrow ? resolvedArrowSize : 0)),
|
|
28
29
|
flip({ padding: flipPadding }),
|
|
29
30
|
shift({ padding: shiftPadding }),
|
|
30
31
|
size({
|
|
@@ -42,7 +43,7 @@ const PopoverRoot = ({ children, opened, defaultOpened = false, onChange, trigge
|
|
|
42
43
|
? [
|
|
43
44
|
arrow({
|
|
44
45
|
element: arrowRef,
|
|
45
|
-
padding: 8,
|
|
46
|
+
padding: Math.max(8, resolvedArrowSize),
|
|
46
47
|
}),
|
|
47
48
|
]
|
|
48
49
|
: []),
|
|
@@ -92,6 +93,7 @@ const PopoverRoot = ({ children, opened, defaultOpened = false, onChange, trigge
|
|
|
92
93
|
returnFocus,
|
|
93
94
|
keepMounted,
|
|
94
95
|
zIndex,
|
|
96
|
+
role,
|
|
95
97
|
dropdownId,
|
|
96
98
|
transitionProps,
|
|
97
99
|
}), [
|
|
@@ -109,6 +111,7 @@ const PopoverRoot = ({ children, opened, defaultOpened = false, onChange, trigge
|
|
|
109
111
|
returnFocus,
|
|
110
112
|
keepMounted,
|
|
111
113
|
zIndex,
|
|
114
|
+
role,
|
|
112
115
|
dropdownId,
|
|
113
116
|
transitionProps,
|
|
114
117
|
]);
|
|
@@ -1,7 +1,2 @@
|
|
|
1
1
|
export declare const StyledDropdown: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
|
-
export declare const
|
|
3
|
-
clipPath: string;
|
|
4
|
-
borderTransparent: string[];
|
|
5
|
-
radiusCorner: string;
|
|
6
|
-
staticProp: string;
|
|
7
|
-
}>;
|
|
2
|
+
export declare const StyledArrow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("@floating-ui/react").FloatingArrowProps, "ref"> & import("react").RefAttributes<SVGSVGElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<import("@floating-ui/react").FloatingArrowProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>, keyof import("react").Component<any, {}, any>>;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import { FloatingArrow } from "@floating-ui/react";
|
|
1
2
|
import styled from "styled-components";
|
|
2
3
|
export const StyledDropdown = styled.div `
|
|
4
|
+
--mf-popover-arrow-fill: ${({ theme }) => theme.palette.background.default};
|
|
5
|
+
--mf-popover-arrow-border: ${({ theme }) => theme.palette.divider};
|
|
6
|
+
|
|
3
7
|
position: relative;
|
|
4
8
|
min-width: 180px;
|
|
5
9
|
border-radius: 8px;
|
|
6
|
-
border: 1px solid
|
|
7
|
-
background-color:
|
|
10
|
+
border: 1px solid var(--mf-popover-arrow-border);
|
|
11
|
+
background-color: var(--mf-popover-arrow-fill);
|
|
8
12
|
color: ${({ theme }) => theme.palette.text.primary};
|
|
9
13
|
box-shadow:
|
|
10
14
|
rgba(15, 23, 42, 0.1) 0px 10px 15px -3px,
|
|
@@ -12,29 +16,8 @@ export const StyledDropdown = styled.div `
|
|
|
12
16
|
padding: 10px 12px;
|
|
13
17
|
outline: none;
|
|
14
18
|
`;
|
|
15
|
-
export const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
staticProp: "top",
|
|
21
|
-
},
|
|
22
|
-
top: {
|
|
23
|
-
clipPath: "polygon(0 100%, 100% 100%, 100% 0)",
|
|
24
|
-
borderTransparent: ["borderTopColor", "borderLeftColor"],
|
|
25
|
-
radiusCorner: "borderBottomRightRadius",
|
|
26
|
-
staticProp: "bottom",
|
|
27
|
-
},
|
|
28
|
-
left: {
|
|
29
|
-
clipPath: "polygon(100% 0, 0 0, 100% 100%)",
|
|
30
|
-
borderTransparent: ["borderLeftColor", "borderBottomColor"],
|
|
31
|
-
radiusCorner: "borderTopRightRadius",
|
|
32
|
-
staticProp: "right",
|
|
33
|
-
},
|
|
34
|
-
right: {
|
|
35
|
-
clipPath: "polygon(0 100%, 0 0, 100% 100%)",
|
|
36
|
-
borderTransparent: ["borderRightColor", "borderTopColor"],
|
|
37
|
-
radiusCorner: "borderBottomLeftRadius",
|
|
38
|
-
staticProp: "left",
|
|
39
|
-
},
|
|
40
|
-
};
|
|
19
|
+
export const StyledArrow = styled(FloatingArrow) `
|
|
20
|
+
display: block;
|
|
21
|
+
overflow: visible;
|
|
22
|
+
z-index: 1;
|
|
23
|
+
`;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { FloatingContext } from "@floating-ui/react";
|
|
2
|
+
import { CSSProperties } from "react";
|
|
1
3
|
import { PopoverTransitionProps } from "./Popover.types";
|
|
2
|
-
export declare function usePopoverTransition(
|
|
4
|
+
export declare function usePopoverTransition(context: FloatingContext, { transition, duration, timingFunction, }: PopoverTransitionProps): {
|
|
3
5
|
mounted: boolean;
|
|
4
|
-
styles:
|
|
6
|
+
styles: CSSProperties;
|
|
5
7
|
};
|
|
@@ -1,63 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useTransitionStyles } from "@floating-ui/react";
|
|
2
2
|
const TRANSITION_PRESETS = {
|
|
3
3
|
fade: {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
initial: { opacity: 0 },
|
|
5
|
+
open: { opacity: 1 },
|
|
6
6
|
},
|
|
7
7
|
scale: {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
initial: { opacity: 0, transform: "scale(0.85)" },
|
|
9
|
+
open: { opacity: 1, transform: "scale(1)" },
|
|
10
10
|
},
|
|
11
11
|
"scale-y": {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
initial: { opacity: 0, transform: "scaleY(0.7)" },
|
|
13
|
+
open: { opacity: 1, transform: "scaleY(1)" },
|
|
14
14
|
},
|
|
15
15
|
pop: {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
initial: { opacity: 0, transform: "scale(0.6)" },
|
|
17
|
+
open: { opacity: 1, transform: "scale(1)" },
|
|
18
18
|
},
|
|
19
19
|
};
|
|
20
|
-
export function usePopoverTransition(
|
|
21
|
-
|
|
22
|
-
const [transitionEnabled, setTransitionEnabled] = useState(false);
|
|
23
|
-
const [phase, setPhase] = useState(opened ? "enter" : "exit");
|
|
24
|
-
const frameRef = useRef(0);
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
cancelAnimationFrame(frameRef.current);
|
|
27
|
-
if (opened) {
|
|
28
|
-
setMounted(true);
|
|
29
|
-
setTransitionEnabled(false);
|
|
30
|
-
setPhase("exit");
|
|
31
|
-
frameRef.current = requestAnimationFrame(() => {
|
|
32
|
-
frameRef.current = requestAnimationFrame(() => {
|
|
33
|
-
setTransitionEnabled(true);
|
|
34
|
-
setPhase("enter");
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
setTransitionEnabled(true);
|
|
40
|
-
setPhase("exit");
|
|
41
|
-
const timer = setTimeout(() => {
|
|
42
|
-
setMounted(false);
|
|
43
|
-
setTransitionEnabled(false);
|
|
44
|
-
}, duration);
|
|
45
|
-
return () => clearTimeout(timer);
|
|
46
|
-
}
|
|
47
|
-
}, [opened, duration]);
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
return () => cancelAnimationFrame(frameRef.current);
|
|
50
|
-
}, []);
|
|
20
|
+
export function usePopoverTransition(context, { transition = "fade", duration = 150, timingFunction = "ease", }) {
|
|
21
|
+
var _a;
|
|
51
22
|
const preset = TRANSITION_PRESETS[transition];
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
23
|
+
const { isMounted, styles } = useTransitionStyles(context, {
|
|
24
|
+
duration,
|
|
25
|
+
initial: preset.initial,
|
|
26
|
+
open: preset.open,
|
|
27
|
+
close: (_a = preset.close) !== null && _a !== void 0 ? _a : preset.initial,
|
|
28
|
+
common: {
|
|
29
|
+
transitionTimingFunction: timingFunction,
|
|
30
|
+
willChange: transition === "fade" ? "opacity" : "opacity, transform",
|
|
31
|
+
},
|
|
32
|
+
});
|
|
59
33
|
return {
|
|
60
|
-
mounted:
|
|
61
|
-
styles
|
|
34
|
+
mounted: isMounted,
|
|
35
|
+
styles,
|
|
62
36
|
};
|
|
63
37
|
}
|
|
@@ -12,17 +12,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { FloatingFocusManager, FloatingPortal } from "@floating-ui/react";
|
|
14
14
|
import { usePopoverContext } from "./Popover.context";
|
|
15
|
-
import {
|
|
15
|
+
import { StyledArrow, StyledDropdown } from "./Popover.styles";
|
|
16
16
|
import { usePopoverTransition } from "./Popover.transitions";
|
|
17
17
|
export const PopoverDropdown = (_a) => {
|
|
18
|
-
var _b, _c;
|
|
19
18
|
var { children, className, style } = _a, props = __rest(_a, ["children", "className", "style"]);
|
|
20
|
-
const {
|
|
21
|
-
const { mounted, styles: transitionStyles } = usePopoverTransition(
|
|
22
|
-
const
|
|
23
|
-
const
|
|
19
|
+
const { refs, context, floatingStyles, getFloatingProps, withArrow, arrowSize, arrowRadius, arrowRef, withinPortal, trapFocus, returnFocus, keepMounted, zIndex, dropdownId, transitionProps: ctxTransitionProps, } = usePopoverContext();
|
|
20
|
+
const { mounted, styles: transitionStyles } = usePopoverTransition(context, ctxTransitionProps);
|
|
21
|
+
const resolvedArrowSize = Math.max(arrowSize, 6);
|
|
22
|
+
const resolvedArrowRadius = Math.min(Math.max(arrowRadius, 0), resolvedArrowSize / 2);
|
|
24
23
|
const [placementSide, placementAlignment] = context.placement.split("-");
|
|
25
|
-
const arrowConfig = ARROW_STYLES[placementSide];
|
|
26
24
|
const originSide = {
|
|
27
25
|
top: "bottom",
|
|
28
26
|
bottom: "top",
|
|
@@ -44,7 +42,7 @@ export const PopoverDropdown = (_a) => {
|
|
|
44
42
|
}
|
|
45
43
|
const dropdown = (_jsx(FloatingFocusManager, { context: context, modal: trapFocus, returnFocus: returnFocus, children: _jsxs(StyledDropdown, Object.assign({}, getFloatingProps(props), { id: dropdownId, ref: refs.setFloating, className: className, style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, floatingStyles), transitionStyles), { transformOrigin }), style), { zIndex }), (keepMounted && !mounted
|
|
46
44
|
? { visibility: "hidden", pointerEvents: "none" }
|
|
47
|
-
: {})), children: [children, withArrow && (_jsx(
|
|
45
|
+
: {})), children: [children, withArrow && (_jsx(StyledArrow, { ref: arrowRef, context: context, width: resolvedArrowSize * 2, height: resolvedArrowSize, tipRadius: resolvedArrowRadius, strokeWidth: 1, fill: "var(--mf-popover-arrow-fill)", stroke: "var(--mf-popover-arrow-border)" }))] })) }));
|
|
48
46
|
if (!withinPortal) {
|
|
49
47
|
return dropdown;
|
|
50
48
|
}
|
|
@@ -2,10 +2,13 @@ import { useMergeRefs } from "@floating-ui/react";
|
|
|
2
2
|
import { cloneElement, isValidElement } from "react";
|
|
3
3
|
import { usePopoverContext } from "./Popover.context";
|
|
4
4
|
export const PopoverTarget = ({ children }) => {
|
|
5
|
-
const { refs, getReferenceProps, opened, dropdownId } = usePopoverContext();
|
|
5
|
+
const { refs, getReferenceProps, opened, dropdownId, role } = usePopoverContext();
|
|
6
6
|
if (!isValidElement(children)) {
|
|
7
7
|
return null;
|
|
8
8
|
}
|
|
9
|
-
const mergedRef = useMergeRefs([
|
|
10
|
-
|
|
9
|
+
const mergedRef = useMergeRefs([
|
|
10
|
+
refs.setReference,
|
|
11
|
+
children.ref,
|
|
12
|
+
]);
|
|
13
|
+
return cloneElement(children, getReferenceProps(Object.assign({ ref: mergedRef, "aria-expanded": opened, "aria-controls": dropdownId, "aria-haspopup": role === "tooltip" ? undefined : role }, children.props)));
|
|
11
14
|
};
|
|
@@ -4,8 +4,8 @@ export declare const resolveActiveColor: (theme: any, activeColor?: string) => {
|
|
|
4
4
|
main: any;
|
|
5
5
|
contrastText: any;
|
|
6
6
|
};
|
|
7
|
-
export declare const getSegmentHeight: (size?: Size) =>
|
|
8
|
-
export declare const getSegmentFontSize: (size?: Size) =>
|
|
7
|
+
export declare const getSegmentHeight: (size?: Size) => number;
|
|
8
|
+
export declare const getSegmentFontSize: (size?: Size) => string;
|
|
9
9
|
export declare const normalizeSegmentedData: (data: SegmentedControlDataItem[]) => NormalizedSegmentedItem[];
|
|
10
10
|
export declare const getFirstEnabledIndex: (data: NormalizedSegmentedItem[]) => number;
|
|
11
11
|
export declare const getNextEnabledIndex: (data: NormalizedSegmentedItem[], startIndex: number, direction: 1 | -1) => number;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getControlSizeTokens } from "../core";
|
|
1
2
|
export const resolveActiveColor = (theme, activeColor) => {
|
|
2
3
|
var _a;
|
|
3
4
|
const fallback = {
|
|
@@ -21,38 +22,10 @@ export const resolveActiveColor = (theme, activeColor) => {
|
|
|
21
22
|
};
|
|
22
23
|
};
|
|
23
24
|
export const getSegmentHeight = (size) => {
|
|
24
|
-
|
|
25
|
-
case "xxs":
|
|
26
|
-
return 22;
|
|
27
|
-
case "xs":
|
|
28
|
-
return 26;
|
|
29
|
-
case "md":
|
|
30
|
-
return 38;
|
|
31
|
-
case "lg":
|
|
32
|
-
return 46;
|
|
33
|
-
case "xl":
|
|
34
|
-
return 56;
|
|
35
|
-
case "sm":
|
|
36
|
-
default:
|
|
37
|
-
return 32;
|
|
38
|
-
}
|
|
25
|
+
return getControlSizeTokens(size).segmentedHeight;
|
|
39
26
|
};
|
|
40
27
|
export const getSegmentFontSize = (size) => {
|
|
41
|
-
|
|
42
|
-
case "xxs":
|
|
43
|
-
return "11px";
|
|
44
|
-
case "xs":
|
|
45
|
-
return "12px";
|
|
46
|
-
case "md":
|
|
47
|
-
return "16px";
|
|
48
|
-
case "lg":
|
|
49
|
-
return "18px";
|
|
50
|
-
case "xl":
|
|
51
|
-
return "20px";
|
|
52
|
-
case "sm":
|
|
53
|
-
default:
|
|
54
|
-
return "14px";
|
|
55
|
-
}
|
|
28
|
+
return `${getControlSizeTokens(size).segmentedFontSize}px`;
|
|
56
29
|
};
|
|
57
30
|
export const normalizeSegmentedData = (data) => data.map((item) => {
|
|
58
31
|
var _a;
|
|
@@ -279,13 +279,13 @@ triggerFocus = false, triggerOpen = false, onFocused, onOpened, }) => {
|
|
|
279
279
|
const renderOptionItem = (item, index) => (_jsx(Tooltip, { content: OptionTooltip ? _jsx(OptionTooltip, { data: item.data }) : null, side: "left", children: _jsx(StyledItem, { className: "mfFloatingItem", onClick: (e) => handleItemClick(e, item), "data-selected": (_value === null || _value === void 0 ? void 0 : _value.value) === item.value, "data-disabled": item.disabled, size: size, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || _jsx(_Fragment, { children: item === null || item === void 0 ? void 0 : item.label }) }, index) }, index));
|
|
280
280
|
const renderActionButton = () => {
|
|
281
281
|
if (clearable && (_value || !!inputValue)) {
|
|
282
|
-
return (_jsx(ClearButton, { className: "input-btn", onClick: handleClear, onMouseDown: (e) => {
|
|
282
|
+
return (_jsx(ClearButton, { size: size, className: "input-btn", onClick: handleClear, onMouseDown: (e) => {
|
|
283
283
|
e.preventDefault();
|
|
284
284
|
e.stopPropagation();
|
|
285
285
|
} }));
|
|
286
286
|
}
|
|
287
287
|
if (arrow) {
|
|
288
|
-
return (_jsx(ArrowButton, { onClick: (e) => {
|
|
288
|
+
return (_jsx(ArrowButton, { size: size, onClick: (e) => {
|
|
289
289
|
e.preventDefault();
|
|
290
290
|
}, onMouseDown: (e) => {
|
|
291
291
|
e.preventDefault();
|
|
@@ -393,7 +393,7 @@ triggerFocus = false, triggerOpen = false, onFocused, onOpened, }) => {
|
|
|
393
393
|
: "",
|
|
394
394
|
}, variant: variant, "data-empty": filteredItems.length === 0 }, DropDownProps, { children: [loading && _jsx(Loader, {}), !loading && actionComponent && (_jsx(ActionMenu, { onClick: () => {
|
|
395
395
|
setIsOpen(false);
|
|
396
|
-
}, children: actionComponent })), !loading && filteredItems.length === 0 && (_jsx(EmptyComponent, { children: getEmptyMessage(allowCustomValue, searchValue) })), !loading && (_jsx(StyledInnerItemContainer, { ref: scrollContainerRef, "data-scroll-active": scrollActive, onScroll: onScroll, children: grouped
|
|
396
|
+
}, children: actionComponent })), !loading && filteredItems.length === 0 && (_jsx(EmptyComponent, { size: size, children: getEmptyMessage(allowCustomValue, searchValue) })), !loading && (_jsx(StyledInnerItemContainer, { ref: scrollContainerRef, "data-scroll-active": scrollActive, onScroll: onScroll, children: grouped
|
|
397
397
|
? groups.map((group, index) => (_jsxs("div", { children: [_jsx(GroupTitle, { size: size, children: group.label }), group.items.map((item, index) => renderOptionItem(item, index))] }, group.label)))
|
|
398
398
|
: filteredItems.map((item, index) => renderOptionItem(item, index)) }))] })) }) }))] }));
|
|
399
399
|
};
|
|
@@ -4,7 +4,9 @@ export declare const StyledInputContainer: import("styled-components/dist/types"
|
|
|
4
4
|
width?: string | number | null;
|
|
5
5
|
}>> & string;
|
|
6
6
|
export declare const StyledInnerItemContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
7
|
-
export declare const EmptyComponent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").
|
|
7
|
+
export declare const EmptyComponent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
8
|
+
size?: Size;
|
|
9
|
+
}>> & string;
|
|
8
10
|
interface GroupTitleProps {
|
|
9
11
|
className?: string;
|
|
10
12
|
children?: ReactNode;
|
|
@@ -11,6 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import styled from "styled-components";
|
|
14
|
+
import { getControlSizeTokens } from "../core";
|
|
14
15
|
export const StyledInputContainer = styled.div `
|
|
15
16
|
font-family: ${({ theme }) => theme.typography.fontFamily};
|
|
16
17
|
|
|
@@ -58,7 +59,7 @@ export const EmptyComponent = styled.div `
|
|
|
58
59
|
align-items: center;
|
|
59
60
|
justify-content: center;
|
|
60
61
|
padding: 5px;
|
|
61
|
-
font-size:
|
|
62
|
+
font-size: ${({ size = "sm" }) => `${getControlSizeTokens(size).supportingFontSize}px`};
|
|
62
63
|
font-weight: 500;
|
|
63
64
|
color: ${(props) => props.theme.palette.text.secondary};
|
|
64
65
|
`;
|
|
@@ -74,17 +75,8 @@ export const GroupTitle = styled((_a) => {
|
|
|
74
75
|
|
|
75
76
|
color: ${(props) => props.theme.palette.text.secondary};
|
|
76
77
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
: size === "sm"
|
|
80
|
-
? "4px 10px"
|
|
81
|
-
: size === "md"
|
|
82
|
-
? "4px 12px"
|
|
83
|
-
: size === "lg"
|
|
84
|
-
? "5px 14px"
|
|
85
|
-
: size === "xl"
|
|
86
|
-
? "6px 16px"
|
|
87
|
-
: "2px 8px"};
|
|
78
|
+
min-height: ${({ size = "sm" }) => `${getControlSizeTokens(size).menuRowHeight}px`};
|
|
79
|
+
padding: ${({ size = "sm" }) => `0px ${getControlSizeTokens(size).menuItemPaddingX}px`};
|
|
88
80
|
|
|
89
81
|
.group-label {
|
|
90
82
|
white-space: nowrap;
|
|
@@ -95,17 +87,7 @@ export const GroupTitle = styled((_a) => {
|
|
|
95
87
|
|
|
96
88
|
font-weight: 500;
|
|
97
89
|
|
|
98
|
-
font-size: ${({ size }) => size
|
|
99
|
-
? "11px"
|
|
100
|
-
: size === "sm"
|
|
101
|
-
? "13px"
|
|
102
|
-
: size === "md"
|
|
103
|
-
? "15px"
|
|
104
|
-
: size === "lg"
|
|
105
|
-
? "17px"
|
|
106
|
-
: size === "xl"
|
|
107
|
-
? "19px"
|
|
108
|
-
: "11px"};
|
|
90
|
+
font-size: ${({ size = "sm" }) => `${getControlSizeTokens(size).menuGroupFontSize}px`};
|
|
109
91
|
}
|
|
110
92
|
|
|
111
93
|
.group-line {
|
|
@@ -119,8 +101,8 @@ export const StyledItem = styled.div `
|
|
|
119
101
|
border-radius: 3px;
|
|
120
102
|
display: flex;
|
|
121
103
|
align-items: center;
|
|
122
|
-
min-height:
|
|
123
|
-
|
|
104
|
+
min-height: ${({ size }) => `${getControlSizeTokens(size).menuRowHeight}px`};
|
|
105
|
+
height: ${({ size }) => `${getControlSizeTokens(size).menuRowHeight}px`};
|
|
124
106
|
position: relative;
|
|
125
107
|
user-select: none;
|
|
126
108
|
outline: none;
|
|
@@ -129,29 +111,9 @@ export const StyledItem = styled.div `
|
|
|
129
111
|
|
|
130
112
|
font-family: ${({ theme }) => theme.typography.fontFamily};
|
|
131
113
|
|
|
132
|
-
font-size: ${({ size }) => size
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
? "13px"
|
|
136
|
-
: size === "md"
|
|
137
|
-
? "15px"
|
|
138
|
-
: size === "lg"
|
|
139
|
-
? "17px"
|
|
140
|
-
: size === "xl"
|
|
141
|
-
? "19px"
|
|
142
|
-
: "11px"};
|
|
143
|
-
|
|
144
|
-
padding: ${({ size }) => size === "xs"
|
|
145
|
-
? "2px 8px"
|
|
146
|
-
: size === "sm"
|
|
147
|
-
? "4px 10px"
|
|
148
|
-
: size === "md"
|
|
149
|
-
? "4px 12px"
|
|
150
|
-
: size === "lg"
|
|
151
|
-
? "5px 14px"
|
|
152
|
-
: size === "xl"
|
|
153
|
-
? "6px 16px"
|
|
154
|
-
: "2px 8px"};
|
|
114
|
+
font-size: ${({ size }) => `${getControlSizeTokens(size).fontSize}px`};
|
|
115
|
+
|
|
116
|
+
padding: ${({ size }) => `0px ${getControlSizeTokens(size).menuItemPaddingX}px`};
|
|
155
117
|
|
|
156
118
|
&:hover {
|
|
157
119
|
background-color: ${(props) => props.theme.palette.action.hover};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import moment from "moment";
|
|
2
|
+
import { CSSProperties, ReactElement, ReactNode } from "react";
|
|
3
|
+
import { ButtonProps } from "../Button";
|
|
4
|
+
import { Size, Variant } from "../core";
|
|
5
|
+
export type SuperDatePickerUnit = "s" | "m" | "h" | "d" | "w" | "M" | "y";
|
|
6
|
+
export type SuperDatePickerRefreshUnit = "s" | "m" | "h";
|
|
7
|
+
export type DurationRange = {
|
|
8
|
+
start: string;
|
|
9
|
+
end: string;
|
|
10
|
+
label: string;
|
|
11
|
+
};
|
|
12
|
+
export type SuperDatePickerQuickSelectPanel = {
|
|
13
|
+
title: string;
|
|
14
|
+
content: ReactElement;
|
|
15
|
+
};
|
|
16
|
+
export type SuperDatePickerTimeChangeProps = {
|
|
17
|
+
start: string;
|
|
18
|
+
end: string;
|
|
19
|
+
isInvalid: boolean;
|
|
20
|
+
isQuickSelection: boolean;
|
|
21
|
+
};
|
|
22
|
+
export type SuperDatePickerRefreshChangeProps = {
|
|
23
|
+
isPaused: boolean;
|
|
24
|
+
refreshInterval: number;
|
|
25
|
+
intervalUnits: SuperDatePickerRefreshUnit;
|
|
26
|
+
};
|
|
27
|
+
export type SuperDatePickerRefreshProps = {
|
|
28
|
+
start: string;
|
|
29
|
+
end: string;
|
|
30
|
+
refreshInterval: number;
|
|
31
|
+
};
|
|
32
|
+
export type SuperDatePickerTimeWindowButtonsConfig = {
|
|
33
|
+
zoomFactor?: number;
|
|
34
|
+
showZoomIn?: boolean;
|
|
35
|
+
};
|
|
36
|
+
export type SuperDatePickerProps = {
|
|
37
|
+
className?: string;
|
|
38
|
+
style?: CSSProperties;
|
|
39
|
+
start?: string;
|
|
40
|
+
end?: string;
|
|
41
|
+
defaultStart?: string;
|
|
42
|
+
defaultEnd?: string;
|
|
43
|
+
onTimeChange?: (props: SuperDatePickerTimeChangeProps) => void;
|
|
44
|
+
commonlyUsedRanges?: DurationRange[];
|
|
45
|
+
recentlyUsedRanges?: DurationRange[];
|
|
46
|
+
customQuickSelectPanels?: SuperDatePickerQuickSelectPanel[];
|
|
47
|
+
isDisabled?: boolean | {
|
|
48
|
+
display: ReactNode;
|
|
49
|
+
};
|
|
50
|
+
isLoading?: boolean;
|
|
51
|
+
width?: "auto" | "restricted" | "full";
|
|
52
|
+
size?: Size;
|
|
53
|
+
variant?: Variant;
|
|
54
|
+
compressed?: boolean;
|
|
55
|
+
showUpdateButton?: boolean | "iconOnly";
|
|
56
|
+
updateButtonProps?: ButtonProps;
|
|
57
|
+
quickSelectButtonProps?: ButtonProps;
|
|
58
|
+
isQuickSelectOnly?: boolean;
|
|
59
|
+
isAutoRefreshOnly?: boolean;
|
|
60
|
+
isPaused?: boolean;
|
|
61
|
+
refreshInterval?: number;
|
|
62
|
+
refreshMinInterval?: number;
|
|
63
|
+
refreshIntervalUnits?: SuperDatePickerRefreshUnit;
|
|
64
|
+
onRefresh?: (props: SuperDatePickerRefreshProps) => void | Promise<void>;
|
|
65
|
+
onRefreshChange?: (props: SuperDatePickerRefreshChangeProps) => void;
|
|
66
|
+
showTimeWindowButtons?: boolean | SuperDatePickerTimeWindowButtonsConfig;
|
|
67
|
+
minDate?: Date | moment.Moment;
|
|
68
|
+
maxDate?: Date | moment.Moment;
|
|
69
|
+
timeZoneDisplay?: ReactNode;
|
|
70
|
+
dateFormat?: string;
|
|
71
|
+
"aria-label"?: string;
|
|
72
|
+
};
|
|
73
|
+
export declare const SuperDatePicker: React.FC<SuperDatePickerProps>;
|
|
74
|
+
export default SuperDatePicker;
|