@rufous/ui 0.2.93 → 0.2.95
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/main.cjs +450 -413
- package/dist/main.js +463 -426
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1665,6 +1665,28 @@ var TextField = forwardRef3(({
|
|
|
1665
1665
|
className
|
|
1666
1666
|
].filter(Boolean).join(" ");
|
|
1667
1667
|
const internalRef = React68.useRef(null);
|
|
1668
|
+
const handleChange = (e) => {
|
|
1669
|
+
if (type === "number") {
|
|
1670
|
+
const raw = e.target.value;
|
|
1671
|
+
const inputMax = slotProps?.input?.max ?? props.max;
|
|
1672
|
+
const inputMaxLength = slotProps?.input?.maxLength ?? props.maxLength;
|
|
1673
|
+
if (inputMaxLength != null) {
|
|
1674
|
+
const digits = raw.replace(/[^0-9]/g, "");
|
|
1675
|
+
if (digits.length > Number(inputMaxLength)) return;
|
|
1676
|
+
}
|
|
1677
|
+
if (inputMax != null && raw !== "") {
|
|
1678
|
+
if (Number(raw) > Number(inputMax)) return;
|
|
1679
|
+
}
|
|
1680
|
+
const numericValue = raw === "" ? "" : Number(raw);
|
|
1681
|
+
const syntheticEvent = Object.assign({}, e, {
|
|
1682
|
+
target: Object.assign({}, e.target, { value: numericValue }),
|
|
1683
|
+
currentTarget: Object.assign({}, e.currentTarget, { value: numericValue })
|
|
1684
|
+
});
|
|
1685
|
+
onChange?.(syntheticEvent);
|
|
1686
|
+
return;
|
|
1687
|
+
}
|
|
1688
|
+
onChange?.(e);
|
|
1689
|
+
};
|
|
1668
1690
|
const triggerChange = () => {
|
|
1669
1691
|
if (internalRef.current) {
|
|
1670
1692
|
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set;
|
|
@@ -1728,35 +1750,267 @@ var TextField = forwardRef3(({
|
|
|
1728
1750
|
name,
|
|
1729
1751
|
id: inputId,
|
|
1730
1752
|
value,
|
|
1731
|
-
onChange,
|
|
1732
1753
|
required,
|
|
1733
1754
|
disabled,
|
|
1734
1755
|
readOnly,
|
|
1735
1756
|
step: type === "number" && numberVariant ? STEP_BY_VARIANT[numberVariant] : void 0,
|
|
1736
1757
|
min: type === "number" && numberVariant ? MIN_BY_VARIANT[numberVariant] : void 0,
|
|
1737
1758
|
...slotProps?.input,
|
|
1738
|
-
...props
|
|
1759
|
+
...props,
|
|
1760
|
+
onChange: handleChange
|
|
1739
1761
|
}
|
|
1740
1762
|
), InputProps?.endAdornment && /* @__PURE__ */ React68.createElement("div", { className: "rf-text-field__adornment rf-text-field__adornment--end" }, InputProps.endAdornment), type === "number" && !disabled && !readOnly && /* @__PURE__ */ React68.createElement("div", { className: "rf-text-field__number-controls" }, /* @__PURE__ */ React68.createElement("button", { type: "button", tabIndex: -1, onClick: handleIncrement, className: "rf-text-field__number-btn" }, /* @__PURE__ */ React68.createElement("svg", { width: "8", height: "5", viewBox: "0 0 8 5", fill: "currentColor" }, /* @__PURE__ */ React68.createElement("path", { d: "M4 0L8 5H0L4 0Z" }))), /* @__PURE__ */ React68.createElement("button", { type: "button", tabIndex: -1, onClick: handleDecrement, className: "rf-text-field__number-btn", style: { marginTop: 2 } }, /* @__PURE__ */ React68.createElement("svg", { width: "8", height: "5", viewBox: "0 0 8 5", fill: "currentColor" }, /* @__PURE__ */ React68.createElement("path", { d: "M4 5L0 0H8L4 5Z" })))), hasLabel && /* @__PURE__ */ React68.createElement("label", { htmlFor: inputId, className: "rf-text-field__label" }, label, " ", required && /* @__PURE__ */ React68.createElement("span", { className: "rf-text-field__asterisk" }, "*")), variant === "outlined" && /* @__PURE__ */ React68.createElement("fieldset", { className: "rf-text-field__notch" }, hasLabel ? /* @__PURE__ */ React68.createElement("legend", { className: "rf-text-field__legend" }, /* @__PURE__ */ React68.createElement("span", null, label, " ", required ? "*" : "")) : /* @__PURE__ */ React68.createElement("legend", { className: "rf-text-field__legend--empty" }))), helperText && /* @__PURE__ */ React68.createElement("div", { className: "rf-text-field__helper-text" }, helperText));
|
|
1741
1763
|
});
|
|
1742
1764
|
TextField.displayName = "TextField";
|
|
1743
1765
|
|
|
1744
1766
|
// lib/TextFields/AddressLookup.tsx
|
|
1745
|
-
import
|
|
1767
|
+
import React71, { useState as useState6, useRef as useRef5, useEffect as useEffect6 } from "react";
|
|
1746
1768
|
import Axios from "axios";
|
|
1747
1769
|
import { Country, State, City } from "country-state-city";
|
|
1748
1770
|
|
|
1749
1771
|
// lib/TextFields/Autocomplete.tsx
|
|
1772
|
+
import React70, {
|
|
1773
|
+
useState as useState5,
|
|
1774
|
+
useRef as useRef4,
|
|
1775
|
+
useEffect as useEffect5,
|
|
1776
|
+
useCallback as useCallback2
|
|
1777
|
+
} from "react";
|
|
1778
|
+
import ReactDOM3 from "react-dom";
|
|
1779
|
+
|
|
1780
|
+
// lib/Tooltip/Tooltip.tsx
|
|
1750
1781
|
import React69, {
|
|
1751
|
-
|
|
1752
|
-
useRef as useRef3,
|
|
1782
|
+
useCallback,
|
|
1753
1783
|
useEffect as useEffect4,
|
|
1754
|
-
|
|
1784
|
+
useRef as useRef3,
|
|
1785
|
+
useState as useState4
|
|
1755
1786
|
} from "react";
|
|
1756
1787
|
import ReactDOM2 from "react-dom";
|
|
1757
|
-
var
|
|
1758
|
-
|
|
1759
|
-
|
|
1788
|
+
var GAP = 8;
|
|
1789
|
+
function computePosition(anchor, tooltip, placement) {
|
|
1790
|
+
const { top: aTop, left: aLeft, width: aW, height: aH } = anchor;
|
|
1791
|
+
const { width: tW, height: tH } = tooltip;
|
|
1792
|
+
let top = 0;
|
|
1793
|
+
let left = 0;
|
|
1794
|
+
let arrowLeft;
|
|
1795
|
+
let arrowTop;
|
|
1796
|
+
switch (placement) {
|
|
1797
|
+
case "top":
|
|
1798
|
+
top = aTop - tH - GAP;
|
|
1799
|
+
left = aLeft + aW / 2 - tW / 2;
|
|
1800
|
+
arrowLeft = tW / 2 - 4;
|
|
1801
|
+
break;
|
|
1802
|
+
case "top-start":
|
|
1803
|
+
top = aTop - tH - GAP;
|
|
1804
|
+
left = aLeft;
|
|
1805
|
+
arrowLeft = Math.min(aW / 2, tW - 16);
|
|
1806
|
+
break;
|
|
1807
|
+
case "top-end":
|
|
1808
|
+
top = aTop - tH - GAP;
|
|
1809
|
+
left = aLeft + aW - tW;
|
|
1810
|
+
arrowLeft = Math.max(tW - aW / 2 - 4, 8);
|
|
1811
|
+
break;
|
|
1812
|
+
case "bottom":
|
|
1813
|
+
top = aTop + aH + GAP;
|
|
1814
|
+
left = aLeft + aW / 2 - tW / 2;
|
|
1815
|
+
arrowLeft = tW / 2 - 4;
|
|
1816
|
+
break;
|
|
1817
|
+
case "bottom-start":
|
|
1818
|
+
top = aTop + aH + GAP;
|
|
1819
|
+
left = aLeft;
|
|
1820
|
+
arrowLeft = Math.min(aW / 2, tW - 16);
|
|
1821
|
+
break;
|
|
1822
|
+
case "bottom-end":
|
|
1823
|
+
top = aTop + aH + GAP;
|
|
1824
|
+
left = aLeft + aW - tW;
|
|
1825
|
+
arrowLeft = Math.max(tW - aW / 2 - 4, 8);
|
|
1826
|
+
break;
|
|
1827
|
+
case "left":
|
|
1828
|
+
top = aTop + aH / 2 - tH / 2;
|
|
1829
|
+
left = aLeft - tW - GAP;
|
|
1830
|
+
arrowTop = tH / 2 - 4;
|
|
1831
|
+
break;
|
|
1832
|
+
case "left-start":
|
|
1833
|
+
top = aTop;
|
|
1834
|
+
left = aLeft - tW - GAP;
|
|
1835
|
+
arrowTop = Math.min(aH / 2, tH - 16);
|
|
1836
|
+
break;
|
|
1837
|
+
case "left-end":
|
|
1838
|
+
top = aTop + aH - tH;
|
|
1839
|
+
left = aLeft - tW - GAP;
|
|
1840
|
+
arrowTop = Math.max(tH - aH / 2 - 4, 8);
|
|
1841
|
+
break;
|
|
1842
|
+
case "right":
|
|
1843
|
+
top = aTop + aH / 2 - tH / 2;
|
|
1844
|
+
left = aLeft + aW + GAP;
|
|
1845
|
+
arrowTop = tH / 2 - 4;
|
|
1846
|
+
break;
|
|
1847
|
+
case "right-start":
|
|
1848
|
+
top = aTop;
|
|
1849
|
+
left = aLeft + aW + GAP;
|
|
1850
|
+
arrowTop = Math.min(aH / 2, tH - 16);
|
|
1851
|
+
break;
|
|
1852
|
+
case "right-end":
|
|
1853
|
+
top = aTop + aH - tH;
|
|
1854
|
+
left = aLeft + aW + GAP;
|
|
1855
|
+
arrowTop = Math.max(tH - aH / 2 - 4, 8);
|
|
1856
|
+
break;
|
|
1857
|
+
default:
|
|
1858
|
+
top = aTop - tH - GAP;
|
|
1859
|
+
left = aLeft + aW / 2 - tW / 2;
|
|
1860
|
+
}
|
|
1861
|
+
const vw = window.innerWidth;
|
|
1862
|
+
const vh = window.innerHeight;
|
|
1863
|
+
left = Math.max(8, Math.min(left, vw - tW - 8));
|
|
1864
|
+
top = Math.max(8, Math.min(top, vh - tH - 8));
|
|
1865
|
+
return { top, left, arrowLeft, arrowTop };
|
|
1866
|
+
}
|
|
1867
|
+
var Tooltip = ({
|
|
1868
|
+
title,
|
|
1869
|
+
placement = "top",
|
|
1870
|
+
arrow = false,
|
|
1871
|
+
open: controlledOpen,
|
|
1872
|
+
disableHoverListener = false,
|
|
1873
|
+
disableFocusListener = false,
|
|
1874
|
+
enterDelay = 100,
|
|
1875
|
+
leaveDelay = 0,
|
|
1876
|
+
children,
|
|
1877
|
+
followCursor = false,
|
|
1878
|
+
className = "",
|
|
1879
|
+
style,
|
|
1880
|
+
sx
|
|
1881
|
+
}) => {
|
|
1882
|
+
const sxClass = useSx(sx);
|
|
1883
|
+
const [internalOpen, setInternalOpen] = useState4(false);
|
|
1884
|
+
const [position, setPosition] = useState4({ top: 0, left: 0 });
|
|
1885
|
+
const anchorRef = useRef3(null);
|
|
1886
|
+
const tooltipRef = useRef3(null);
|
|
1887
|
+
const enterTimer = useRef3(null);
|
|
1888
|
+
const leaveTimer = useRef3(null);
|
|
1889
|
+
const cursorPos = useRef3({ x: 0, y: 0 });
|
|
1890
|
+
const isOpen = controlledOpen !== void 0 ? controlledOpen : internalOpen;
|
|
1891
|
+
const clearTimers = useCallback(() => {
|
|
1892
|
+
if (enterTimer.current) clearTimeout(enterTimer.current);
|
|
1893
|
+
if (leaveTimer.current) clearTimeout(leaveTimer.current);
|
|
1894
|
+
}, []);
|
|
1895
|
+
const updatePosition = useCallback(() => {
|
|
1896
|
+
if (!anchorRef.current || !tooltipRef.current) return;
|
|
1897
|
+
const anchorRect = anchorRef.current.getBoundingClientRect();
|
|
1898
|
+
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
1899
|
+
if (followCursor) {
|
|
1900
|
+
const fakeRect = {
|
|
1901
|
+
top: cursorPos.current.y,
|
|
1902
|
+
left: cursorPos.current.x,
|
|
1903
|
+
right: cursorPos.current.x,
|
|
1904
|
+
bottom: cursorPos.current.y,
|
|
1905
|
+
width: 0,
|
|
1906
|
+
height: 0,
|
|
1907
|
+
x: cursorPos.current.x,
|
|
1908
|
+
y: cursorPos.current.y,
|
|
1909
|
+
toJSON: () => ({})
|
|
1910
|
+
};
|
|
1911
|
+
setPosition(computePosition(fakeRect, tooltipRect, placement));
|
|
1912
|
+
} else {
|
|
1913
|
+
setPosition(computePosition(anchorRect, tooltipRect, placement));
|
|
1914
|
+
}
|
|
1915
|
+
}, [placement, followCursor]);
|
|
1916
|
+
useEffect4(() => {
|
|
1917
|
+
if (isOpen) {
|
|
1918
|
+
requestAnimationFrame(() => {
|
|
1919
|
+
updatePosition();
|
|
1920
|
+
});
|
|
1921
|
+
}
|
|
1922
|
+
}, [isOpen, updatePosition]);
|
|
1923
|
+
const handleOpen = useCallback(() => {
|
|
1924
|
+
clearTimers();
|
|
1925
|
+
if (enterDelay > 0) {
|
|
1926
|
+
enterTimer.current = setTimeout(() => {
|
|
1927
|
+
setInternalOpen(true);
|
|
1928
|
+
}, enterDelay);
|
|
1929
|
+
} else {
|
|
1930
|
+
setInternalOpen(true);
|
|
1931
|
+
}
|
|
1932
|
+
}, [enterDelay, clearTimers]);
|
|
1933
|
+
const handleClose = useCallback(() => {
|
|
1934
|
+
clearTimers();
|
|
1935
|
+
if (leaveDelay > 0) {
|
|
1936
|
+
leaveTimer.current = setTimeout(() => {
|
|
1937
|
+
setInternalOpen(false);
|
|
1938
|
+
}, leaveDelay);
|
|
1939
|
+
} else {
|
|
1940
|
+
setInternalOpen(false);
|
|
1941
|
+
}
|
|
1942
|
+
}, [leaveDelay, clearTimers]);
|
|
1943
|
+
const handleMouseMove = useCallback(
|
|
1944
|
+
(e) => {
|
|
1945
|
+
cursorPos.current = { x: e.clientX, y: e.clientY };
|
|
1946
|
+
if (isOpen && followCursor) {
|
|
1947
|
+
updatePosition();
|
|
1948
|
+
}
|
|
1949
|
+
},
|
|
1950
|
+
[isOpen, followCursor, updatePosition]
|
|
1951
|
+
);
|
|
1952
|
+
useEffect4(() => {
|
|
1953
|
+
return () => clearTimers();
|
|
1954
|
+
}, [clearTimers]);
|
|
1955
|
+
const childProps = {};
|
|
1956
|
+
if (!disableHoverListener) {
|
|
1957
|
+
childProps.onMouseEnter = handleOpen;
|
|
1958
|
+
childProps.onMouseLeave = handleClose;
|
|
1959
|
+
childProps.onMouseMove = followCursor ? handleMouseMove : void 0;
|
|
1960
|
+
}
|
|
1961
|
+
if (!disableFocusListener) {
|
|
1962
|
+
childProps.onFocus = handleOpen;
|
|
1963
|
+
childProps.onBlur = handleClose;
|
|
1964
|
+
}
|
|
1965
|
+
const tooltipClasses = [
|
|
1966
|
+
"rf-tooltip",
|
|
1967
|
+
`rf-tooltip--placement-${placement}`,
|
|
1968
|
+
isOpen ? "rf-tooltip--visible" : "",
|
|
1969
|
+
sxClass,
|
|
1970
|
+
className
|
|
1971
|
+
].filter(Boolean).join(" ");
|
|
1972
|
+
const tooltipElement = /* @__PURE__ */ React69.createElement(
|
|
1973
|
+
"div",
|
|
1974
|
+
{
|
|
1975
|
+
ref: tooltipRef,
|
|
1976
|
+
className: tooltipClasses,
|
|
1977
|
+
style: {
|
|
1978
|
+
top: position.top,
|
|
1979
|
+
left: position.left,
|
|
1980
|
+
...style
|
|
1981
|
+
},
|
|
1982
|
+
role: "tooltip",
|
|
1983
|
+
"aria-hidden": !isOpen
|
|
1984
|
+
},
|
|
1985
|
+
title,
|
|
1986
|
+
arrow && /* @__PURE__ */ React69.createElement(
|
|
1987
|
+
"span",
|
|
1988
|
+
{
|
|
1989
|
+
className: "rf-tooltip__arrow",
|
|
1990
|
+
style: {
|
|
1991
|
+
...position.arrowLeft !== void 0 ? { left: position.arrowLeft } : {},
|
|
1992
|
+
...position.arrowTop !== void 0 ? { top: position.arrowTop } : {}
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
)
|
|
1996
|
+
);
|
|
1997
|
+
return /* @__PURE__ */ React69.createElement(React69.Fragment, null, /* @__PURE__ */ React69.createElement(
|
|
1998
|
+
"span",
|
|
1999
|
+
{
|
|
2000
|
+
ref: anchorRef,
|
|
2001
|
+
style: { display: "inline-flex", position: "relative" },
|
|
2002
|
+
"aria-describedby": isOpen ? "rf-tooltip" : void 0,
|
|
2003
|
+
...childProps
|
|
2004
|
+
},
|
|
2005
|
+
React69.cloneElement(children)
|
|
2006
|
+
), ReactDOM2.createPortal(tooltipElement, document.body));
|
|
2007
|
+
};
|
|
2008
|
+
Tooltip.displayName = "Tooltip";
|
|
2009
|
+
|
|
2010
|
+
// lib/TextFields/Autocomplete.tsx
|
|
2011
|
+
var ChevronDownIcon = () => /* @__PURE__ */ React70.createElement("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React70.createElement("polyline", { points: "6 9 12 15 18 9" }));
|
|
2012
|
+
var CloseSmIcon = ({ size = 16 }) => /* @__PURE__ */ React70.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }, /* @__PURE__ */ React70.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ React70.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" }));
|
|
2013
|
+
var CheckIcon = () => /* @__PURE__ */ React70.createElement("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React70.createElement("polyline", { points: "20 6 9 17 4 12" }));
|
|
1760
2014
|
function defaultGetLabel(option) {
|
|
1761
2015
|
if (option === null || option === void 0) return "";
|
|
1762
2016
|
if (typeof option === "string") return option;
|
|
@@ -1766,11 +2020,19 @@ function defaultGetLabel(option) {
|
|
|
1766
2020
|
}
|
|
1767
2021
|
function defaultIsEqual(a, b) {
|
|
1768
2022
|
if (a === b) return true;
|
|
1769
|
-
if (a
|
|
2023
|
+
if (a == null || b == null) return false;
|
|
2024
|
+
const aIsObj = typeof a === "object";
|
|
2025
|
+
const bIsObj = typeof b === "object";
|
|
2026
|
+
if (aIsObj && bIsObj) {
|
|
1770
2027
|
const aVal = a.value;
|
|
1771
2028
|
const bVal = b.value;
|
|
1772
2029
|
if (aVal !== void 0 && bVal !== void 0) return aVal === bVal;
|
|
2030
|
+
const aId = a.id;
|
|
2031
|
+
const bId = b.id;
|
|
2032
|
+
if (aId !== void 0 && bId !== void 0) return aId === bId;
|
|
1773
2033
|
}
|
|
2034
|
+
if (aIsObj && !bIsObj) return a.value === b;
|
|
2035
|
+
if (!aIsObj && bIsObj) return a === b.value;
|
|
1774
2036
|
return false;
|
|
1775
2037
|
}
|
|
1776
2038
|
function defaultFilter(options, inputValue, getLabel) {
|
|
@@ -1813,18 +2075,18 @@ function AutocompleteInner(props, _ref) {
|
|
|
1813
2075
|
onOpen,
|
|
1814
2076
|
onClose
|
|
1815
2077
|
} = props;
|
|
1816
|
-
const [open, setOpen] =
|
|
1817
|
-
const [inputStr, setInputStr] =
|
|
1818
|
-
const [filterQuery, setFilterQuery] =
|
|
1819
|
-
const [focusedIdx, setFocusedIdx] =
|
|
1820
|
-
const [popupStyle, setPopupStyle] =
|
|
1821
|
-
const containerRef =
|
|
1822
|
-
const popupRef =
|
|
1823
|
-
const inputRef =
|
|
1824
|
-
const listRef =
|
|
1825
|
-
const inputId =
|
|
2078
|
+
const [open, setOpen] = useState5(false);
|
|
2079
|
+
const [inputStr, setInputStr] = useState5("");
|
|
2080
|
+
const [filterQuery, setFilterQuery] = useState5("");
|
|
2081
|
+
const [focusedIdx, setFocusedIdx] = useState5(-1);
|
|
2082
|
+
const [popupStyle, setPopupStyle] = useState5({});
|
|
2083
|
+
const containerRef = useRef4(null);
|
|
2084
|
+
const popupRef = useRef4(null);
|
|
2085
|
+
const inputRef = useRef4(null);
|
|
2086
|
+
const listRef = useRef4(null);
|
|
2087
|
+
const inputId = useRef4(`rf-ac-${Math.random().toString(36).slice(2, 9)}`).current;
|
|
1826
2088
|
const sxClass = useSx(sx);
|
|
1827
|
-
const calcPopupStyle =
|
|
2089
|
+
const calcPopupStyle = useCallback2(() => {
|
|
1828
2090
|
if (!containerRef.current) return;
|
|
1829
2091
|
const rect = containerRef.current.getBoundingClientRect();
|
|
1830
2092
|
const POPUP_MAX_HEIGHT = 280;
|
|
@@ -1855,11 +2117,11 @@ function AutocompleteInner(props, _ref) {
|
|
|
1855
2117
|
}, []);
|
|
1856
2118
|
const activeInput = controlledInput !== void 0 ? controlledInput : inputStr;
|
|
1857
2119
|
const selectedValues = multiple ? Array.isArray(value) ? value : [] : value != null ? [value] : [];
|
|
1858
|
-
const isEqual =
|
|
2120
|
+
const isEqual = useCallback2(
|
|
1859
2121
|
(a, b) => isOptionEqualToValue ? isOptionEqualToValue(a, b) : defaultIsEqual(a, b),
|
|
1860
2122
|
[isOptionEqualToValue]
|
|
1861
2123
|
);
|
|
1862
|
-
const isSelected =
|
|
2124
|
+
const isSelected = useCallback2(
|
|
1863
2125
|
(opt) => selectedValues.some((v) => isEqual(opt, v)),
|
|
1864
2126
|
[selectedValues, isEqual]
|
|
1865
2127
|
);
|
|
@@ -1886,7 +2148,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
1886
2148
|
filtered.forEach((opt, i) => flatEntries.push({ kind: "option", option: opt, flatIdx: i }));
|
|
1887
2149
|
}
|
|
1888
2150
|
const selectableOptions = flatEntries.filter((e) => e.kind === "option");
|
|
1889
|
-
const openPopup =
|
|
2151
|
+
const openPopup = useCallback2(() => {
|
|
1890
2152
|
if (disabled) return;
|
|
1891
2153
|
calcPopupStyle();
|
|
1892
2154
|
setOpen(true);
|
|
@@ -1894,7 +2156,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
1894
2156
|
setFilterQuery("");
|
|
1895
2157
|
onOpen?.();
|
|
1896
2158
|
}, [disabled, calcPopupStyle, onOpen]);
|
|
1897
|
-
const closePopup =
|
|
2159
|
+
const closePopup = useCallback2((justSelected = false) => {
|
|
1898
2160
|
setOpen(false);
|
|
1899
2161
|
setFocusedIdx(-1);
|
|
1900
2162
|
onClose?.();
|
|
@@ -1903,7 +2165,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
1903
2165
|
onInputChange?.("");
|
|
1904
2166
|
}
|
|
1905
2167
|
}, [freeSolo, multiple, value, onInputChange, onClose]);
|
|
1906
|
-
|
|
2168
|
+
useEffect5(() => {
|
|
1907
2169
|
if (!open) return;
|
|
1908
2170
|
const handleOutside = (e) => {
|
|
1909
2171
|
const target = e.target;
|
|
@@ -1922,7 +2184,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
1922
2184
|
window.removeEventListener("resize", calcPopupStyle);
|
|
1923
2185
|
};
|
|
1924
2186
|
}, [open, closePopup, calcPopupStyle]);
|
|
1925
|
-
|
|
2187
|
+
useEffect5(() => {
|
|
1926
2188
|
if (controlledInput !== void 0) return;
|
|
1927
2189
|
if (!multiple) {
|
|
1928
2190
|
const v = value;
|
|
@@ -2038,7 +2300,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2038
2300
|
className
|
|
2039
2301
|
].filter(Boolean).join(" ");
|
|
2040
2302
|
const inputPlaceholder = placeholder || (variant === "outlined" ? " " : void 0);
|
|
2041
|
-
return /* @__PURE__ */
|
|
2303
|
+
return /* @__PURE__ */ React70.createElement("div", { ref: containerRef, className: rootClasses, style }, /* @__PURE__ */ React70.createElement(
|
|
2042
2304
|
"div",
|
|
2043
2305
|
{
|
|
2044
2306
|
className: "rf-text-field__wrapper",
|
|
@@ -2049,7 +2311,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2049
2311
|
}
|
|
2050
2312
|
}
|
|
2051
2313
|
},
|
|
2052
|
-
multiple && visibleTags.map((opt, i) => /* @__PURE__ */
|
|
2314
|
+
multiple && visibleTags.map((opt, i) => /* @__PURE__ */ React70.createElement("span", { key: i, className: "rf-autocomplete__tag" }, /* @__PURE__ */ React70.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis" } }, getOptionLabel(opt)), /* @__PURE__ */ React70.createElement(
|
|
2053
2315
|
"button",
|
|
2054
2316
|
{
|
|
2055
2317
|
type: "button",
|
|
@@ -2058,10 +2320,17 @@ function AutocompleteInner(props, _ref) {
|
|
|
2058
2320
|
onClick: (e) => removeTag(opt, e),
|
|
2059
2321
|
tabIndex: -1
|
|
2060
2322
|
},
|
|
2061
|
-
/* @__PURE__ */
|
|
2323
|
+
/* @__PURE__ */ React70.createElement(CloseSmIcon, { size: 12 })
|
|
2062
2324
|
))),
|
|
2063
|
-
hiddenCount > 0 && /* @__PURE__ */
|
|
2064
|
-
|
|
2325
|
+
hiddenCount > 0 && /* @__PURE__ */ React70.createElement(
|
|
2326
|
+
Tooltip,
|
|
2327
|
+
{
|
|
2328
|
+
title: selectedValues.slice(limitTags).map((o) => getOptionLabel(o)).join(", "),
|
|
2329
|
+
placement: "top"
|
|
2330
|
+
},
|
|
2331
|
+
/* @__PURE__ */ React70.createElement("span", { className: "rf-autocomplete__tag-more" }, "+", hiddenCount, " more")
|
|
2332
|
+
),
|
|
2333
|
+
/* @__PURE__ */ React70.createElement(
|
|
2065
2334
|
"input",
|
|
2066
2335
|
{
|
|
2067
2336
|
ref: inputRef,
|
|
@@ -2083,9 +2352,9 @@ function AutocompleteInner(props, _ref) {
|
|
|
2083
2352
|
"aria-autocomplete": "list"
|
|
2084
2353
|
}
|
|
2085
2354
|
),
|
|
2086
|
-
label && /* @__PURE__ */
|
|
2087
|
-
variant === "outlined" && /* @__PURE__ */
|
|
2088
|
-
/* @__PURE__ */
|
|
2355
|
+
label && /* @__PURE__ */ React70.createElement("label", { htmlFor: inputId, className: "rf-text-field__label" }, label, required && /* @__PURE__ */ React70.createElement("span", { className: "rf-text-field__asterisk" }, " *")),
|
|
2356
|
+
variant === "outlined" && /* @__PURE__ */ React70.createElement("fieldset", { className: "rf-text-field__notch" }, label ? /* @__PURE__ */ React70.createElement("legend", { className: "rf-text-field__legend" }, /* @__PURE__ */ React70.createElement("span", null, label, required ? " *" : "")) : /* @__PURE__ */ React70.createElement("legend", { className: "rf-text-field__legend--empty" })),
|
|
2357
|
+
/* @__PURE__ */ React70.createElement("div", { className: "rf-autocomplete__endgroup" }, hasClearable && /* @__PURE__ */ React70.createElement(
|
|
2089
2358
|
"button",
|
|
2090
2359
|
{
|
|
2091
2360
|
type: "button",
|
|
@@ -2095,8 +2364,8 @@ function AutocompleteInner(props, _ref) {
|
|
|
2095
2364
|
tabIndex: -1,
|
|
2096
2365
|
"aria-label": "Clear"
|
|
2097
2366
|
},
|
|
2098
|
-
/* @__PURE__ */
|
|
2099
|
-
), !freeSolo && /* @__PURE__ */
|
|
2367
|
+
/* @__PURE__ */ React70.createElement(CloseSmIcon, { size: 16 })
|
|
2368
|
+
), !freeSolo && /* @__PURE__ */ React70.createElement(
|
|
2100
2369
|
"button",
|
|
2101
2370
|
{
|
|
2102
2371
|
type: "button",
|
|
@@ -2108,10 +2377,10 @@ function AutocompleteInner(props, _ref) {
|
|
|
2108
2377
|
tabIndex: -1,
|
|
2109
2378
|
"aria-label": open ? "Close" : "Open"
|
|
2110
2379
|
},
|
|
2111
|
-
/* @__PURE__ */
|
|
2380
|
+
/* @__PURE__ */ React70.createElement(ChevronDownIcon, null)
|
|
2112
2381
|
))
|
|
2113
|
-
), helperText && /* @__PURE__ */
|
|
2114
|
-
/* @__PURE__ */
|
|
2382
|
+
), helperText && /* @__PURE__ */ React70.createElement("div", { className: `rf-text-field__helper-text${error ? " rf-text-field__helper-text--error" : ""}` }, helperText), open && !disabled && ReactDOM3.createPortal(
|
|
2383
|
+
/* @__PURE__ */ React70.createElement("div", { ref: popupRef, className: "rf-autocomplete__popup", role: "presentation", style: popupStyle }, loading ? /* @__PURE__ */ React70.createElement("div", { className: "rf-autocomplete__loading" }, /* @__PURE__ */ React70.createElement("span", { className: "rf-ac-spinner" }), loadingText) : flatEntries.length === 0 ? /* @__PURE__ */ React70.createElement("div", { className: "rf-autocomplete__no-options" }, noOptionsText) : /* @__PURE__ */ React70.createElement("ul", { ref: listRef, className: "rf-autocomplete__listbox", role: "listbox" }, groupBy ? (
|
|
2115
2384
|
// Grouped render
|
|
2116
2385
|
(() => {
|
|
2117
2386
|
const rendered = [];
|
|
@@ -2121,7 +2390,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2121
2390
|
if (entry.kind === "group") {
|
|
2122
2391
|
if (groupItems.length > 0) {
|
|
2123
2392
|
rendered.push(
|
|
2124
|
-
/* @__PURE__ */
|
|
2393
|
+
/* @__PURE__ */ React70.createElement("li", { key: `g-${currentGroup}`, role: "presentation" }, /* @__PURE__ */ React70.createElement("div", { className: "rf-autocomplete__group-header" }, currentGroup), /* @__PURE__ */ React70.createElement("ul", { className: "rf-autocomplete__group-items", role: "group" }, groupItems))
|
|
2125
2394
|
);
|
|
2126
2395
|
groupItems = [];
|
|
2127
2396
|
}
|
|
@@ -2132,7 +2401,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2132
2401
|
}
|
|
2133
2402
|
if (ei === flatEntries.length - 1 && groupItems.length > 0) {
|
|
2134
2403
|
rendered.push(
|
|
2135
|
-
/* @__PURE__ */
|
|
2404
|
+
/* @__PURE__ */ React70.createElement("li", { key: `g-${currentGroup}`, role: "presentation" }, /* @__PURE__ */ React70.createElement("div", { className: "rf-autocomplete__group-header" }, currentGroup), /* @__PURE__ */ React70.createElement("ul", { className: "rf-autocomplete__group-items", role: "group" }, groupItems))
|
|
2136
2405
|
);
|
|
2137
2406
|
}
|
|
2138
2407
|
});
|
|
@@ -2146,7 +2415,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2146
2415
|
const focused = focusedIdx === flatIdx;
|
|
2147
2416
|
const optDisabled = getOptionDisabled?.(option) ?? false;
|
|
2148
2417
|
const label2 = getOptionLabel(option);
|
|
2149
|
-
return /* @__PURE__ */
|
|
2418
|
+
return /* @__PURE__ */ React70.createElement(
|
|
2150
2419
|
"li",
|
|
2151
2420
|
{
|
|
2152
2421
|
key: label2 + flatIdx,
|
|
@@ -2165,12 +2434,12 @@ function AutocompleteInner(props, _ref) {
|
|
|
2165
2434
|
onMouseDown: (e) => e.preventDefault(),
|
|
2166
2435
|
onClick: (e) => selectOption(option, e)
|
|
2167
2436
|
},
|
|
2168
|
-
renderOption ? renderOption(option, { selected, focused, index: flatIdx }) : /* @__PURE__ */
|
|
2169
|
-
!renderOption && /* @__PURE__ */
|
|
2437
|
+
renderOption ? renderOption(option, { selected, focused, index: flatIdx }) : /* @__PURE__ */ React70.createElement("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, label2),
|
|
2438
|
+
!renderOption && /* @__PURE__ */ React70.createElement("span", { className: "rf-autocomplete__option-check" }, /* @__PURE__ */ React70.createElement(CheckIcon, null))
|
|
2170
2439
|
);
|
|
2171
2440
|
}
|
|
2172
2441
|
}
|
|
2173
|
-
var Autocomplete =
|
|
2442
|
+
var Autocomplete = React70.forwardRef(AutocompleteInner);
|
|
2174
2443
|
Autocomplete.displayName = "Autocomplete";
|
|
2175
2444
|
|
|
2176
2445
|
// lib/TextFields/AddressLookup.tsx
|
|
@@ -2187,16 +2456,16 @@ var AddressLookup = ({
|
|
|
2187
2456
|
token = ""
|
|
2188
2457
|
}) => {
|
|
2189
2458
|
const { theme } = useRufousTheme();
|
|
2190
|
-
const [suggestions, setSuggestions] =
|
|
2191
|
-
const [loading, setLoading] =
|
|
2192
|
-
const [showSuggestions, setShowSuggestions] =
|
|
2193
|
-
const debounceTimeout =
|
|
2194
|
-
const containerRef =
|
|
2459
|
+
const [suggestions, setSuggestions] = useState6([]);
|
|
2460
|
+
const [loading, setLoading] = useState6(false);
|
|
2461
|
+
const [showSuggestions, setShowSuggestions] = useState6(false);
|
|
2462
|
+
const debounceTimeout = useRef5(null);
|
|
2463
|
+
const containerRef = useRef5(null);
|
|
2195
2464
|
const apiKey = token || "";
|
|
2196
2465
|
const countries = Country.getAllCountries();
|
|
2197
|
-
const [states, setStates] =
|
|
2198
|
-
const [cities, setCities] =
|
|
2199
|
-
|
|
2466
|
+
const [states, setStates] = useState6([]);
|
|
2467
|
+
const [cities, setCities] = useState6([]);
|
|
2468
|
+
useEffect6(() => {
|
|
2200
2469
|
const handleClickOutside = (event) => {
|
|
2201
2470
|
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
2202
2471
|
setShowSuggestions(false);
|
|
@@ -2205,7 +2474,7 @@ var AddressLookup = ({
|
|
|
2205
2474
|
document.addEventListener("mousedown", handleClickOutside);
|
|
2206
2475
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2207
2476
|
}, []);
|
|
2208
|
-
|
|
2477
|
+
useEffect6(() => {
|
|
2209
2478
|
if (value.country) {
|
|
2210
2479
|
const country = countries.find((c) => c.name === value.country);
|
|
2211
2480
|
if (country) {
|
|
@@ -2218,7 +2487,7 @@ var AddressLookup = ({
|
|
|
2218
2487
|
setStates([]);
|
|
2219
2488
|
}
|
|
2220
2489
|
}, [value.country]);
|
|
2221
|
-
|
|
2490
|
+
useEffect6(() => {
|
|
2222
2491
|
if (value.state && value.country) {
|
|
2223
2492
|
const country = countries.find((c) => c.name === value.country);
|
|
2224
2493
|
if (country) {
|
|
@@ -2323,7 +2592,7 @@ var AddressLookup = ({
|
|
|
2323
2592
|
city: ""
|
|
2324
2593
|
});
|
|
2325
2594
|
};
|
|
2326
|
-
return /* @__PURE__ */
|
|
2595
|
+
return /* @__PURE__ */ React71.createElement("div", { className: "address-lookup-container", style: sx, ref: containerRef }, /* @__PURE__ */ React71.createElement("div", { className: `address-lookup-grid address-lookup-grid-${layout}` }, /* @__PURE__ */ React71.createElement("div", { className: "address-lookup-grid-item col-l1" }, /* @__PURE__ */ React71.createElement(
|
|
2327
2596
|
TextField,
|
|
2328
2597
|
{
|
|
2329
2598
|
label,
|
|
@@ -2355,7 +2624,7 @@ var AddressLookup = ({
|
|
|
2355
2624
|
},
|
|
2356
2625
|
onFocus: () => suggestions.length > 0 && setShowSuggestions(true)
|
|
2357
2626
|
}
|
|
2358
|
-
), loading && /* @__PURE__ */
|
|
2627
|
+
), loading && /* @__PURE__ */ React71.createElement("div", { className: "loading-indicator" }, /* @__PURE__ */ React71.createElement(circularProgress_default, { size: 20 })), showSuggestions && suggestions.length > 0 && /* @__PURE__ */ React71.createElement("div", { className: "autocomplete-dropdown" }, suggestions.map((option, idx) => /* @__PURE__ */ React71.createElement(
|
|
2359
2628
|
"div",
|
|
2360
2629
|
{
|
|
2361
2630
|
key: idx,
|
|
@@ -2366,9 +2635,9 @@ var AddressLookup = ({
|
|
|
2366
2635
|
fetchPlaceDetails(option.placePrediction.placeId, mainText);
|
|
2367
2636
|
}
|
|
2368
2637
|
},
|
|
2369
|
-
/* @__PURE__ */
|
|
2370
|
-
/* @__PURE__ */
|
|
2371
|
-
))), error.addressLine1 && /* @__PURE__ */
|
|
2638
|
+
/* @__PURE__ */ React71.createElement("div", { className: "autocomplete-main-text" }, option?.placePrediction?.structuredFormat?.mainText?.text),
|
|
2639
|
+
/* @__PURE__ */ React71.createElement("div", { className: "autocomplete-secondary-text" }, option?.placePrediction?.structuredFormat?.secondaryText?.text)
|
|
2640
|
+
))), error.addressLine1 && /* @__PURE__ */ React71.createElement("div", { className: "field-error-text" }, error.addressLine1)), layout === "compact" && /* @__PURE__ */ React71.createElement("div", { className: "address-lookup-grid-item col-l2" }, /* @__PURE__ */ React71.createElement(
|
|
2372
2641
|
TextField,
|
|
2373
2642
|
{
|
|
2374
2643
|
label: "Address Line 2",
|
|
@@ -2377,7 +2646,7 @@ var AddressLookup = ({
|
|
|
2377
2646
|
value: value.addressLine2 || "",
|
|
2378
2647
|
onChange: (e) => handleChange("addressLine2", e.target.value)
|
|
2379
2648
|
}
|
|
2380
|
-
)), layout !== "compact" && /* @__PURE__ */
|
|
2649
|
+
)), layout !== "compact" && /* @__PURE__ */ React71.createElement("div", { className: "address-lookup-grid-item col-l2" }, /* @__PURE__ */ React71.createElement(
|
|
2381
2650
|
TextField,
|
|
2382
2651
|
{
|
|
2383
2652
|
label: "Address Line 2",
|
|
@@ -2386,7 +2655,7 @@ var AddressLookup = ({
|
|
|
2386
2655
|
value: value.addressLine2 || "",
|
|
2387
2656
|
onChange: (e) => handleChange("addressLine2", e.target.value)
|
|
2388
2657
|
}
|
|
2389
|
-
)), /* @__PURE__ */
|
|
2658
|
+
)), /* @__PURE__ */ React71.createElement("div", { className: "address-lookup-grid-item col-country" }, /* @__PURE__ */ React71.createElement(
|
|
2390
2659
|
Autocomplete,
|
|
2391
2660
|
{
|
|
2392
2661
|
options: countries.map((c) => c.name),
|
|
@@ -2397,7 +2666,7 @@ var AddressLookup = ({
|
|
|
2397
2666
|
required,
|
|
2398
2667
|
error: !!error.country
|
|
2399
2668
|
}
|
|
2400
|
-
), error.country && /* @__PURE__ */
|
|
2669
|
+
), error.country && /* @__PURE__ */ React71.createElement("div", { className: "field-error-text" }, error.country)), /* @__PURE__ */ React71.createElement("div", { className: "address-lookup-grid-item col-state" }, /* @__PURE__ */ React71.createElement(
|
|
2401
2670
|
Autocomplete,
|
|
2402
2671
|
{
|
|
2403
2672
|
options: states.map((s2) => s2.name),
|
|
@@ -2408,7 +2677,7 @@ var AddressLookup = ({
|
|
|
2408
2677
|
required,
|
|
2409
2678
|
error: !!error.state
|
|
2410
2679
|
}
|
|
2411
|
-
), error.state && /* @__PURE__ */
|
|
2680
|
+
), error.state && /* @__PURE__ */ React71.createElement("div", { className: "field-error-text" }, error.state)), /* @__PURE__ */ React71.createElement("div", { className: "address-lookup-grid-item col-city" }, /* @__PURE__ */ React71.createElement(
|
|
2412
2681
|
Autocomplete,
|
|
2413
2682
|
{
|
|
2414
2683
|
options: cities.map((c) => c.name),
|
|
@@ -2419,7 +2688,7 @@ var AddressLookup = ({
|
|
|
2419
2688
|
required,
|
|
2420
2689
|
error: !!error.city
|
|
2421
2690
|
}
|
|
2422
|
-
), error.city && /* @__PURE__ */
|
|
2691
|
+
), error.city && /* @__PURE__ */ React71.createElement("div", { className: "field-error-text" }, error.city)), /* @__PURE__ */ React71.createElement("div", { className: "address-lookup-grid-item col-pin" }, /* @__PURE__ */ React71.createElement(
|
|
2423
2692
|
TextField,
|
|
2424
2693
|
{
|
|
2425
2694
|
label: "Pincode",
|
|
@@ -2429,16 +2698,16 @@ var AddressLookup = ({
|
|
|
2429
2698
|
required,
|
|
2430
2699
|
onChange: (e) => handleChange("pincode", e.target.value)
|
|
2431
2700
|
}
|
|
2432
|
-
), error.pincode && /* @__PURE__ */
|
|
2701
|
+
), error.pincode && /* @__PURE__ */ React71.createElement("div", { className: "field-error-text" }, error.pincode))));
|
|
2433
2702
|
};
|
|
2434
2703
|
var AddressLookup_default = AddressLookup;
|
|
2435
2704
|
|
|
2436
2705
|
// lib/TextFields/DateField.tsx
|
|
2437
|
-
import
|
|
2438
|
-
useState as
|
|
2439
|
-
useRef as
|
|
2440
|
-
useEffect as
|
|
2441
|
-
useCallback as
|
|
2706
|
+
import React72, {
|
|
2707
|
+
useState as useState7,
|
|
2708
|
+
useRef as useRef6,
|
|
2709
|
+
useEffect as useEffect7,
|
|
2710
|
+
useCallback as useCallback3
|
|
2442
2711
|
} from "react";
|
|
2443
2712
|
import { createPortal } from "react-dom";
|
|
2444
2713
|
var WEEKDAYS = ["SU", "MO", "TU", "WE", "TH", "FR", "SA"];
|
|
@@ -2600,25 +2869,25 @@ var parseTimeFromISO = (iso) => {
|
|
|
2600
2869
|
if (h === 0) h = 12;
|
|
2601
2870
|
return { h, m, ampm };
|
|
2602
2871
|
};
|
|
2603
|
-
var CalendarIcon = () => /* @__PURE__ */
|
|
2604
|
-
var ChevUp = () => /* @__PURE__ */
|
|
2605
|
-
var ChevDown = () => /* @__PURE__ */
|
|
2872
|
+
var CalendarIcon = () => /* @__PURE__ */ React72.createElement("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React72.createElement("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }), /* @__PURE__ */ React72.createElement("line", { x1: "16", y1: "2", x2: "16", y2: "6" }), /* @__PURE__ */ React72.createElement("line", { x1: "8", y1: "2", x2: "8", y2: "6" }), /* @__PURE__ */ React72.createElement("line", { x1: "3", y1: "10", x2: "21", y2: "10" }));
|
|
2873
|
+
var ChevUp = () => /* @__PURE__ */ React72.createElement("svg", { width: "10", height: "7", viewBox: "0 0 10 7", fill: "currentColor" }, /* @__PURE__ */ React72.createElement("path", { d: "M5 0L10 7H0L5 0Z" }));
|
|
2874
|
+
var ChevDown = () => /* @__PURE__ */ React72.createElement("svg", { width: "10", height: "7", viewBox: "0 0 10 7", fill: "currentColor" }, /* @__PURE__ */ React72.createElement("path", { d: "M5 7L0 0H10L5 7Z" }));
|
|
2606
2875
|
var ITEM_H = 36;
|
|
2607
2876
|
var ScrollColumn = ({ items, selected, onSelect, infinite = true }) => {
|
|
2608
|
-
const listRef =
|
|
2609
|
-
const isInternalScroll =
|
|
2610
|
-
const scrollTimeout =
|
|
2877
|
+
const listRef = useRef6(null);
|
|
2878
|
+
const isInternalScroll = useRef6(false);
|
|
2879
|
+
const scrollTimeout = useRef6(null);
|
|
2611
2880
|
const MULTIPLIER = infinite ? 100 : 1;
|
|
2612
2881
|
const virtualItems = infinite ? Array(MULTIPLIER).fill(items).flat() : items;
|
|
2613
2882
|
const centerOffset = infinite ? Math.floor(MULTIPLIER / 2) * items.length : 0;
|
|
2614
2883
|
const VISUAL_OFFSET = 54;
|
|
2615
|
-
|
|
2884
|
+
useEffect7(() => {
|
|
2616
2885
|
if (listRef.current) {
|
|
2617
2886
|
const targetIndex = centerOffset + selected;
|
|
2618
2887
|
listRef.current.scrollTop = targetIndex * ITEM_H - (infinite ? VISUAL_OFFSET : 0);
|
|
2619
2888
|
}
|
|
2620
2889
|
}, [centerOffset, infinite, selected]);
|
|
2621
|
-
|
|
2890
|
+
useEffect7(() => {
|
|
2622
2891
|
if (listRef.current && !isInternalScroll.current) {
|
|
2623
2892
|
const targetIndex = centerOffset + selected;
|
|
2624
2893
|
listRef.current.scrollTo({
|
|
@@ -2650,15 +2919,15 @@ var ScrollColumn = ({ items, selected, onSelect, infinite = true }) => {
|
|
|
2650
2919
|
}
|
|
2651
2920
|
}, 100);
|
|
2652
2921
|
};
|
|
2653
|
-
return /* @__PURE__ */
|
|
2922
|
+
return /* @__PURE__ */ React72.createElement("div", { className: "rf-timescroll__col-wrapper" }, /* @__PURE__ */ React72.createElement(
|
|
2654
2923
|
"div",
|
|
2655
2924
|
{
|
|
2656
2925
|
className: "rf-timescroll__col",
|
|
2657
2926
|
ref: listRef,
|
|
2658
2927
|
onScroll: handleScroll
|
|
2659
2928
|
},
|
|
2660
|
-
!infinite && /* @__PURE__ */
|
|
2661
|
-
virtualItems.map((label, idx) => /* @__PURE__ */
|
|
2929
|
+
!infinite && /* @__PURE__ */ React72.createElement("div", { className: "rf-timescroll__spacer" }),
|
|
2930
|
+
virtualItems.map((label, idx) => /* @__PURE__ */ React72.createElement(
|
|
2662
2931
|
"div",
|
|
2663
2932
|
{
|
|
2664
2933
|
key: `${label}-${idx}`,
|
|
@@ -2666,8 +2935,8 @@ var ScrollColumn = ({ items, selected, onSelect, infinite = true }) => {
|
|
|
2666
2935
|
},
|
|
2667
2936
|
label
|
|
2668
2937
|
)),
|
|
2669
|
-
!infinite && /* @__PURE__ */
|
|
2670
|
-
), /* @__PURE__ */
|
|
2938
|
+
!infinite && /* @__PURE__ */ React72.createElement("div", { className: "rf-timescroll__spacer" })
|
|
2939
|
+
), /* @__PURE__ */ React72.createElement("div", { className: "rf-timescroll__mask rf-timescroll__mask--top" }), /* @__PURE__ */ React72.createElement("div", { className: "rf-timescroll__mask rf-timescroll__mask--bottom" }));
|
|
2671
2940
|
};
|
|
2672
2941
|
var SpinnerPanel = ({
|
|
2673
2942
|
hour,
|
|
@@ -2678,7 +2947,7 @@ var SpinnerPanel = ({
|
|
|
2678
2947
|
onHourInput,
|
|
2679
2948
|
onMinuteInput,
|
|
2680
2949
|
onAmpmToggle
|
|
2681
|
-
}) => /* @__PURE__ */
|
|
2950
|
+
}) => /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__time-row" }, /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__time-input-wrap" }, /* @__PURE__ */ React72.createElement("button", { type: "button", className: "rf-date-picker__time-spin-btn", onMouseDown: (e) => e.preventDefault(), onClick: () => onHourChange(1) }, /* @__PURE__ */ React72.createElement(ChevUp, null)), /* @__PURE__ */ React72.createElement(
|
|
2682
2951
|
"input",
|
|
2683
2952
|
{
|
|
2684
2953
|
type: "number",
|
|
@@ -2689,7 +2958,7 @@ var SpinnerPanel = ({
|
|
|
2689
2958
|
onChange: onHourInput,
|
|
2690
2959
|
onMouseDown: (e) => e.stopPropagation()
|
|
2691
2960
|
}
|
|
2692
|
-
), /* @__PURE__ */
|
|
2961
|
+
), /* @__PURE__ */ React72.createElement("button", { type: "button", className: "rf-date-picker__time-spin-btn", onMouseDown: (e) => e.preventDefault(), onClick: () => onHourChange(-1) }, /* @__PURE__ */ React72.createElement(ChevDown, null))), /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__time-colon" }, ":"), /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__time-input-wrap" }, /* @__PURE__ */ React72.createElement("button", { type: "button", className: "rf-date-picker__time-spin-btn", onMouseDown: (e) => e.preventDefault(), onClick: () => onMinuteChange(1) }, /* @__PURE__ */ React72.createElement(ChevUp, null)), /* @__PURE__ */ React72.createElement(
|
|
2693
2962
|
"input",
|
|
2694
2963
|
{
|
|
2695
2964
|
type: "number",
|
|
@@ -2700,7 +2969,7 @@ var SpinnerPanel = ({
|
|
|
2700
2969
|
onChange: onMinuteInput,
|
|
2701
2970
|
onMouseDown: (e) => e.stopPropagation()
|
|
2702
2971
|
}
|
|
2703
|
-
), /* @__PURE__ */
|
|
2972
|
+
), /* @__PURE__ */ React72.createElement("button", { type: "button", className: "rf-date-picker__time-spin-btn", onMouseDown: (e) => e.preventDefault(), onClick: () => onMinuteChange(-1) }, /* @__PURE__ */ React72.createElement(ChevDown, null))), /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__ampm" }, /* @__PURE__ */ React72.createElement(
|
|
2704
2973
|
"button",
|
|
2705
2974
|
{
|
|
2706
2975
|
type: "button",
|
|
@@ -2709,7 +2978,7 @@ var SpinnerPanel = ({
|
|
|
2709
2978
|
onClick: () => onAmpmToggle("AM")
|
|
2710
2979
|
},
|
|
2711
2980
|
"AM"
|
|
2712
|
-
), /* @__PURE__ */
|
|
2981
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2713
2982
|
"button",
|
|
2714
2983
|
{
|
|
2715
2984
|
type: "button",
|
|
@@ -2731,7 +3000,7 @@ var CalendarBody = ({
|
|
|
2731
3000
|
onMonthSelect,
|
|
2732
3001
|
onYearSelect
|
|
2733
3002
|
}) => {
|
|
2734
|
-
const [pickerView, setPickerView] =
|
|
3003
|
+
const [pickerView, setPickerView] = useState7("calendar");
|
|
2735
3004
|
const handleMonthClick = () => {
|
|
2736
3005
|
setPickerView(pickerView === "month" ? "calendar" : "month");
|
|
2737
3006
|
};
|
|
@@ -2749,21 +3018,21 @@ var CalendarBody = ({
|
|
|
2749
3018
|
const currentYear = todayDate.getFullYear();
|
|
2750
3019
|
const yearStart = viewYear - 6;
|
|
2751
3020
|
const years = Array.from({ length: 16 }, (_, i) => yearStart + i);
|
|
2752
|
-
return /* @__PURE__ */
|
|
3021
|
+
return /* @__PURE__ */ React72.createElement(React72.Fragment, null, /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__header" }, /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__header-labels" }, /* @__PURE__ */ React72.createElement(
|
|
2753
3022
|
"span",
|
|
2754
3023
|
{
|
|
2755
3024
|
className: `rf-date-picker__month-label ${pickerView === "month" ? "rf-date-picker__month-label--active" : ""}`,
|
|
2756
3025
|
onClick: handleMonthClick
|
|
2757
3026
|
},
|
|
2758
3027
|
MONTHS[viewMonth]
|
|
2759
|
-
), /* @__PURE__ */
|
|
3028
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2760
3029
|
"span",
|
|
2761
3030
|
{
|
|
2762
3031
|
className: `rf-date-picker__year-label ${pickerView === "year" ? "rf-date-picker__year-label--active" : ""}`,
|
|
2763
3032
|
onClick: handleYearClick
|
|
2764
3033
|
},
|
|
2765
3034
|
viewYear
|
|
2766
|
-
)), /* @__PURE__ */
|
|
3035
|
+
)), /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__nav" }, pickerView === "year" ? /* @__PURE__ */ React72.createElement(React72.Fragment, null, /* @__PURE__ */ React72.createElement("button", { type: "button", className: "rf-date-picker__nav-btn", onClick: () => onYearSelect(viewYear - 16), "aria-label": "Previous years" }, "\u2039"), /* @__PURE__ */ React72.createElement("button", { type: "button", className: "rf-date-picker__nav-btn", onClick: () => onYearSelect(viewYear + 16), "aria-label": "Next years" }, "\u203A")) : /* @__PURE__ */ React72.createElement(React72.Fragment, null, /* @__PURE__ */ React72.createElement("button", { type: "button", className: "rf-date-picker__nav-btn", onClick: onPrev, "aria-label": "Previous month" }, "\u2039"), /* @__PURE__ */ React72.createElement("button", { type: "button", className: "rf-date-picker__nav-btn", onClick: onNext, "aria-label": "Next month" }, "\u203A")))), pickerView === "month" && /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__month-grid" }, MONTHS_SHORT.map((m, idx) => /* @__PURE__ */ React72.createElement(
|
|
2767
3036
|
"button",
|
|
2768
3037
|
{
|
|
2769
3038
|
key: m,
|
|
@@ -2776,7 +3045,7 @@ var CalendarBody = ({
|
|
|
2776
3045
|
onClick: () => handleMonthPick(idx)
|
|
2777
3046
|
},
|
|
2778
3047
|
m
|
|
2779
|
-
))), pickerView === "year" && /* @__PURE__ */
|
|
3048
|
+
))), pickerView === "year" && /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__year-grid" }, years.map((y) => /* @__PURE__ */ React72.createElement(
|
|
2780
3049
|
"button",
|
|
2781
3050
|
{
|
|
2782
3051
|
key: y,
|
|
@@ -2789,12 +3058,12 @@ var CalendarBody = ({
|
|
|
2789
3058
|
onClick: () => handleYearPick(y)
|
|
2790
3059
|
},
|
|
2791
3060
|
y
|
|
2792
|
-
))), pickerView === "calendar" && /* @__PURE__ */
|
|
2793
|
-
if (day === null) return /* @__PURE__ */
|
|
3061
|
+
))), pickerView === "calendar" && /* @__PURE__ */ React72.createElement(React72.Fragment, null, /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__weekdays" }, WEEKDAYS.map((w) => /* @__PURE__ */ React72.createElement("div", { key: w, className: "rf-date-picker__weekday" }, w))), /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__grid" }, dayCells.map((day, idx) => {
|
|
3062
|
+
if (day === null) return /* @__PURE__ */ React72.createElement("div", { key: `e-${idx}`, className: "rf-date-picker__day rf-date-picker__day--empty" });
|
|
2794
3063
|
const cellDate = new Date(viewYear, viewMonth, day);
|
|
2795
3064
|
const isSelected = selectedDate ? isSameDay(cellDate, selectedDate) : false;
|
|
2796
3065
|
const isToday = isSameDay(cellDate, todayDate);
|
|
2797
|
-
return /* @__PURE__ */
|
|
3066
|
+
return /* @__PURE__ */ React72.createElement(
|
|
2798
3067
|
"button",
|
|
2799
3068
|
{
|
|
2800
3069
|
key: day,
|
|
@@ -2830,29 +3099,29 @@ var DateField = ({
|
|
|
2830
3099
|
sx
|
|
2831
3100
|
}) => {
|
|
2832
3101
|
const sxClass = useSx(sx);
|
|
2833
|
-
const [open, setOpen] =
|
|
2834
|
-
const [selectedDate, setSelectedDate] =
|
|
2835
|
-
const [hour, setHour] =
|
|
3102
|
+
const [open, setOpen] = useState7(false);
|
|
3103
|
+
const [selectedDate, setSelectedDate] = useState7(() => value ? isoToDate(value) : null);
|
|
3104
|
+
const [hour, setHour] = useState7(() => {
|
|
2836
3105
|
if (value && isDatetimeType(type)) return parseTimeFromISO(value).h;
|
|
2837
3106
|
return 12;
|
|
2838
3107
|
});
|
|
2839
|
-
const [minute, setMinute] =
|
|
3108
|
+
const [minute, setMinute] = useState7(() => {
|
|
2840
3109
|
if (value && isDatetimeType(type)) return parseTimeFromISO(value).m;
|
|
2841
3110
|
return 0;
|
|
2842
3111
|
});
|
|
2843
|
-
const [ampm, setAmpm] =
|
|
3112
|
+
const [ampm, setAmpm] = useState7(() => {
|
|
2844
3113
|
if (value && isDatetimeType(type)) return parseTimeFromISO(value).ampm;
|
|
2845
3114
|
return "AM";
|
|
2846
3115
|
});
|
|
2847
|
-
const [viewYear, setViewYear] =
|
|
3116
|
+
const [viewYear, setViewYear] = useState7(() => {
|
|
2848
3117
|
const base = value ? isoToDate(value) : null;
|
|
2849
3118
|
return base ? base.getFullYear() : today().getFullYear();
|
|
2850
3119
|
});
|
|
2851
|
-
const [viewMonth, setViewMonth] =
|
|
3120
|
+
const [viewMonth, setViewMonth] = useState7(() => {
|
|
2852
3121
|
const base = value ? isoToDate(value) : null;
|
|
2853
3122
|
return base ? base.getMonth() : today().getMonth();
|
|
2854
3123
|
});
|
|
2855
|
-
const [inputStr, setInputStr] =
|
|
3124
|
+
const [inputStr, setInputStr] = useState7(() => {
|
|
2856
3125
|
if (!value) return "";
|
|
2857
3126
|
const d = isoToDate(value);
|
|
2858
3127
|
if (!d) return "";
|
|
@@ -2866,12 +3135,12 @@ var DateField = ({
|
|
|
2866
3135
|
const HOURS = Array.from({ length: 12 }, (_, i) => String(i + 1).padStart(2, "0"));
|
|
2867
3136
|
const MINUTES = Array.from({ length: 60 }, (_, i) => String(i).padStart(2, "0"));
|
|
2868
3137
|
const AMPMS = ["AM", "PM"];
|
|
2869
|
-
const containerRef =
|
|
2870
|
-
const pickerRef =
|
|
2871
|
-
const [dropUp, setDropUp] =
|
|
2872
|
-
const inputId =
|
|
2873
|
-
const isInternalChange =
|
|
2874
|
-
|
|
3138
|
+
const containerRef = useRef6(null);
|
|
3139
|
+
const pickerRef = useRef6(null);
|
|
3140
|
+
const [dropUp, setDropUp] = useState7(false);
|
|
3141
|
+
const inputId = useRef6(`rf-df-${Math.random().toString(36).substring(2, 11)}`).current;
|
|
3142
|
+
const isInternalChange = useRef6(false);
|
|
3143
|
+
useEffect7(() => {
|
|
2875
3144
|
if (value === void 0) return;
|
|
2876
3145
|
if (isInternalChange.current) {
|
|
2877
3146
|
isInternalChange.current = false;
|
|
@@ -2898,7 +3167,7 @@ var DateField = ({
|
|
|
2898
3167
|
setInputStr(str);
|
|
2899
3168
|
}
|
|
2900
3169
|
}, [value, type]);
|
|
2901
|
-
|
|
3170
|
+
useEffect7(() => {
|
|
2902
3171
|
if (!open) return;
|
|
2903
3172
|
const handler = (e) => {
|
|
2904
3173
|
const target = e.target;
|
|
@@ -2909,14 +3178,14 @@ var DateField = ({
|
|
|
2909
3178
|
document.addEventListener("mousedown", handler);
|
|
2910
3179
|
return () => document.removeEventListener("mousedown", handler);
|
|
2911
3180
|
}, [open]);
|
|
2912
|
-
|
|
3181
|
+
useEffect7(() => {
|
|
2913
3182
|
if (!open || !containerRef.current) return;
|
|
2914
3183
|
const rect = containerRef.current.getBoundingClientRect();
|
|
2915
3184
|
const spaceBelow = window.innerHeight - rect.bottom;
|
|
2916
3185
|
const pickerHeight = 400;
|
|
2917
3186
|
setDropUp(spaceBelow < pickerHeight && rect.top > pickerHeight);
|
|
2918
3187
|
}, [open]);
|
|
2919
|
-
const commitDate =
|
|
3188
|
+
const commitDate = useCallback3((d, h, m, ap) => {
|
|
2920
3189
|
setSelectedDate(d);
|
|
2921
3190
|
if (!d) {
|
|
2922
3191
|
setInputStr("");
|
|
@@ -3067,7 +3336,7 @@ var DateField = ({
|
|
|
3067
3336
|
const inputPlaceholder = placeholder || (variant === "outlined" ? " " : void 0);
|
|
3068
3337
|
const todayDate = today();
|
|
3069
3338
|
const isSideVariant = type === "datetime-side" || type === "datetime-scroll";
|
|
3070
|
-
return /* @__PURE__ */
|
|
3339
|
+
return /* @__PURE__ */ React72.createElement("div", { ref: containerRef, className: rootClasses, style }, /* @__PURE__ */ React72.createElement("div", { className: "rf-date-field__anchor" }, /* @__PURE__ */ React72.createElement(
|
|
3071
3340
|
"div",
|
|
3072
3341
|
{
|
|
3073
3342
|
className: "rf-text-field__wrapper",
|
|
@@ -3076,7 +3345,7 @@ var DateField = ({
|
|
|
3076
3345
|
},
|
|
3077
3346
|
style: { cursor: disabled ? "default" : "pointer" }
|
|
3078
3347
|
},
|
|
3079
|
-
/* @__PURE__ */
|
|
3348
|
+
/* @__PURE__ */ React72.createElement(
|
|
3080
3349
|
"input",
|
|
3081
3350
|
{
|
|
3082
3351
|
id: inputId,
|
|
@@ -3092,7 +3361,7 @@ var DateField = ({
|
|
|
3092
3361
|
}
|
|
3093
3362
|
}
|
|
3094
3363
|
),
|
|
3095
|
-
/* @__PURE__ */
|
|
3364
|
+
/* @__PURE__ */ React72.createElement("div", { className: "rf-text-field__adornment rf-text-field__adornment--end" }, /* @__PURE__ */ React72.createElement(
|
|
3096
3365
|
"button",
|
|
3097
3366
|
{
|
|
3098
3367
|
type: "button",
|
|
@@ -3105,12 +3374,12 @@ var DateField = ({
|
|
|
3105
3374
|
},
|
|
3106
3375
|
"aria-label": "Pick date"
|
|
3107
3376
|
},
|
|
3108
|
-
/* @__PURE__ */
|
|
3377
|
+
/* @__PURE__ */ React72.createElement(CalendarIcon, null)
|
|
3109
3378
|
)),
|
|
3110
|
-
label && /* @__PURE__ */
|
|
3111
|
-
variant === "outlined" && /* @__PURE__ */
|
|
3379
|
+
label && /* @__PURE__ */ React72.createElement("label", { htmlFor: inputId, className: "rf-text-field__label" }, label, " ", required && /* @__PURE__ */ React72.createElement("span", { className: "rf-text-field__asterisk" }, "*")),
|
|
3380
|
+
variant === "outlined" && /* @__PURE__ */ React72.createElement("fieldset", { className: "rf-text-field__notch" }, label && /* @__PURE__ */ React72.createElement("legend", { className: "rf-text-field__legend" }, /* @__PURE__ */ React72.createElement("span", null, label, required ? " *" : "")))
|
|
3112
3381
|
), open && !disabled && createPortal(
|
|
3113
|
-
/* @__PURE__ */
|
|
3382
|
+
/* @__PURE__ */ React72.createElement(
|
|
3114
3383
|
"div",
|
|
3115
3384
|
{
|
|
3116
3385
|
ref: pickerRef,
|
|
@@ -3135,7 +3404,7 @@ var DateField = ({
|
|
|
3135
3404
|
})(),
|
|
3136
3405
|
onMouseDown: (e) => e.preventDefault()
|
|
3137
3406
|
},
|
|
3138
|
-
/* @__PURE__ */
|
|
3407
|
+
/* @__PURE__ */ React72.createElement("div", { className: isSideVariant ? "rf-date-picker__cal-col" : void 0 }, /* @__PURE__ */ React72.createElement(
|
|
3139
3408
|
CalendarBody,
|
|
3140
3409
|
{
|
|
3141
3410
|
viewMonth,
|
|
@@ -3149,7 +3418,7 @@ var DateField = ({
|
|
|
3149
3418
|
onMonthSelect: setViewMonth,
|
|
3150
3419
|
onYearSelect: setViewYear
|
|
3151
3420
|
}
|
|
3152
|
-
), type === "datetime" && /* @__PURE__ */
|
|
3421
|
+
), type === "datetime" && /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__time-section" }, /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__time-label" }, "Time"), /* @__PURE__ */ React72.createElement(
|
|
3153
3422
|
SpinnerPanel,
|
|
3154
3423
|
{
|
|
3155
3424
|
hour,
|
|
@@ -3161,8 +3430,8 @@ var DateField = ({
|
|
|
3161
3430
|
onMinuteInput: handleMinuteInput,
|
|
3162
3431
|
onAmpmToggle: handleAmpmToggle
|
|
3163
3432
|
}
|
|
3164
|
-
)), /* @__PURE__ */
|
|
3165
|
-
type === "datetime-side" && /* @__PURE__ */
|
|
3433
|
+
)), /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__divider" }), /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__footer" }, /* @__PURE__ */ React72.createElement("button", { type: "button", className: "rf-date-picker__footer-btn", onClick: handleToday }, "Today"), /* @__PURE__ */ React72.createElement("button", { type: "button", className: "rf-date-picker__footer-btn rf-date-picker__footer-btn--clear", onClick: handleClear }, "Clear"))),
|
|
3434
|
+
type === "datetime-side" && /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__side-panel" }, /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__side-label" }, "Time"), /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__side-spinner" }, /* @__PURE__ */ React72.createElement(
|
|
3166
3435
|
SpinnerPanel,
|
|
3167
3436
|
{
|
|
3168
3437
|
hour,
|
|
@@ -3174,22 +3443,22 @@ var DateField = ({
|
|
|
3174
3443
|
onMinuteInput: handleMinuteInput,
|
|
3175
3444
|
onAmpmToggle: handleAmpmToggle
|
|
3176
3445
|
}
|
|
3177
|
-
)), /* @__PURE__ */
|
|
3178
|
-
type === "datetime-scroll" && /* @__PURE__ */
|
|
3446
|
+
)), /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__side-time-display" }, String(hour).padStart(2, "0"), ":", String(minute).padStart(2, "0"), " ", ampm)),
|
|
3447
|
+
type === "datetime-scroll" && /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__side-panel" }, /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__side-label" }, "Time"), /* @__PURE__ */ React72.createElement("div", { className: "rf-timescroll" }, /* @__PURE__ */ React72.createElement(
|
|
3179
3448
|
ScrollColumn,
|
|
3180
3449
|
{
|
|
3181
3450
|
items: HOURS,
|
|
3182
3451
|
selected: hour - 1,
|
|
3183
3452
|
onSelect: handleScrollHour
|
|
3184
3453
|
}
|
|
3185
|
-
), /* @__PURE__ */
|
|
3454
|
+
), /* @__PURE__ */ React72.createElement("div", { className: "rf-timescroll__colon" }, ":"), /* @__PURE__ */ React72.createElement(
|
|
3186
3455
|
ScrollColumn,
|
|
3187
3456
|
{
|
|
3188
3457
|
items: MINUTES,
|
|
3189
3458
|
selected: minute,
|
|
3190
3459
|
onSelect: handleScrollMinute
|
|
3191
3460
|
}
|
|
3192
|
-
), /* @__PURE__ */
|
|
3461
|
+
), /* @__PURE__ */ React72.createElement(
|
|
3193
3462
|
ScrollColumn,
|
|
3194
3463
|
{
|
|
3195
3464
|
items: AMPMS,
|
|
@@ -3197,18 +3466,18 @@ var DateField = ({
|
|
|
3197
3466
|
onSelect: handleScrollAmpm,
|
|
3198
3467
|
infinite: false
|
|
3199
3468
|
}
|
|
3200
|
-
)), /* @__PURE__ */
|
|
3469
|
+
)), /* @__PURE__ */ React72.createElement("div", { className: "rf-date-picker__side-time-display" }, String(hour).padStart(2, "0"), ":", String(minute).padStart(2, "0"), " ", ampm))
|
|
3201
3470
|
),
|
|
3202
3471
|
document.body
|
|
3203
|
-
)), helperText && /* @__PURE__ */
|
|
3472
|
+
)), helperText && /* @__PURE__ */ React72.createElement("div", { className: "rf-text-field__helper-text" }, helperText));
|
|
3204
3473
|
};
|
|
3205
3474
|
DateField.displayName = "DateField";
|
|
3206
3475
|
|
|
3207
3476
|
// lib/TextFields/DateRangeField.tsx
|
|
3208
|
-
import
|
|
3209
|
-
useState as
|
|
3210
|
-
useRef as
|
|
3211
|
-
useEffect as
|
|
3477
|
+
import React73, {
|
|
3478
|
+
useState as useState8,
|
|
3479
|
+
useRef as useRef7,
|
|
3480
|
+
useEffect as useEffect8
|
|
3212
3481
|
} from "react";
|
|
3213
3482
|
var WEEKDAYS2 = ["SU", "MO", "TU", "WE", "TH", "FR", "SA"];
|
|
3214
3483
|
var MONTHS2 = [
|
|
@@ -3334,7 +3603,7 @@ var detectPreset = (start, end) => {
|
|
|
3334
3603
|
if (isSameDay2(start, new Date(2e3, 0, 1)) && isSameDay2(end, today2)) return "all";
|
|
3335
3604
|
return null;
|
|
3336
3605
|
};
|
|
3337
|
-
var CalendarIcon2 = () => /* @__PURE__ */
|
|
3606
|
+
var CalendarIcon2 = () => /* @__PURE__ */ React73.createElement("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React73.createElement("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }), /* @__PURE__ */ React73.createElement("line", { x1: "16", y1: "2", x2: "16", y2: "6" }), /* @__PURE__ */ React73.createElement("line", { x1: "8", y1: "2", x2: "8", y2: "6" }), /* @__PURE__ */ React73.createElement("line", { x1: "3", y1: "10", x2: "21", y2: "10" }));
|
|
3338
3607
|
var RangeCalendarBody = ({
|
|
3339
3608
|
viewYear,
|
|
3340
3609
|
viewMonth,
|
|
@@ -3359,7 +3628,7 @@ var RangeCalendarBody = ({
|
|
|
3359
3628
|
const hasRange = startDate != null && effectiveEnd != null && !isSameDay2(startDate, effectiveEnd);
|
|
3360
3629
|
const lo = startDate && effectiveEnd ? startDate <= effectiveEnd ? startDate : effectiveEnd : null;
|
|
3361
3630
|
const hi = startDate && effectiveEnd ? startDate <= effectiveEnd ? effectiveEnd : startDate : null;
|
|
3362
|
-
return /* @__PURE__ */
|
|
3631
|
+
return /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-calendar" }, /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-calendar__header" }, /* @__PURE__ */ React73.createElement(
|
|
3363
3632
|
"button",
|
|
3364
3633
|
{
|
|
3365
3634
|
type: "button",
|
|
@@ -3369,7 +3638,7 @@ var RangeCalendarBody = ({
|
|
|
3369
3638
|
"aria-label": "Previous month"
|
|
3370
3639
|
},
|
|
3371
3640
|
"\u2039"
|
|
3372
|
-
), /* @__PURE__ */
|
|
3641
|
+
), /* @__PURE__ */ React73.createElement("span", { className: "rf-dr-calendar__month-label" }, MONTHS2[viewMonth], " ", viewYear), /* @__PURE__ */ React73.createElement(
|
|
3373
3642
|
"button",
|
|
3374
3643
|
{
|
|
3375
3644
|
type: "button",
|
|
@@ -3379,9 +3648,9 @@ var RangeCalendarBody = ({
|
|
|
3379
3648
|
"aria-label": "Next month"
|
|
3380
3649
|
},
|
|
3381
3650
|
"\u203A"
|
|
3382
|
-
)), /* @__PURE__ */
|
|
3651
|
+
)), /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-calendar__weekdays" }, WEEKDAYS2.map((w) => /* @__PURE__ */ React73.createElement("div", { key: w, className: "rf-dr-calendar__weekday" }, w))), /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-calendar__grid" }, dayCells.map((day, idx) => {
|
|
3383
3652
|
if (day === null) {
|
|
3384
|
-
return /* @__PURE__ */
|
|
3653
|
+
return /* @__PURE__ */ React73.createElement("div", { key: `e-${idx}`, className: "rf-dr-calendar__cell rf-dr-calendar__cell--empty" });
|
|
3385
3654
|
}
|
|
3386
3655
|
const cellDate = new Date(viewYear, viewMonth, day);
|
|
3387
3656
|
const isStart = startDate ? isSameDay2(cellDate, startDate) : false;
|
|
@@ -3401,7 +3670,7 @@ var RangeCalendarBody = ({
|
|
|
3401
3670
|
isStart || isEnd ? "rf-dr-calendar__day--selected" : "",
|
|
3402
3671
|
isToday && !isStart && !isEnd ? "rf-dr-calendar__day--today" : ""
|
|
3403
3672
|
].filter(Boolean).join(" ");
|
|
3404
|
-
return /* @__PURE__ */
|
|
3673
|
+
return /* @__PURE__ */ React73.createElement(
|
|
3405
3674
|
"div",
|
|
3406
3675
|
{
|
|
3407
3676
|
key: day,
|
|
@@ -3409,7 +3678,7 @@ var RangeCalendarBody = ({
|
|
|
3409
3678
|
onMouseEnter: () => onDayHover(cellDate),
|
|
3410
3679
|
onMouseLeave: () => onDayHover(null)
|
|
3411
3680
|
},
|
|
3412
|
-
/* @__PURE__ */
|
|
3681
|
+
/* @__PURE__ */ React73.createElement(
|
|
3413
3682
|
"button",
|
|
3414
3683
|
{
|
|
3415
3684
|
type: "button",
|
|
@@ -3423,8 +3692,8 @@ var RangeCalendarBody = ({
|
|
|
3423
3692
|
};
|
|
3424
3693
|
var MiniCalendar = ({ selectedDate, todayDate, onSelect, onClose }) => {
|
|
3425
3694
|
const init = selectedDate ?? todayDate;
|
|
3426
|
-
const [viewYear, setViewYear] =
|
|
3427
|
-
const [viewMonth, setViewMonth] =
|
|
3695
|
+
const [viewYear, setViewYear] = useState8(init.getFullYear());
|
|
3696
|
+
const [viewMonth, setViewMonth] = useState8(init.getMonth());
|
|
3428
3697
|
const firstDay = new Date(viewYear, viewMonth, 1).getDay();
|
|
3429
3698
|
const daysInMonth = new Date(viewYear, viewMonth + 1, 0).getDate();
|
|
3430
3699
|
const dayCells = [
|
|
@@ -3443,14 +3712,14 @@ var MiniCalendar = ({ selectedDate, todayDate, onSelect, onClose }) => {
|
|
|
3443
3712
|
setViewYear((y) => y + 1);
|
|
3444
3713
|
} else setViewMonth((m) => m + 1);
|
|
3445
3714
|
};
|
|
3446
|
-
return /* @__PURE__ */
|
|
3715
|
+
return /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-mini-cal" }, /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-mini-cal__header" }, /* @__PURE__ */ React73.createElement("button", { type: "button", className: "rf-dr-calendar__nav-btn", onClick: prevMonth }, "\u2039"), /* @__PURE__ */ React73.createElement("span", { className: "rf-dr-calendar__month-label", style: { fontSize: "0.88rem" } }, MONTHS2[viewMonth], " ", viewYear), /* @__PURE__ */ React73.createElement("button", { type: "button", className: "rf-dr-calendar__nav-btn", onClick: nextMonth }, "\u203A")), /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-calendar__weekdays" }, WEEKDAYS2.map((w) => /* @__PURE__ */ React73.createElement("div", { key: w, className: "rf-dr-calendar__weekday" }, w))), /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-calendar__grid" }, dayCells.map((day, idx) => {
|
|
3447
3716
|
if (day === null) {
|
|
3448
|
-
return /* @__PURE__ */
|
|
3717
|
+
return /* @__PURE__ */ React73.createElement("div", { key: `e-${idx}`, className: "rf-dr-calendar__cell rf-dr-calendar__cell--empty" });
|
|
3449
3718
|
}
|
|
3450
3719
|
const cellDate = new Date(viewYear, viewMonth, day);
|
|
3451
3720
|
const isSel = selectedDate ? isSameDay2(cellDate, selectedDate) : false;
|
|
3452
3721
|
const isToday = isSameDay2(cellDate, todayDate);
|
|
3453
|
-
return /* @__PURE__ */
|
|
3722
|
+
return /* @__PURE__ */ React73.createElement("div", { key: day, className: "rf-dr-calendar__cell" }, /* @__PURE__ */ React73.createElement(
|
|
3454
3723
|
"button",
|
|
3455
3724
|
{
|
|
3456
3725
|
type: "button",
|
|
@@ -3489,22 +3758,22 @@ var DateRangeField = ({
|
|
|
3489
3758
|
const today2 = todayFn();
|
|
3490
3759
|
const committedStart = value?.start ? isoToDate2(value.start) : null;
|
|
3491
3760
|
const committedEnd = value?.end ? isoToDate2(value.end) : null;
|
|
3492
|
-
const [open, setOpen] =
|
|
3493
|
-
const [draftStart, setDraftStart] =
|
|
3494
|
-
const [draftEnd, setDraftEnd] =
|
|
3495
|
-
const [activePreset, setActivePreset] =
|
|
3761
|
+
const [open, setOpen] = useState8(false);
|
|
3762
|
+
const [draftStart, setDraftStart] = useState8(committedStart);
|
|
3763
|
+
const [draftEnd, setDraftEnd] = useState8(committedEnd);
|
|
3764
|
+
const [activePreset, setActivePreset] = useState8(
|
|
3496
3765
|
() => detectPreset(committedStart, committedEnd)
|
|
3497
3766
|
);
|
|
3498
|
-
const [startInputStr, setStartInputStr] =
|
|
3499
|
-
const [endInputStr, setEndInputStr] =
|
|
3500
|
-
const [inlineCal, setInlineCal] =
|
|
3501
|
-
const [hoverDate, setHoverDate] =
|
|
3502
|
-
const [selecting, setSelecting] =
|
|
3503
|
-
const [leftViewYear, setLeftViewYear] =
|
|
3504
|
-
const [leftViewMonth, setLeftViewMonth] =
|
|
3505
|
-
const containerRef =
|
|
3506
|
-
const inputId =
|
|
3507
|
-
|
|
3767
|
+
const [startInputStr, setStartInputStr] = useState8(() => committedStart ? formatShort(committedStart) : "");
|
|
3768
|
+
const [endInputStr, setEndInputStr] = useState8(() => committedEnd ? formatShort(committedEnd) : "");
|
|
3769
|
+
const [inlineCal, setInlineCal] = useState8(null);
|
|
3770
|
+
const [hoverDate, setHoverDate] = useState8(null);
|
|
3771
|
+
const [selecting, setSelecting] = useState8("start");
|
|
3772
|
+
const [leftViewYear, setLeftViewYear] = useState8(() => today2.getFullYear());
|
|
3773
|
+
const [leftViewMonth, setLeftViewMonth] = useState8(() => today2.getMonth());
|
|
3774
|
+
const containerRef = useRef7(null);
|
|
3775
|
+
const inputId = useRef7(`rf-dr-${Math.random().toString(36).substr(2, 9)}`).current;
|
|
3776
|
+
useEffect8(() => {
|
|
3508
3777
|
const s2 = value?.start ? isoToDate2(value.start) : null;
|
|
3509
3778
|
const e = value?.end ? isoToDate2(value.end) : null;
|
|
3510
3779
|
setDraftStart(s2);
|
|
@@ -3513,10 +3782,10 @@ var DateRangeField = ({
|
|
|
3513
3782
|
setEndInputStr(e ? formatShort(e) : "");
|
|
3514
3783
|
setActivePreset(detectPreset(s2, e));
|
|
3515
3784
|
}, [value?.start, value?.end]);
|
|
3516
|
-
|
|
3785
|
+
useEffect8(() => {
|
|
3517
3786
|
setActivePreset(detectPreset(draftStart, draftEnd));
|
|
3518
3787
|
}, [draftStart?.getTime(), draftEnd?.getTime()]);
|
|
3519
|
-
|
|
3788
|
+
useEffect8(() => {
|
|
3520
3789
|
if (!open) return;
|
|
3521
3790
|
const handler = (e) => {
|
|
3522
3791
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -3658,7 +3927,7 @@ var DateRangeField = ({
|
|
|
3658
3927
|
className
|
|
3659
3928
|
].filter(Boolean).join(" ");
|
|
3660
3929
|
const inputPlaceholder = variant === "outlined" ? " " : void 0;
|
|
3661
|
-
return /* @__PURE__ */
|
|
3930
|
+
return /* @__PURE__ */ React73.createElement("div", { ref: containerRef, className: rootClasses, style }, /* @__PURE__ */ React73.createElement("div", { className: "rf-date-field__anchor" }, /* @__PURE__ */ React73.createElement(
|
|
3662
3931
|
"div",
|
|
3663
3932
|
{
|
|
3664
3933
|
className: "rf-text-field__wrapper",
|
|
@@ -3667,7 +3936,7 @@ var DateRangeField = ({
|
|
|
3667
3936
|
},
|
|
3668
3937
|
style: { cursor: disabled ? "default" : "pointer" }
|
|
3669
3938
|
},
|
|
3670
|
-
/* @__PURE__ */
|
|
3939
|
+
/* @__PURE__ */ React73.createElement(
|
|
3671
3940
|
"input",
|
|
3672
3941
|
{
|
|
3673
3942
|
id: inputId,
|
|
@@ -3683,7 +3952,7 @@ var DateRangeField = ({
|
|
|
3683
3952
|
}
|
|
3684
3953
|
}
|
|
3685
3954
|
),
|
|
3686
|
-
/* @__PURE__ */
|
|
3955
|
+
/* @__PURE__ */ React73.createElement("div", { className: "rf-text-field__adornment rf-text-field__adornment--end" }, /* @__PURE__ */ React73.createElement(
|
|
3687
3956
|
"button",
|
|
3688
3957
|
{
|
|
3689
3958
|
type: "button",
|
|
@@ -3696,13 +3965,13 @@ var DateRangeField = ({
|
|
|
3696
3965
|
},
|
|
3697
3966
|
"aria-label": "Pick date range"
|
|
3698
3967
|
},
|
|
3699
|
-
/* @__PURE__ */
|
|
3968
|
+
/* @__PURE__ */ React73.createElement(CalendarIcon2, null)
|
|
3700
3969
|
)),
|
|
3701
|
-
label && /* @__PURE__ */
|
|
3702
|
-
variant === "outlined" && /* @__PURE__ */
|
|
3970
|
+
label && /* @__PURE__ */ React73.createElement("label", { htmlFor: inputId, className: "rf-text-field__label" }, label, " ", required && /* @__PURE__ */ React73.createElement("span", { className: "rf-text-field__asterisk" }, "*")),
|
|
3971
|
+
variant === "outlined" && /* @__PURE__ */ React73.createElement("fieldset", { className: "rf-text-field__notch" }, label ? /* @__PURE__ */ React73.createElement("legend", { className: "rf-text-field__legend" }, /* @__PURE__ */ React73.createElement("span", null, label, required ? " *" : "")) : /* @__PURE__ */ React73.createElement("legend", { className: "rf-text-field__legend--empty" }))
|
|
3703
3972
|
), open && !disabled && (pickerType === "panel" ? (
|
|
3704
3973
|
/* ── Panel Mode ── */
|
|
3705
|
-
/* @__PURE__ */
|
|
3974
|
+
/* @__PURE__ */ React73.createElement("div", { className: "rf-dr-picker rf-dr-picker--panel", onMouseDown: (e) => e.preventDefault() }, /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-picker__presets" }, PRESETS.map((p, i) => /* @__PURE__ */ React73.createElement(React73.Fragment, { key: p.id }, i > 0 && /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-picker__preset-sep" }), /* @__PURE__ */ React73.createElement(
|
|
3706
3975
|
"button",
|
|
3707
3976
|
{
|
|
3708
3977
|
type: "button",
|
|
@@ -3713,7 +3982,7 @@ var DateRangeField = ({
|
|
|
3713
3982
|
onClick: () => handlePreset(p.id)
|
|
3714
3983
|
},
|
|
3715
3984
|
p.label
|
|
3716
|
-
)))), /* @__PURE__ */
|
|
3985
|
+
)))), /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-picker__manual" }, /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-picker__date-field-wrap" }, /* @__PURE__ */ React73.createElement(
|
|
3717
3986
|
"div",
|
|
3718
3987
|
{
|
|
3719
3988
|
className: [
|
|
@@ -3721,8 +3990,8 @@ var DateRangeField = ({
|
|
|
3721
3990
|
inlineCal === "start" ? "rf-dr-picker__date-field--active" : ""
|
|
3722
3991
|
].filter(Boolean).join(" ")
|
|
3723
3992
|
},
|
|
3724
|
-
/* @__PURE__ */
|
|
3725
|
-
/* @__PURE__ */
|
|
3993
|
+
/* @__PURE__ */ React73.createElement("span", { className: "rf-dr-picker__date-floating-label" }, "Start Date"),
|
|
3994
|
+
/* @__PURE__ */ React73.createElement("div", { className: "rf-dr-picker__date-display" }, /* @__PURE__ */ React73.createElement(
|
|
3726
3995
|
"input",
|
|
3727
3996
|
{
|
|
3728
3997
|
type: "text",
|
|
@@ -3733,7 +4002,7 @@ var DateRangeField = ({
|
|
|
3733
4002
|
onBlur: handleStartInputBlur,
|
|
3734
4003
|
onMouseDown: (e) => e.stopPropagation()
|
|
3735
4004
|
}
|
|
3736
|
-
), /* @__PURE__ */
|
|
4005
|
+
), /* @__PURE__ */ React73.createElement(
|
|
3737
4006
|
"button",
|
|
3738
4007
|
{
|
|
3739
4008
|
type: "button",
|
|
@@ -3742,9 +4011,9 @@ var DateRangeField = ({
|
|
|
3742
4011
|
onClick: () => setInlineCal((v) => v === "start" ? null : "start"),
|
|
3743
4012
|
"aria-label": "Pick start date"
|
|
3744
4013
|
},
|
|
3745
|
-
/* @__PURE__ */
|
|
4014
|
+
/* @__PURE__ */ React73.createElement(CalendarIcon2, null)
|
|
3746
4015
|
))
|
|
3747
|
-
), inlineCal === "start" && /* @__PURE__ */
|
|
4016
|
+
), inlineCal === "start" && /* @__PURE__ */ React73.createElement(
|
|
3748
4017
|
MiniCalendar,
|
|
3749
4018
|
{
|
|
3750
4019
|
selectedDate: draftStart,
|
|
@@ -3755,7 +4024,7 @@ var DateRangeField = ({
|
|
|
3755
4024
|
},
|
|
3756
4025
|
onClose: () => setInlineCal(null)
|
|
3757
4026
|
}
|
|
3758
|
-
)), /* @__PURE__ */
|
|
4027
|
+
)), /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-picker__date-field-wrap" }, /* @__PURE__ */ React73.createElement(
|
|
3759
4028
|
"div",
|
|
3760
4029
|
{
|
|
3761
4030
|
className: [
|
|
@@ -3763,8 +4032,8 @@ var DateRangeField = ({
|
|
|
3763
4032
|
inlineCal === "end" ? "rf-dr-picker__date-field--active" : ""
|
|
3764
4033
|
].filter(Boolean).join(" ")
|
|
3765
4034
|
},
|
|
3766
|
-
/* @__PURE__ */
|
|
3767
|
-
/* @__PURE__ */
|
|
4035
|
+
/* @__PURE__ */ React73.createElement("span", { className: "rf-dr-picker__date-floating-label" }, "End Date"),
|
|
4036
|
+
/* @__PURE__ */ React73.createElement("div", { className: "rf-dr-picker__date-display" }, /* @__PURE__ */ React73.createElement(
|
|
3768
4037
|
"input",
|
|
3769
4038
|
{
|
|
3770
4039
|
type: "text",
|
|
@@ -3775,7 +4044,7 @@ var DateRangeField = ({
|
|
|
3775
4044
|
onBlur: handleEndInputBlur,
|
|
3776
4045
|
onMouseDown: (e) => e.stopPropagation()
|
|
3777
4046
|
}
|
|
3778
|
-
), /* @__PURE__ */
|
|
4047
|
+
), /* @__PURE__ */ React73.createElement(
|
|
3779
4048
|
"button",
|
|
3780
4049
|
{
|
|
3781
4050
|
type: "button",
|
|
@@ -3784,9 +4053,9 @@ var DateRangeField = ({
|
|
|
3784
4053
|
onClick: () => setInlineCal((v) => v === "end" ? null : "end"),
|
|
3785
4054
|
"aria-label": "Pick end date"
|
|
3786
4055
|
},
|
|
3787
|
-
/* @__PURE__ */
|
|
4056
|
+
/* @__PURE__ */ React73.createElement(CalendarIcon2, null)
|
|
3788
4057
|
))
|
|
3789
|
-
), inlineCal === "end" && /* @__PURE__ */
|
|
4058
|
+
), inlineCal === "end" && /* @__PURE__ */ React73.createElement(
|
|
3790
4059
|
MiniCalendar,
|
|
3791
4060
|
{
|
|
3792
4061
|
selectedDate: draftEnd,
|
|
@@ -3797,7 +4066,7 @@ var DateRangeField = ({
|
|
|
3797
4066
|
},
|
|
3798
4067
|
onClose: () => setInlineCal(null)
|
|
3799
4068
|
}
|
|
3800
|
-
)), !inlineCal && /* @__PURE__ */
|
|
4069
|
+
)), !inlineCal && /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-picker__days-section" }, /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-picker__days-row" }, /* @__PURE__ */ React73.createElement("span", { className: "rf-dr-picker__days-label" }, "Days until today"), /* @__PURE__ */ React73.createElement(
|
|
3801
4070
|
"input",
|
|
3802
4071
|
{
|
|
3803
4072
|
type: "number",
|
|
@@ -3808,7 +4077,7 @@ var DateRangeField = ({
|
|
|
3808
4077
|
onMouseDown: (e) => e.stopPropagation(),
|
|
3809
4078
|
placeholder: "\u2014"
|
|
3810
4079
|
}
|
|
3811
|
-
)), /* @__PURE__ */
|
|
4080
|
+
)), /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-picker__days-row" }, /* @__PURE__ */ React73.createElement("span", { className: "rf-dr-picker__days-label" }, "Days from today"), /* @__PURE__ */ React73.createElement(
|
|
3812
4081
|
"input",
|
|
3813
4082
|
{
|
|
3814
4083
|
type: "number",
|
|
@@ -3819,10 +4088,10 @@ var DateRangeField = ({
|
|
|
3819
4088
|
onMouseDown: (e) => e.stopPropagation(),
|
|
3820
4089
|
placeholder: "\u2014"
|
|
3821
4090
|
}
|
|
3822
|
-
))), /* @__PURE__ */
|
|
4091
|
+
))), /* @__PURE__ */ React73.createElement("div", { style: { flex: 1 } }), /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-picker__footer" }, /* @__PURE__ */ React73.createElement("button", { type: "button", className: "rf-dr-picker__close-btn", onClick: handleClose }, "CLOSE"), /* @__PURE__ */ React73.createElement("button", { type: "button", className: "rf-dr-picker__apply-btn", onClick: handleApply }, "APPLY"))))
|
|
3823
4092
|
) : (
|
|
3824
4093
|
/* ── Calendar Mode ── */
|
|
3825
|
-
/* @__PURE__ */
|
|
4094
|
+
/* @__PURE__ */ React73.createElement("div", { className: "rf-dr-picker rf-dr-picker--calendar", onMouseDown: (e) => e.preventDefault() }, /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-picker__calendars" }, /* @__PURE__ */ React73.createElement(
|
|
3826
4095
|
RangeCalendarBody,
|
|
3827
4096
|
{
|
|
3828
4097
|
viewYear: leftViewYear,
|
|
@@ -3837,7 +4106,7 @@ var DateRangeField = ({
|
|
|
3837
4106
|
onNext: nextMonth,
|
|
3838
4107
|
showNext: false
|
|
3839
4108
|
}
|
|
3840
|
-
), /* @__PURE__ */
|
|
4109
|
+
), /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-picker__cal-col-divider" }), /* @__PURE__ */ React73.createElement(
|
|
3841
4110
|
RangeCalendarBody,
|
|
3842
4111
|
{
|
|
3843
4112
|
viewYear: rightViewYear,
|
|
@@ -3852,19 +4121,19 @@ var DateRangeField = ({
|
|
|
3852
4121
|
onNext: nextMonth,
|
|
3853
4122
|
showPrev: false
|
|
3854
4123
|
}
|
|
3855
|
-
)), selecting === "end" && draftStart && /* @__PURE__ */
|
|
3856
|
-
))), helperText && /* @__PURE__ */
|
|
4124
|
+
)), selecting === "end" && draftStart && /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-picker__cal-hint" }, /* @__PURE__ */ React73.createElement("span", { className: "rf-dr-picker__cal-hint-dot" }), /* @__PURE__ */ React73.createElement("span", null, "Select end date \xB7 started from ", /* @__PURE__ */ React73.createElement("strong", null, formatShort(draftStart)))), /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-picker__divider" }), /* @__PURE__ */ React73.createElement("div", { className: "rf-dr-picker__cal-footer" }, draftStart && draftEnd && /* @__PURE__ */ React73.createElement("span", { className: "rf-dr-picker__cal-range-label" }, formatShort(draftStart <= draftEnd ? draftStart : draftEnd), " \u2013 ", formatShort(draftStart <= draftEnd ? draftEnd : draftStart), /* @__PURE__ */ React73.createElement("span", { className: "rf-dr-picker__cal-range-days" }, " ", "(", Math.abs(daysBetween(draftStart, draftEnd)) + 1, " days)")), /* @__PURE__ */ React73.createElement("div", { style: { flex: 1 } }), /* @__PURE__ */ React73.createElement("button", { type: "button", className: "rf-dr-picker__close-btn", onClick: handleClose }, "CLOSE"), /* @__PURE__ */ React73.createElement("button", { type: "button", className: "rf-dr-picker__apply-btn", onClick: handleApply }, "APPLY")))
|
|
4125
|
+
))), helperText && /* @__PURE__ */ React73.createElement("div", { className: "rf-text-field__helper-text" }, helperText));
|
|
3857
4126
|
};
|
|
3858
4127
|
DateRangeField.displayName = "DateRangeField";
|
|
3859
4128
|
|
|
3860
4129
|
// lib/Progress/RufousLogoLoader.tsx
|
|
3861
|
-
import * as
|
|
4130
|
+
import * as React74 from "react";
|
|
3862
4131
|
var _uid = 0;
|
|
3863
4132
|
var RufousLogoLoader = ({ size = 80, sx, className }) => {
|
|
3864
|
-
const clipId =
|
|
4133
|
+
const clipId = React74.useRef(`rll-${++_uid}`).current;
|
|
3865
4134
|
const height = size * (38.795 / 54.585);
|
|
3866
4135
|
const sxClass = useSx(sx);
|
|
3867
|
-
return /* @__PURE__ */
|
|
4136
|
+
return /* @__PURE__ */ React74.createElement("div", { className: ["rufous-logo-loader", sxClass, className].filter(Boolean).join(" "), style: { width: size, height } }, /* @__PURE__ */ React74.createElement(
|
|
3868
4137
|
"svg",
|
|
3869
4138
|
{
|
|
3870
4139
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3873,14 +4142,14 @@ var RufousLogoLoader = ({ size = 80, sx, className }) => {
|
|
|
3873
4142
|
height,
|
|
3874
4143
|
className: "rufous-logo-loader__svg"
|
|
3875
4144
|
},
|
|
3876
|
-
/* @__PURE__ */
|
|
4145
|
+
/* @__PURE__ */ React74.createElement("defs", null, /* @__PURE__ */ React74.createElement("clipPath", { id: clipId }, /* @__PURE__ */ React74.createElement(
|
|
3877
4146
|
"path",
|
|
3878
4147
|
{
|
|
3879
4148
|
transform: "translate(2208 18.205)",
|
|
3880
4149
|
d: "M.7,38.8a3.783,3.783,0,0,1-.5-.045l-.031,0A.26.26,0,0,1,0,38.564a.279.279,0,0,1,.14-.2c.222-.126.45-.251.671-.371l.047-.026c.357-.194.8-.435,1.209-.685.783-.479,1.565-.993,2.32-1.489l.033-.022.218-.143.49-.32c.575-.374,1.226-.8,1.824-1.241.98-.726,1.834-1.407,2.611-2.081a22.444,22.444,0,0,0,1.783-1.774A14.2,14.2,0,0,0,12.5,28.749l.012-.016a15.8,15.8,0,0,0,1.151-1.8,10.351,10.351,0,0,0,.586-1.511l0-.011.092-.278a4.425,4.425,0,0,0,.14-.583l.007-.036c.024-.119.048-.243.079-.363a4.639,4.639,0,0,0-.034-2.566c-.064-.212-.126-.43-.184-.636l-.008-.028c-.111-.391-.225-.8-.369-1.181a8.71,8.71,0,0,0-2.279-3.24,14.363,14.363,0,0,0-3.239-2.326c-.75-.4-1.553-.727-2.329-1.046L6.1,13.114l-.157-.065c-.294-.122-.6-.221-.9-.318l-.025-.008c-.19-.061-.427-.136-.649-.218-.108-.04-.265-.172-.252-.229a.7.7,0,0,1,.235-.4.915.915,0,0,1,.449-.112c.383-.029.77-.063,1.165-.1.969-.085,1.971-.174,2.962-.181h.119a13.145,13.145,0,0,1,2.907.315,11.888,11.888,0,0,1,3.128,1.123,10.286,10.286,0,0,1,2.3,1.554.92.92,0,0,1,.273.4,12.722,12.722,0,0,1,.458,3.3c-.009,1.494-.014,2.867-.014,4.2,0,.309.013.588.039.852a1.013,1.013,0,0,0,.078.26l0,.01c.027.067.051.129.077.207.029-.064.054-.116.076-.161l.009-.017.006-.012a.823.823,0,0,0,.076-.189c.051-.247.1-.494.164-.767.136-.618.276-1.257.359-1.9a24.362,24.362,0,0,0,0-6.777,13.01,13.01,0,0,0-.559-2.1c-.061-.185-.125-.382-.187-.579a9.42,9.42,0,0,0-.583-1.469c-.367-.727-.786-1.449-1.184-2.126a9.376,9.376,0,0,0-.643-.918c-.076-.1-.151-.2-.224-.3L15.548,6.3a8.128,8.128,0,0,0-.865-1.057,32.021,32.021,0,0,0-2.466-2.183,12.673,12.673,0,0,0-1.905-1.188c-.48-.256-1-.485-1.462-.687-.221-.1-.457-.2-.683-.306a.663.663,0,0,1-.11-.071L8.039.795c-.027-.02-.058-.043-.1-.069L8.062.667,8.108.644a1.786,1.786,0,0,1,.27-.12A11.679,11.679,0,0,1,11.866,0a13.332,13.332,0,0,1,1.769.121A13.927,13.927,0,0,1,15.9.693l.471.147a10.775,10.775,0,0,1,1.656.658,9.622,9.622,0,0,1,1.768,1.041,32.024,32.024,0,0,1,3.092,2.717,25.62,25.62,0,0,1,2.245,2.829l.084.117c.617.86,1.171,1.777,1.678,2.641.255.435.484.9.687,1.3.14.281.285.572.436.854.262.491.534.977.835,1.516l.005.01q.169.3.337.6c.064.116.13.232.2.347l.027.047c.12.212.244.431.357.651a8.518,8.518,0,0,0,2.121,2.695c.065.024.137.054.212.086l.013.006a1.268,1.268,0,0,0,.376.123.087.087,0,0,0,.063-.02.209.209,0,0,0,.083-.151c0-.083-.08-.153-.157-.22a.694.694,0,0,1-.135-.142c-.134-.216-.273-.436-.407-.649l-.063-.1c-.373-.587-.8-1.251-1.157-1.923s-.666-1.373-.964-2.057l0-.008q-.123-.284-.247-.564a1.707,1.707,0,0,1,.239-1.554l.026-.046.005-.009A12.918,12.918,0,0,1,31.408,9.3,7.814,7.814,0,0,1,33.75,7.612a5.391,5.391,0,0,1,2.218-.444,11.369,11.369,0,0,1,1.882.186,9.211,9.211,0,0,1,2.845,1.022c.138.071.261.135.373.188a4.155,4.155,0,0,0,1.849.464h.093c1.993-.052,4-.14,5.95-.224l.846-.036c.9-.038,1.808-.066,2.682-.093L52.7,8.67l1.007-.031h.041a1.787,1.787,0,0,1,.73.163c.1.051.109.256.109.318,0,.081-.147.169-.257.175-.466.028-.994.043-1.485.043a37.855,37.855,0,0,0-6.3.577A9.221,9.221,0,0,0,42.7,11.3a7.884,7.884,0,0,0-1.565,1.5c-.593.743-1.116,1.545-1.621,2.321l-.121.185c-.228.35-.435.709-.662,1.109l-.041.071c-.136.236-.276.481-.42.717l-.007.012c-.349.572-.709,1.162-1.1,1.716l-.216.307-.01.014a21.585,21.585,0,0,1-1.451,1.907c-1.317,1.485-2.538,2.8-3.734,4.006a30.822,30.822,0,0,1-2.5,2.207c-.548.446-1.139.86-1.71,1.26l-.01.007q-.254.177-.5.355c-.536.379-1.109.78-1.7,1.157-.545.35-1.143.71-1.828,1.1-.842.483-1.586.9-2.275,1.26-.271.144-.553.272-.868.412-.13.058-.3.135-.467.213a6.838,6.838,0,0,1-1.18.3,5.079,5.079,0,0,1,.647-.771l.008-.008c.132-.136.251-.26.365-.393l.048-.056c.566-.667,1.151-1.357,1.7-2.059s1.126-1.439,1.649-2.2c.4-.579.749-1.2,1.134-1.888l.016-.028c.406-.734.826-1.493,1.181-2.266.274-.6.733-1.787.866-2.189l.023-.07c.13-.389.215-.646-.013-.916a.369.369,0,0,1-.041.031l0,0c-.028.021-.055.041-.058.065a2.307,2.307,0,0,1-.146.5,5.257,5.257,0,0,1-.374.709c-.281.468-.536.959-.782,1.434-.2.385-.379.731-.57,1.069a20.042,20.042,0,0,1-1.161,1.871,30.689,30.689,0,0,1-1.985,2.531c-.74.821-1.567,1.648-2.6,2.6a21.448,21.448,0,0,1-2.1,1.669c-.85.606-1.754,1.2-2.688,1.768a17.867,17.867,0,0,1-1.993,1.037c-.994.445-2.066.891-3.185,1.324a12.127,12.127,0,0,1-1.714.514c-.955.213-1.969.413-3.1.611-1.023.18-2.054.328-2.927.449A1.41,1.41,0,0,1,.7,38.8ZM37.945,10.58l-.007,0a.583.583,0,0,0-.223.048.677.677,0,0,0-.437.555.637.637,0,0,0,.426.527.621.621,0,0,0,.209.046h.016a.72.72,0,0,0,.464-.194.676.676,0,0,0,.194-.282l0-.011,0-.005,0-.006,0-.009a.415.415,0,0,0,.014-.109.734.734,0,0,0-.657-.56Z"
|
|
3881
4150
|
}
|
|
3882
4151
|
))),
|
|
3883
|
-
/* @__PURE__ */
|
|
4152
|
+
/* @__PURE__ */ React74.createElement("g", { transform: "translate(-123.275 -24)" }, /* @__PURE__ */ React74.createElement("g", { transform: "translate(-2084.725 5.795)", clipPath: `url(#${clipId})` }, /* @__PURE__ */ React74.createElement("rect", { className: "rufous-ls rufous-ls-1", width: "40", height: "6", transform: "translate(2208 58) rotate(-90)", fill: "#d07f6f" }), /* @__PURE__ */ React74.createElement("rect", { className: "rufous-ls rufous-ls-2", width: "40", height: "6", transform: "translate(2214 58) rotate(-90)", fill: "#c66958" }), /* @__PURE__ */ React74.createElement("rect", { className: "rufous-ls rufous-ls-3", width: "40", height: "7", transform: "translate(2220 58) rotate(-90)", fill: "#bb5341" }), /* @__PURE__ */ React74.createElement("rect", { className: "rufous-ls rufous-ls-4", width: "40", height: "6", transform: "translate(2227 58) rotate(-90)", fill: "#b03a28" }), /* @__PURE__ */ React74.createElement("rect", { className: "rufous-ls rufous-ls-5", width: "40", height: "6", transform: "translate(2233 58) rotate(-90)", fill: "#a41b06" }), /* @__PURE__ */ React74.createElement("rect", { className: "rufous-ls rufous-ls-6", width: "40", height: "6", transform: "translate(2239 58) rotate(-90)", fill: "#8e1604" }), /* @__PURE__ */ React74.createElement("rect", { className: "rufous-ls rufous-ls-7", width: "40", height: "6", transform: "translate(2245 58) rotate(-90)", fill: "#791103" }), /* @__PURE__ */ React74.createElement("rect", { className: "rufous-ls rufous-ls-8", width: "40", height: "5", transform: "translate(2251 58) rotate(-90)", fill: "#640c02" }), /* @__PURE__ */ React74.createElement("rect", { className: "rufous-ls rufous-ls-9", width: "40", height: "7", transform: "translate(2256 58) rotate(-90)", fill: "#500801" })))
|
|
3884
4153
|
));
|
|
3885
4154
|
};
|
|
3886
4155
|
|
|
@@ -3904,238 +4173,6 @@ import {
|
|
|
3904
4173
|
Trash2,
|
|
3905
4174
|
Plus
|
|
3906
4175
|
} from "lucide-react";
|
|
3907
|
-
|
|
3908
|
-
// lib/Tooltip/Tooltip.tsx
|
|
3909
|
-
import React74, {
|
|
3910
|
-
useCallback as useCallback3,
|
|
3911
|
-
useEffect as useEffect8,
|
|
3912
|
-
useRef as useRef8,
|
|
3913
|
-
useState as useState8
|
|
3914
|
-
} from "react";
|
|
3915
|
-
import ReactDOM3 from "react-dom";
|
|
3916
|
-
var GAP = 8;
|
|
3917
|
-
function computePosition(anchor, tooltip, placement) {
|
|
3918
|
-
const { top: aTop, left: aLeft, width: aW, height: aH } = anchor;
|
|
3919
|
-
const { width: tW, height: tH } = tooltip;
|
|
3920
|
-
let top = 0;
|
|
3921
|
-
let left = 0;
|
|
3922
|
-
let arrowLeft;
|
|
3923
|
-
let arrowTop;
|
|
3924
|
-
switch (placement) {
|
|
3925
|
-
case "top":
|
|
3926
|
-
top = aTop - tH - GAP;
|
|
3927
|
-
left = aLeft + aW / 2 - tW / 2;
|
|
3928
|
-
arrowLeft = tW / 2 - 4;
|
|
3929
|
-
break;
|
|
3930
|
-
case "top-start":
|
|
3931
|
-
top = aTop - tH - GAP;
|
|
3932
|
-
left = aLeft;
|
|
3933
|
-
arrowLeft = Math.min(aW / 2, tW - 16);
|
|
3934
|
-
break;
|
|
3935
|
-
case "top-end":
|
|
3936
|
-
top = aTop - tH - GAP;
|
|
3937
|
-
left = aLeft + aW - tW;
|
|
3938
|
-
arrowLeft = Math.max(tW - aW / 2 - 4, 8);
|
|
3939
|
-
break;
|
|
3940
|
-
case "bottom":
|
|
3941
|
-
top = aTop + aH + GAP;
|
|
3942
|
-
left = aLeft + aW / 2 - tW / 2;
|
|
3943
|
-
arrowLeft = tW / 2 - 4;
|
|
3944
|
-
break;
|
|
3945
|
-
case "bottom-start":
|
|
3946
|
-
top = aTop + aH + GAP;
|
|
3947
|
-
left = aLeft;
|
|
3948
|
-
arrowLeft = Math.min(aW / 2, tW - 16);
|
|
3949
|
-
break;
|
|
3950
|
-
case "bottom-end":
|
|
3951
|
-
top = aTop + aH + GAP;
|
|
3952
|
-
left = aLeft + aW - tW;
|
|
3953
|
-
arrowLeft = Math.max(tW - aW / 2 - 4, 8);
|
|
3954
|
-
break;
|
|
3955
|
-
case "left":
|
|
3956
|
-
top = aTop + aH / 2 - tH / 2;
|
|
3957
|
-
left = aLeft - tW - GAP;
|
|
3958
|
-
arrowTop = tH / 2 - 4;
|
|
3959
|
-
break;
|
|
3960
|
-
case "left-start":
|
|
3961
|
-
top = aTop;
|
|
3962
|
-
left = aLeft - tW - GAP;
|
|
3963
|
-
arrowTop = Math.min(aH / 2, tH - 16);
|
|
3964
|
-
break;
|
|
3965
|
-
case "left-end":
|
|
3966
|
-
top = aTop + aH - tH;
|
|
3967
|
-
left = aLeft - tW - GAP;
|
|
3968
|
-
arrowTop = Math.max(tH - aH / 2 - 4, 8);
|
|
3969
|
-
break;
|
|
3970
|
-
case "right":
|
|
3971
|
-
top = aTop + aH / 2 - tH / 2;
|
|
3972
|
-
left = aLeft + aW + GAP;
|
|
3973
|
-
arrowTop = tH / 2 - 4;
|
|
3974
|
-
break;
|
|
3975
|
-
case "right-start":
|
|
3976
|
-
top = aTop;
|
|
3977
|
-
left = aLeft + aW + GAP;
|
|
3978
|
-
arrowTop = Math.min(aH / 2, tH - 16);
|
|
3979
|
-
break;
|
|
3980
|
-
case "right-end":
|
|
3981
|
-
top = aTop + aH - tH;
|
|
3982
|
-
left = aLeft + aW + GAP;
|
|
3983
|
-
arrowTop = Math.max(tH - aH / 2 - 4, 8);
|
|
3984
|
-
break;
|
|
3985
|
-
default:
|
|
3986
|
-
top = aTop - tH - GAP;
|
|
3987
|
-
left = aLeft + aW / 2 - tW / 2;
|
|
3988
|
-
}
|
|
3989
|
-
const vw = window.innerWidth;
|
|
3990
|
-
const vh = window.innerHeight;
|
|
3991
|
-
left = Math.max(8, Math.min(left, vw - tW - 8));
|
|
3992
|
-
top = Math.max(8, Math.min(top, vh - tH - 8));
|
|
3993
|
-
return { top, left, arrowLeft, arrowTop };
|
|
3994
|
-
}
|
|
3995
|
-
var Tooltip = ({
|
|
3996
|
-
title,
|
|
3997
|
-
placement = "top",
|
|
3998
|
-
arrow = false,
|
|
3999
|
-
open: controlledOpen,
|
|
4000
|
-
disableHoverListener = false,
|
|
4001
|
-
disableFocusListener = false,
|
|
4002
|
-
enterDelay = 100,
|
|
4003
|
-
leaveDelay = 0,
|
|
4004
|
-
children,
|
|
4005
|
-
followCursor = false,
|
|
4006
|
-
className = "",
|
|
4007
|
-
style,
|
|
4008
|
-
sx
|
|
4009
|
-
}) => {
|
|
4010
|
-
const sxClass = useSx(sx);
|
|
4011
|
-
const [internalOpen, setInternalOpen] = useState8(false);
|
|
4012
|
-
const [position, setPosition] = useState8({ top: 0, left: 0 });
|
|
4013
|
-
const anchorRef = useRef8(null);
|
|
4014
|
-
const tooltipRef = useRef8(null);
|
|
4015
|
-
const enterTimer = useRef8(null);
|
|
4016
|
-
const leaveTimer = useRef8(null);
|
|
4017
|
-
const cursorPos = useRef8({ x: 0, y: 0 });
|
|
4018
|
-
const isOpen = controlledOpen !== void 0 ? controlledOpen : internalOpen;
|
|
4019
|
-
const clearTimers = useCallback3(() => {
|
|
4020
|
-
if (enterTimer.current) clearTimeout(enterTimer.current);
|
|
4021
|
-
if (leaveTimer.current) clearTimeout(leaveTimer.current);
|
|
4022
|
-
}, []);
|
|
4023
|
-
const updatePosition = useCallback3(() => {
|
|
4024
|
-
if (!anchorRef.current || !tooltipRef.current) return;
|
|
4025
|
-
const anchorRect = anchorRef.current.getBoundingClientRect();
|
|
4026
|
-
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
4027
|
-
if (followCursor) {
|
|
4028
|
-
const fakeRect = {
|
|
4029
|
-
top: cursorPos.current.y,
|
|
4030
|
-
left: cursorPos.current.x,
|
|
4031
|
-
right: cursorPos.current.x,
|
|
4032
|
-
bottom: cursorPos.current.y,
|
|
4033
|
-
width: 0,
|
|
4034
|
-
height: 0,
|
|
4035
|
-
x: cursorPos.current.x,
|
|
4036
|
-
y: cursorPos.current.y,
|
|
4037
|
-
toJSON: () => ({})
|
|
4038
|
-
};
|
|
4039
|
-
setPosition(computePosition(fakeRect, tooltipRect, placement));
|
|
4040
|
-
} else {
|
|
4041
|
-
setPosition(computePosition(anchorRect, tooltipRect, placement));
|
|
4042
|
-
}
|
|
4043
|
-
}, [placement, followCursor]);
|
|
4044
|
-
useEffect8(() => {
|
|
4045
|
-
if (isOpen) {
|
|
4046
|
-
requestAnimationFrame(() => {
|
|
4047
|
-
updatePosition();
|
|
4048
|
-
});
|
|
4049
|
-
}
|
|
4050
|
-
}, [isOpen, updatePosition]);
|
|
4051
|
-
const handleOpen = useCallback3(() => {
|
|
4052
|
-
clearTimers();
|
|
4053
|
-
if (enterDelay > 0) {
|
|
4054
|
-
enterTimer.current = setTimeout(() => {
|
|
4055
|
-
setInternalOpen(true);
|
|
4056
|
-
}, enterDelay);
|
|
4057
|
-
} else {
|
|
4058
|
-
setInternalOpen(true);
|
|
4059
|
-
}
|
|
4060
|
-
}, [enterDelay, clearTimers]);
|
|
4061
|
-
const handleClose = useCallback3(() => {
|
|
4062
|
-
clearTimers();
|
|
4063
|
-
if (leaveDelay > 0) {
|
|
4064
|
-
leaveTimer.current = setTimeout(() => {
|
|
4065
|
-
setInternalOpen(false);
|
|
4066
|
-
}, leaveDelay);
|
|
4067
|
-
} else {
|
|
4068
|
-
setInternalOpen(false);
|
|
4069
|
-
}
|
|
4070
|
-
}, [leaveDelay, clearTimers]);
|
|
4071
|
-
const handleMouseMove = useCallback3(
|
|
4072
|
-
(e) => {
|
|
4073
|
-
cursorPos.current = { x: e.clientX, y: e.clientY };
|
|
4074
|
-
if (isOpen && followCursor) {
|
|
4075
|
-
updatePosition();
|
|
4076
|
-
}
|
|
4077
|
-
},
|
|
4078
|
-
[isOpen, followCursor, updatePosition]
|
|
4079
|
-
);
|
|
4080
|
-
useEffect8(() => {
|
|
4081
|
-
return () => clearTimers();
|
|
4082
|
-
}, [clearTimers]);
|
|
4083
|
-
const childProps = {};
|
|
4084
|
-
if (!disableHoverListener) {
|
|
4085
|
-
childProps.onMouseEnter = handleOpen;
|
|
4086
|
-
childProps.onMouseLeave = handleClose;
|
|
4087
|
-
childProps.onMouseMove = followCursor ? handleMouseMove : void 0;
|
|
4088
|
-
}
|
|
4089
|
-
if (!disableFocusListener) {
|
|
4090
|
-
childProps.onFocus = handleOpen;
|
|
4091
|
-
childProps.onBlur = handleClose;
|
|
4092
|
-
}
|
|
4093
|
-
const tooltipClasses = [
|
|
4094
|
-
"rf-tooltip",
|
|
4095
|
-
`rf-tooltip--placement-${placement}`,
|
|
4096
|
-
isOpen ? "rf-tooltip--visible" : "",
|
|
4097
|
-
sxClass,
|
|
4098
|
-
className
|
|
4099
|
-
].filter(Boolean).join(" ");
|
|
4100
|
-
const tooltipElement = /* @__PURE__ */ React74.createElement(
|
|
4101
|
-
"div",
|
|
4102
|
-
{
|
|
4103
|
-
ref: tooltipRef,
|
|
4104
|
-
className: tooltipClasses,
|
|
4105
|
-
style: {
|
|
4106
|
-
top: position.top,
|
|
4107
|
-
left: position.left,
|
|
4108
|
-
...style
|
|
4109
|
-
},
|
|
4110
|
-
role: "tooltip",
|
|
4111
|
-
"aria-hidden": !isOpen
|
|
4112
|
-
},
|
|
4113
|
-
title,
|
|
4114
|
-
arrow && /* @__PURE__ */ React74.createElement(
|
|
4115
|
-
"span",
|
|
4116
|
-
{
|
|
4117
|
-
className: "rf-tooltip__arrow",
|
|
4118
|
-
style: {
|
|
4119
|
-
...position.arrowLeft !== void 0 ? { left: position.arrowLeft } : {},
|
|
4120
|
-
...position.arrowTop !== void 0 ? { top: position.arrowTop } : {}
|
|
4121
|
-
}
|
|
4122
|
-
}
|
|
4123
|
-
)
|
|
4124
|
-
);
|
|
4125
|
-
return /* @__PURE__ */ React74.createElement(React74.Fragment, null, /* @__PURE__ */ React74.createElement(
|
|
4126
|
-
"span",
|
|
4127
|
-
{
|
|
4128
|
-
ref: anchorRef,
|
|
4129
|
-
style: { display: "inline-flex", position: "relative" },
|
|
4130
|
-
"aria-describedby": isOpen ? "rf-tooltip" : void 0,
|
|
4131
|
-
...childProps
|
|
4132
|
-
},
|
|
4133
|
-
React74.cloneElement(children)
|
|
4134
|
-
), ReactDOM3.createPortal(tooltipElement, document.body));
|
|
4135
|
-
};
|
|
4136
|
-
Tooltip.displayName = "Tooltip";
|
|
4137
|
-
|
|
4138
|
-
// lib/DataGrid/DataGrid.tsx
|
|
4139
4176
|
var getOperatorsForType = (type) => {
|
|
4140
4177
|
if (type === "date") return [
|
|
4141
4178
|
{ value: "is", label: "is" },
|