@rufous/ui 0.2.92 → 0.2.94
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 +432 -411
- package/dist/main.js +445 -424
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -1908,16 +1908,243 @@ var TextField = (0, import_react17.forwardRef)(({
|
|
|
1908
1908
|
TextField.displayName = "TextField";
|
|
1909
1909
|
|
|
1910
1910
|
// lib/TextFields/AddressLookup.tsx
|
|
1911
|
-
var
|
|
1911
|
+
var import_react20 = __toESM(require("react"), 1);
|
|
1912
1912
|
var import_axios = __toESM(require("axios"), 1);
|
|
1913
1913
|
var import_country_state_city = require("country-state-city");
|
|
1914
1914
|
|
|
1915
1915
|
// lib/TextFields/Autocomplete.tsx
|
|
1916
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
1917
|
+
var import_react_dom3 = __toESM(require("react-dom"), 1);
|
|
1918
|
+
|
|
1919
|
+
// lib/Tooltip/Tooltip.tsx
|
|
1916
1920
|
var import_react18 = __toESM(require("react"), 1);
|
|
1917
1921
|
var import_react_dom2 = __toESM(require("react-dom"), 1);
|
|
1918
|
-
var
|
|
1919
|
-
|
|
1920
|
-
|
|
1922
|
+
var GAP = 8;
|
|
1923
|
+
function computePosition(anchor, tooltip, placement) {
|
|
1924
|
+
const { top: aTop, left: aLeft, width: aW, height: aH } = anchor;
|
|
1925
|
+
const { width: tW, height: tH } = tooltip;
|
|
1926
|
+
let top = 0;
|
|
1927
|
+
let left = 0;
|
|
1928
|
+
let arrowLeft;
|
|
1929
|
+
let arrowTop;
|
|
1930
|
+
switch (placement) {
|
|
1931
|
+
case "top":
|
|
1932
|
+
top = aTop - tH - GAP;
|
|
1933
|
+
left = aLeft + aW / 2 - tW / 2;
|
|
1934
|
+
arrowLeft = tW / 2 - 4;
|
|
1935
|
+
break;
|
|
1936
|
+
case "top-start":
|
|
1937
|
+
top = aTop - tH - GAP;
|
|
1938
|
+
left = aLeft;
|
|
1939
|
+
arrowLeft = Math.min(aW / 2, tW - 16);
|
|
1940
|
+
break;
|
|
1941
|
+
case "top-end":
|
|
1942
|
+
top = aTop - tH - GAP;
|
|
1943
|
+
left = aLeft + aW - tW;
|
|
1944
|
+
arrowLeft = Math.max(tW - aW / 2 - 4, 8);
|
|
1945
|
+
break;
|
|
1946
|
+
case "bottom":
|
|
1947
|
+
top = aTop + aH + GAP;
|
|
1948
|
+
left = aLeft + aW / 2 - tW / 2;
|
|
1949
|
+
arrowLeft = tW / 2 - 4;
|
|
1950
|
+
break;
|
|
1951
|
+
case "bottom-start":
|
|
1952
|
+
top = aTop + aH + GAP;
|
|
1953
|
+
left = aLeft;
|
|
1954
|
+
arrowLeft = Math.min(aW / 2, tW - 16);
|
|
1955
|
+
break;
|
|
1956
|
+
case "bottom-end":
|
|
1957
|
+
top = aTop + aH + GAP;
|
|
1958
|
+
left = aLeft + aW - tW;
|
|
1959
|
+
arrowLeft = Math.max(tW - aW / 2 - 4, 8);
|
|
1960
|
+
break;
|
|
1961
|
+
case "left":
|
|
1962
|
+
top = aTop + aH / 2 - tH / 2;
|
|
1963
|
+
left = aLeft - tW - GAP;
|
|
1964
|
+
arrowTop = tH / 2 - 4;
|
|
1965
|
+
break;
|
|
1966
|
+
case "left-start":
|
|
1967
|
+
top = aTop;
|
|
1968
|
+
left = aLeft - tW - GAP;
|
|
1969
|
+
arrowTop = Math.min(aH / 2, tH - 16);
|
|
1970
|
+
break;
|
|
1971
|
+
case "left-end":
|
|
1972
|
+
top = aTop + aH - tH;
|
|
1973
|
+
left = aLeft - tW - GAP;
|
|
1974
|
+
arrowTop = Math.max(tH - aH / 2 - 4, 8);
|
|
1975
|
+
break;
|
|
1976
|
+
case "right":
|
|
1977
|
+
top = aTop + aH / 2 - tH / 2;
|
|
1978
|
+
left = aLeft + aW + GAP;
|
|
1979
|
+
arrowTop = tH / 2 - 4;
|
|
1980
|
+
break;
|
|
1981
|
+
case "right-start":
|
|
1982
|
+
top = aTop;
|
|
1983
|
+
left = aLeft + aW + GAP;
|
|
1984
|
+
arrowTop = Math.min(aH / 2, tH - 16);
|
|
1985
|
+
break;
|
|
1986
|
+
case "right-end":
|
|
1987
|
+
top = aTop + aH - tH;
|
|
1988
|
+
left = aLeft + aW + GAP;
|
|
1989
|
+
arrowTop = Math.max(tH - aH / 2 - 4, 8);
|
|
1990
|
+
break;
|
|
1991
|
+
default:
|
|
1992
|
+
top = aTop - tH - GAP;
|
|
1993
|
+
left = aLeft + aW / 2 - tW / 2;
|
|
1994
|
+
}
|
|
1995
|
+
const vw = window.innerWidth;
|
|
1996
|
+
const vh = window.innerHeight;
|
|
1997
|
+
left = Math.max(8, Math.min(left, vw - tW - 8));
|
|
1998
|
+
top = Math.max(8, Math.min(top, vh - tH - 8));
|
|
1999
|
+
return { top, left, arrowLeft, arrowTop };
|
|
2000
|
+
}
|
|
2001
|
+
var Tooltip = ({
|
|
2002
|
+
title,
|
|
2003
|
+
placement = "top",
|
|
2004
|
+
arrow = false,
|
|
2005
|
+
open: controlledOpen,
|
|
2006
|
+
disableHoverListener = false,
|
|
2007
|
+
disableFocusListener = false,
|
|
2008
|
+
enterDelay = 100,
|
|
2009
|
+
leaveDelay = 0,
|
|
2010
|
+
children,
|
|
2011
|
+
followCursor = false,
|
|
2012
|
+
className = "",
|
|
2013
|
+
style,
|
|
2014
|
+
sx
|
|
2015
|
+
}) => {
|
|
2016
|
+
const sxClass = useSx(sx);
|
|
2017
|
+
const [internalOpen, setInternalOpen] = (0, import_react18.useState)(false);
|
|
2018
|
+
const [position, setPosition] = (0, import_react18.useState)({ top: 0, left: 0 });
|
|
2019
|
+
const anchorRef = (0, import_react18.useRef)(null);
|
|
2020
|
+
const tooltipRef = (0, import_react18.useRef)(null);
|
|
2021
|
+
const enterTimer = (0, import_react18.useRef)(null);
|
|
2022
|
+
const leaveTimer = (0, import_react18.useRef)(null);
|
|
2023
|
+
const cursorPos = (0, import_react18.useRef)({ x: 0, y: 0 });
|
|
2024
|
+
const isOpen = controlledOpen !== void 0 ? controlledOpen : internalOpen;
|
|
2025
|
+
const clearTimers = (0, import_react18.useCallback)(() => {
|
|
2026
|
+
if (enterTimer.current) clearTimeout(enterTimer.current);
|
|
2027
|
+
if (leaveTimer.current) clearTimeout(leaveTimer.current);
|
|
2028
|
+
}, []);
|
|
2029
|
+
const updatePosition = (0, import_react18.useCallback)(() => {
|
|
2030
|
+
if (!anchorRef.current || !tooltipRef.current) return;
|
|
2031
|
+
const anchorRect = anchorRef.current.getBoundingClientRect();
|
|
2032
|
+
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
2033
|
+
if (followCursor) {
|
|
2034
|
+
const fakeRect = {
|
|
2035
|
+
top: cursorPos.current.y,
|
|
2036
|
+
left: cursorPos.current.x,
|
|
2037
|
+
right: cursorPos.current.x,
|
|
2038
|
+
bottom: cursorPos.current.y,
|
|
2039
|
+
width: 0,
|
|
2040
|
+
height: 0,
|
|
2041
|
+
x: cursorPos.current.x,
|
|
2042
|
+
y: cursorPos.current.y,
|
|
2043
|
+
toJSON: () => ({})
|
|
2044
|
+
};
|
|
2045
|
+
setPosition(computePosition(fakeRect, tooltipRect, placement));
|
|
2046
|
+
} else {
|
|
2047
|
+
setPosition(computePosition(anchorRect, tooltipRect, placement));
|
|
2048
|
+
}
|
|
2049
|
+
}, [placement, followCursor]);
|
|
2050
|
+
(0, import_react18.useEffect)(() => {
|
|
2051
|
+
if (isOpen) {
|
|
2052
|
+
requestAnimationFrame(() => {
|
|
2053
|
+
updatePosition();
|
|
2054
|
+
});
|
|
2055
|
+
}
|
|
2056
|
+
}, [isOpen, updatePosition]);
|
|
2057
|
+
const handleOpen = (0, import_react18.useCallback)(() => {
|
|
2058
|
+
clearTimers();
|
|
2059
|
+
if (enterDelay > 0) {
|
|
2060
|
+
enterTimer.current = setTimeout(() => {
|
|
2061
|
+
setInternalOpen(true);
|
|
2062
|
+
}, enterDelay);
|
|
2063
|
+
} else {
|
|
2064
|
+
setInternalOpen(true);
|
|
2065
|
+
}
|
|
2066
|
+
}, [enterDelay, clearTimers]);
|
|
2067
|
+
const handleClose = (0, import_react18.useCallback)(() => {
|
|
2068
|
+
clearTimers();
|
|
2069
|
+
if (leaveDelay > 0) {
|
|
2070
|
+
leaveTimer.current = setTimeout(() => {
|
|
2071
|
+
setInternalOpen(false);
|
|
2072
|
+
}, leaveDelay);
|
|
2073
|
+
} else {
|
|
2074
|
+
setInternalOpen(false);
|
|
2075
|
+
}
|
|
2076
|
+
}, [leaveDelay, clearTimers]);
|
|
2077
|
+
const handleMouseMove = (0, import_react18.useCallback)(
|
|
2078
|
+
(e) => {
|
|
2079
|
+
cursorPos.current = { x: e.clientX, y: e.clientY };
|
|
2080
|
+
if (isOpen && followCursor) {
|
|
2081
|
+
updatePosition();
|
|
2082
|
+
}
|
|
2083
|
+
},
|
|
2084
|
+
[isOpen, followCursor, updatePosition]
|
|
2085
|
+
);
|
|
2086
|
+
(0, import_react18.useEffect)(() => {
|
|
2087
|
+
return () => clearTimers();
|
|
2088
|
+
}, [clearTimers]);
|
|
2089
|
+
const childProps = {};
|
|
2090
|
+
if (!disableHoverListener) {
|
|
2091
|
+
childProps.onMouseEnter = handleOpen;
|
|
2092
|
+
childProps.onMouseLeave = handleClose;
|
|
2093
|
+
childProps.onMouseMove = followCursor ? handleMouseMove : void 0;
|
|
2094
|
+
}
|
|
2095
|
+
if (!disableFocusListener) {
|
|
2096
|
+
childProps.onFocus = handleOpen;
|
|
2097
|
+
childProps.onBlur = handleClose;
|
|
2098
|
+
}
|
|
2099
|
+
const tooltipClasses = [
|
|
2100
|
+
"rf-tooltip",
|
|
2101
|
+
`rf-tooltip--placement-${placement}`,
|
|
2102
|
+
isOpen ? "rf-tooltip--visible" : "",
|
|
2103
|
+
sxClass,
|
|
2104
|
+
className
|
|
2105
|
+
].filter(Boolean).join(" ");
|
|
2106
|
+
const tooltipElement = /* @__PURE__ */ import_react18.default.createElement(
|
|
2107
|
+
"div",
|
|
2108
|
+
{
|
|
2109
|
+
ref: tooltipRef,
|
|
2110
|
+
className: tooltipClasses,
|
|
2111
|
+
style: {
|
|
2112
|
+
top: position.top,
|
|
2113
|
+
left: position.left,
|
|
2114
|
+
...style
|
|
2115
|
+
},
|
|
2116
|
+
role: "tooltip",
|
|
2117
|
+
"aria-hidden": !isOpen
|
|
2118
|
+
},
|
|
2119
|
+
title,
|
|
2120
|
+
arrow && /* @__PURE__ */ import_react18.default.createElement(
|
|
2121
|
+
"span",
|
|
2122
|
+
{
|
|
2123
|
+
className: "rf-tooltip__arrow",
|
|
2124
|
+
style: {
|
|
2125
|
+
...position.arrowLeft !== void 0 ? { left: position.arrowLeft } : {},
|
|
2126
|
+
...position.arrowTop !== void 0 ? { top: position.arrowTop } : {}
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
)
|
|
2130
|
+
);
|
|
2131
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_react18.default.Fragment, null, /* @__PURE__ */ import_react18.default.createElement(
|
|
2132
|
+
"span",
|
|
2133
|
+
{
|
|
2134
|
+
ref: anchorRef,
|
|
2135
|
+
style: { display: "inline-flex", position: "relative" },
|
|
2136
|
+
"aria-describedby": isOpen ? "rf-tooltip" : void 0,
|
|
2137
|
+
...childProps
|
|
2138
|
+
},
|
|
2139
|
+
import_react18.default.cloneElement(children)
|
|
2140
|
+
), import_react_dom2.default.createPortal(tooltipElement, document.body));
|
|
2141
|
+
};
|
|
2142
|
+
Tooltip.displayName = "Tooltip";
|
|
2143
|
+
|
|
2144
|
+
// lib/TextFields/Autocomplete.tsx
|
|
2145
|
+
var ChevronDownIcon = () => /* @__PURE__ */ import_react19.default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ import_react19.default.createElement("polyline", { points: "6 9 12 15 18 9" }));
|
|
2146
|
+
var CloseSmIcon = ({ size = 16 }) => /* @__PURE__ */ import_react19.default.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }, /* @__PURE__ */ import_react19.default.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ import_react19.default.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" }));
|
|
2147
|
+
var CheckIcon = () => /* @__PURE__ */ import_react19.default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ import_react19.default.createElement("polyline", { points: "20 6 9 17 4 12" }));
|
|
1921
2148
|
function defaultGetLabel(option) {
|
|
1922
2149
|
if (option === null || option === void 0) return "";
|
|
1923
2150
|
if (typeof option === "string") return option;
|
|
@@ -1927,11 +2154,19 @@ function defaultGetLabel(option) {
|
|
|
1927
2154
|
}
|
|
1928
2155
|
function defaultIsEqual(a, b) {
|
|
1929
2156
|
if (a === b) return true;
|
|
1930
|
-
if (a
|
|
2157
|
+
if (a == null || b == null) return false;
|
|
2158
|
+
const aIsObj = typeof a === "object";
|
|
2159
|
+
const bIsObj = typeof b === "object";
|
|
2160
|
+
if (aIsObj && bIsObj) {
|
|
1931
2161
|
const aVal = a.value;
|
|
1932
2162
|
const bVal = b.value;
|
|
1933
2163
|
if (aVal !== void 0 && bVal !== void 0) return aVal === bVal;
|
|
2164
|
+
const aId = a.id;
|
|
2165
|
+
const bId = b.id;
|
|
2166
|
+
if (aId !== void 0 && bId !== void 0) return aId === bId;
|
|
1934
2167
|
}
|
|
2168
|
+
if (aIsObj && !bIsObj) return a.value === b;
|
|
2169
|
+
if (!aIsObj && bIsObj) return a === b.value;
|
|
1935
2170
|
return false;
|
|
1936
2171
|
}
|
|
1937
2172
|
function defaultFilter(options, inputValue, getLabel) {
|
|
@@ -1974,17 +2209,18 @@ function AutocompleteInner(props, _ref) {
|
|
|
1974
2209
|
onOpen,
|
|
1975
2210
|
onClose
|
|
1976
2211
|
} = props;
|
|
1977
|
-
const [open, setOpen] = (0,
|
|
1978
|
-
const [inputStr, setInputStr] = (0,
|
|
1979
|
-
const [
|
|
1980
|
-
const [
|
|
1981
|
-
const
|
|
1982
|
-
const
|
|
1983
|
-
const
|
|
1984
|
-
const
|
|
1985
|
-
const
|
|
2212
|
+
const [open, setOpen] = (0, import_react19.useState)(false);
|
|
2213
|
+
const [inputStr, setInputStr] = (0, import_react19.useState)("");
|
|
2214
|
+
const [filterQuery, setFilterQuery] = (0, import_react19.useState)("");
|
|
2215
|
+
const [focusedIdx, setFocusedIdx] = (0, import_react19.useState)(-1);
|
|
2216
|
+
const [popupStyle, setPopupStyle] = (0, import_react19.useState)({});
|
|
2217
|
+
const containerRef = (0, import_react19.useRef)(null);
|
|
2218
|
+
const popupRef = (0, import_react19.useRef)(null);
|
|
2219
|
+
const inputRef = (0, import_react19.useRef)(null);
|
|
2220
|
+
const listRef = (0, import_react19.useRef)(null);
|
|
2221
|
+
const inputId = (0, import_react19.useRef)(`rf-ac-${Math.random().toString(36).slice(2, 9)}`).current;
|
|
1986
2222
|
const sxClass = useSx(sx);
|
|
1987
|
-
const calcPopupStyle = (0,
|
|
2223
|
+
const calcPopupStyle = (0, import_react19.useCallback)(() => {
|
|
1988
2224
|
if (!containerRef.current) return;
|
|
1989
2225
|
const rect = containerRef.current.getBoundingClientRect();
|
|
1990
2226
|
const POPUP_MAX_HEIGHT = 280;
|
|
@@ -2015,15 +2251,15 @@ function AutocompleteInner(props, _ref) {
|
|
|
2015
2251
|
}, []);
|
|
2016
2252
|
const activeInput = controlledInput !== void 0 ? controlledInput : inputStr;
|
|
2017
2253
|
const selectedValues = multiple ? Array.isArray(value) ? value : [] : value != null ? [value] : [];
|
|
2018
|
-
const isEqual = (0,
|
|
2254
|
+
const isEqual = (0, import_react19.useCallback)(
|
|
2019
2255
|
(a, b) => isOptionEqualToValue ? isOptionEqualToValue(a, b) : defaultIsEqual(a, b),
|
|
2020
2256
|
[isOptionEqualToValue]
|
|
2021
2257
|
);
|
|
2022
|
-
const isSelected = (0,
|
|
2258
|
+
const isSelected = (0, import_react19.useCallback)(
|
|
2023
2259
|
(opt) => selectedValues.some((v) => isEqual(opt, v)),
|
|
2024
2260
|
[selectedValues, isEqual]
|
|
2025
2261
|
);
|
|
2026
|
-
const filtered = filterOptions ? filterOptions(options, activeInput) : defaultFilter(options,
|
|
2262
|
+
const filtered = filterOptions ? filterOptions(options, activeInput) : defaultFilter(options, filterQuery, getOptionLabel);
|
|
2027
2263
|
const flatEntries = [];
|
|
2028
2264
|
if (groupBy) {
|
|
2029
2265
|
const groups = {};
|
|
@@ -2046,14 +2282,15 @@ function AutocompleteInner(props, _ref) {
|
|
|
2046
2282
|
filtered.forEach((opt, i) => flatEntries.push({ kind: "option", option: opt, flatIdx: i }));
|
|
2047
2283
|
}
|
|
2048
2284
|
const selectableOptions = flatEntries.filter((e) => e.kind === "option");
|
|
2049
|
-
const openPopup = (0,
|
|
2285
|
+
const openPopup = (0, import_react19.useCallback)(() => {
|
|
2050
2286
|
if (disabled) return;
|
|
2051
2287
|
calcPopupStyle();
|
|
2052
2288
|
setOpen(true);
|
|
2053
2289
|
setFocusedIdx(-1);
|
|
2290
|
+
setFilterQuery("");
|
|
2054
2291
|
onOpen?.();
|
|
2055
2292
|
}, [disabled, calcPopupStyle, onOpen]);
|
|
2056
|
-
const closePopup = (0,
|
|
2293
|
+
const closePopup = (0, import_react19.useCallback)((justSelected = false) => {
|
|
2057
2294
|
setOpen(false);
|
|
2058
2295
|
setFocusedIdx(-1);
|
|
2059
2296
|
onClose?.();
|
|
@@ -2062,7 +2299,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2062
2299
|
onInputChange?.("");
|
|
2063
2300
|
}
|
|
2064
2301
|
}, [freeSolo, multiple, value, onInputChange, onClose]);
|
|
2065
|
-
(0,
|
|
2302
|
+
(0, import_react19.useEffect)(() => {
|
|
2066
2303
|
if (!open) return;
|
|
2067
2304
|
const handleOutside = (e) => {
|
|
2068
2305
|
const target = e.target;
|
|
@@ -2081,7 +2318,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2081
2318
|
window.removeEventListener("resize", calcPopupStyle);
|
|
2082
2319
|
};
|
|
2083
2320
|
}, [open, closePopup, calcPopupStyle]);
|
|
2084
|
-
(0,
|
|
2321
|
+
(0, import_react19.useEffect)(() => {
|
|
2085
2322
|
if (controlledInput !== void 0) return;
|
|
2086
2323
|
if (!multiple) {
|
|
2087
2324
|
const v = value;
|
|
@@ -2095,11 +2332,13 @@ function AutocompleteInner(props, _ref) {
|
|
|
2095
2332
|
const next = already ? selectedValues.filter((v) => !isEqual(v, opt)) : [...selectedValues, opt];
|
|
2096
2333
|
onChange?.(event, next, already ? "removeOption" : "selectOption");
|
|
2097
2334
|
setInputStr("");
|
|
2335
|
+
setFilterQuery("");
|
|
2098
2336
|
onInputChange?.("");
|
|
2099
2337
|
inputRef.current?.focus();
|
|
2100
2338
|
} else {
|
|
2101
2339
|
onChange?.(event, opt, "selectOption");
|
|
2102
2340
|
setInputStr(getOptionLabel(opt));
|
|
2341
|
+
setFilterQuery("");
|
|
2103
2342
|
onInputChange?.(getOptionLabel(opt));
|
|
2104
2343
|
closePopup(true);
|
|
2105
2344
|
}
|
|
@@ -2109,6 +2348,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2109
2348
|
e.stopPropagation();
|
|
2110
2349
|
onChange?.(e, multiple ? [] : null, "clear");
|
|
2111
2350
|
setInputStr("");
|
|
2351
|
+
setFilterQuery("");
|
|
2112
2352
|
onInputChange?.("");
|
|
2113
2353
|
inputRef.current?.focus();
|
|
2114
2354
|
};
|
|
@@ -2120,6 +2360,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2120
2360
|
const handleInputChange = (e) => {
|
|
2121
2361
|
const v = e.target.value;
|
|
2122
2362
|
setInputStr(v);
|
|
2363
|
+
setFilterQuery(v);
|
|
2123
2364
|
onInputChange?.(v);
|
|
2124
2365
|
if (!open) openPopup();
|
|
2125
2366
|
};
|
|
@@ -2193,7 +2434,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2193
2434
|
className
|
|
2194
2435
|
].filter(Boolean).join(" ");
|
|
2195
2436
|
const inputPlaceholder = placeholder || (variant === "outlined" ? " " : void 0);
|
|
2196
|
-
return /* @__PURE__ */
|
|
2437
|
+
return /* @__PURE__ */ import_react19.default.createElement("div", { ref: containerRef, className: rootClasses, style }, /* @__PURE__ */ import_react19.default.createElement(
|
|
2197
2438
|
"div",
|
|
2198
2439
|
{
|
|
2199
2440
|
className: "rf-text-field__wrapper",
|
|
@@ -2204,7 +2445,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2204
2445
|
}
|
|
2205
2446
|
}
|
|
2206
2447
|
},
|
|
2207
|
-
multiple && visibleTags.map((opt, i) => /* @__PURE__ */
|
|
2448
|
+
multiple && visibleTags.map((opt, i) => /* @__PURE__ */ import_react19.default.createElement("span", { key: i, className: "rf-autocomplete__tag" }, /* @__PURE__ */ import_react19.default.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis" } }, getOptionLabel(opt)), /* @__PURE__ */ import_react19.default.createElement(
|
|
2208
2449
|
"button",
|
|
2209
2450
|
{
|
|
2210
2451
|
type: "button",
|
|
@@ -2213,10 +2454,17 @@ function AutocompleteInner(props, _ref) {
|
|
|
2213
2454
|
onClick: (e) => removeTag(opt, e),
|
|
2214
2455
|
tabIndex: -1
|
|
2215
2456
|
},
|
|
2216
|
-
/* @__PURE__ */
|
|
2457
|
+
/* @__PURE__ */ import_react19.default.createElement(CloseSmIcon, { size: 12 })
|
|
2217
2458
|
))),
|
|
2218
|
-
hiddenCount > 0 && /* @__PURE__ */
|
|
2219
|
-
|
|
2459
|
+
hiddenCount > 0 && /* @__PURE__ */ import_react19.default.createElement(
|
|
2460
|
+
Tooltip,
|
|
2461
|
+
{
|
|
2462
|
+
title: selectedValues.slice(limitTags).map((o) => getOptionLabel(o)).join(", "),
|
|
2463
|
+
placement: "top"
|
|
2464
|
+
},
|
|
2465
|
+
/* @__PURE__ */ import_react19.default.createElement("span", { className: "rf-autocomplete__tag-more" }, "+", hiddenCount, " more")
|
|
2466
|
+
),
|
|
2467
|
+
/* @__PURE__ */ import_react19.default.createElement(
|
|
2220
2468
|
"input",
|
|
2221
2469
|
{
|
|
2222
2470
|
ref: inputRef,
|
|
@@ -2238,9 +2486,9 @@ function AutocompleteInner(props, _ref) {
|
|
|
2238
2486
|
"aria-autocomplete": "list"
|
|
2239
2487
|
}
|
|
2240
2488
|
),
|
|
2241
|
-
label && /* @__PURE__ */
|
|
2242
|
-
variant === "outlined" && /* @__PURE__ */
|
|
2243
|
-
/* @__PURE__ */
|
|
2489
|
+
label && /* @__PURE__ */ import_react19.default.createElement("label", { htmlFor: inputId, className: "rf-text-field__label" }, label, required && /* @__PURE__ */ import_react19.default.createElement("span", { className: "rf-text-field__asterisk" }, " *")),
|
|
2490
|
+
variant === "outlined" && /* @__PURE__ */ import_react19.default.createElement("fieldset", { className: "rf-text-field__notch" }, label ? /* @__PURE__ */ import_react19.default.createElement("legend", { className: "rf-text-field__legend" }, /* @__PURE__ */ import_react19.default.createElement("span", null, label, required ? " *" : "")) : /* @__PURE__ */ import_react19.default.createElement("legend", { className: "rf-text-field__legend--empty" })),
|
|
2491
|
+
/* @__PURE__ */ import_react19.default.createElement("div", { className: "rf-autocomplete__endgroup" }, hasClearable && /* @__PURE__ */ import_react19.default.createElement(
|
|
2244
2492
|
"button",
|
|
2245
2493
|
{
|
|
2246
2494
|
type: "button",
|
|
@@ -2250,8 +2498,8 @@ function AutocompleteInner(props, _ref) {
|
|
|
2250
2498
|
tabIndex: -1,
|
|
2251
2499
|
"aria-label": "Clear"
|
|
2252
2500
|
},
|
|
2253
|
-
/* @__PURE__ */
|
|
2254
|
-
), !freeSolo && /* @__PURE__ */
|
|
2501
|
+
/* @__PURE__ */ import_react19.default.createElement(CloseSmIcon, { size: 16 })
|
|
2502
|
+
), !freeSolo && /* @__PURE__ */ import_react19.default.createElement(
|
|
2255
2503
|
"button",
|
|
2256
2504
|
{
|
|
2257
2505
|
type: "button",
|
|
@@ -2263,10 +2511,10 @@ function AutocompleteInner(props, _ref) {
|
|
|
2263
2511
|
tabIndex: -1,
|
|
2264
2512
|
"aria-label": open ? "Close" : "Open"
|
|
2265
2513
|
},
|
|
2266
|
-
/* @__PURE__ */
|
|
2514
|
+
/* @__PURE__ */ import_react19.default.createElement(ChevronDownIcon, null)
|
|
2267
2515
|
))
|
|
2268
|
-
), helperText && /* @__PURE__ */
|
|
2269
|
-
/* @__PURE__ */
|
|
2516
|
+
), helperText && /* @__PURE__ */ import_react19.default.createElement("div", { className: `rf-text-field__helper-text${error ? " rf-text-field__helper-text--error" : ""}` }, helperText), open && !disabled && import_react_dom3.default.createPortal(
|
|
2517
|
+
/* @__PURE__ */ import_react19.default.createElement("div", { ref: popupRef, className: "rf-autocomplete__popup", role: "presentation", style: popupStyle }, loading ? /* @__PURE__ */ import_react19.default.createElement("div", { className: "rf-autocomplete__loading" }, /* @__PURE__ */ import_react19.default.createElement("span", { className: "rf-ac-spinner" }), loadingText) : flatEntries.length === 0 ? /* @__PURE__ */ import_react19.default.createElement("div", { className: "rf-autocomplete__no-options" }, noOptionsText) : /* @__PURE__ */ import_react19.default.createElement("ul", { ref: listRef, className: "rf-autocomplete__listbox", role: "listbox" }, groupBy ? (
|
|
2270
2518
|
// Grouped render
|
|
2271
2519
|
(() => {
|
|
2272
2520
|
const rendered = [];
|
|
@@ -2276,7 +2524,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2276
2524
|
if (entry.kind === "group") {
|
|
2277
2525
|
if (groupItems.length > 0) {
|
|
2278
2526
|
rendered.push(
|
|
2279
|
-
/* @__PURE__ */
|
|
2527
|
+
/* @__PURE__ */ import_react19.default.createElement("li", { key: `g-${currentGroup}`, role: "presentation" }, /* @__PURE__ */ import_react19.default.createElement("div", { className: "rf-autocomplete__group-header" }, currentGroup), /* @__PURE__ */ import_react19.default.createElement("ul", { className: "rf-autocomplete__group-items", role: "group" }, groupItems))
|
|
2280
2528
|
);
|
|
2281
2529
|
groupItems = [];
|
|
2282
2530
|
}
|
|
@@ -2287,7 +2535,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2287
2535
|
}
|
|
2288
2536
|
if (ei === flatEntries.length - 1 && groupItems.length > 0) {
|
|
2289
2537
|
rendered.push(
|
|
2290
|
-
/* @__PURE__ */
|
|
2538
|
+
/* @__PURE__ */ import_react19.default.createElement("li", { key: `g-${currentGroup}`, role: "presentation" }, /* @__PURE__ */ import_react19.default.createElement("div", { className: "rf-autocomplete__group-header" }, currentGroup), /* @__PURE__ */ import_react19.default.createElement("ul", { className: "rf-autocomplete__group-items", role: "group" }, groupItems))
|
|
2291
2539
|
);
|
|
2292
2540
|
}
|
|
2293
2541
|
});
|
|
@@ -2301,7 +2549,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2301
2549
|
const focused = focusedIdx === flatIdx;
|
|
2302
2550
|
const optDisabled = getOptionDisabled?.(option) ?? false;
|
|
2303
2551
|
const label2 = getOptionLabel(option);
|
|
2304
|
-
return /* @__PURE__ */
|
|
2552
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
2305
2553
|
"li",
|
|
2306
2554
|
{
|
|
2307
2555
|
key: label2 + flatIdx,
|
|
@@ -2320,12 +2568,12 @@ function AutocompleteInner(props, _ref) {
|
|
|
2320
2568
|
onMouseDown: (e) => e.preventDefault(),
|
|
2321
2569
|
onClick: (e) => selectOption(option, e)
|
|
2322
2570
|
},
|
|
2323
|
-
renderOption ? renderOption(option, { selected, focused, index: flatIdx }) : /* @__PURE__ */
|
|
2324
|
-
!renderOption && /* @__PURE__ */
|
|
2571
|
+
renderOption ? renderOption(option, { selected, focused, index: flatIdx }) : /* @__PURE__ */ import_react19.default.createElement("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, label2),
|
|
2572
|
+
!renderOption && /* @__PURE__ */ import_react19.default.createElement("span", { className: "rf-autocomplete__option-check" }, /* @__PURE__ */ import_react19.default.createElement(CheckIcon, null))
|
|
2325
2573
|
);
|
|
2326
2574
|
}
|
|
2327
2575
|
}
|
|
2328
|
-
var Autocomplete =
|
|
2576
|
+
var Autocomplete = import_react19.default.forwardRef(AutocompleteInner);
|
|
2329
2577
|
Autocomplete.displayName = "Autocomplete";
|
|
2330
2578
|
|
|
2331
2579
|
// lib/TextFields/AddressLookup.tsx
|
|
@@ -2342,16 +2590,16 @@ var AddressLookup = ({
|
|
|
2342
2590
|
token = ""
|
|
2343
2591
|
}) => {
|
|
2344
2592
|
const { theme } = useRufousTheme();
|
|
2345
|
-
const [suggestions, setSuggestions] = (0,
|
|
2346
|
-
const [loading, setLoading] = (0,
|
|
2347
|
-
const [showSuggestions, setShowSuggestions] = (0,
|
|
2348
|
-
const debounceTimeout = (0,
|
|
2349
|
-
const containerRef = (0,
|
|
2593
|
+
const [suggestions, setSuggestions] = (0, import_react20.useState)([]);
|
|
2594
|
+
const [loading, setLoading] = (0, import_react20.useState)(false);
|
|
2595
|
+
const [showSuggestions, setShowSuggestions] = (0, import_react20.useState)(false);
|
|
2596
|
+
const debounceTimeout = (0, import_react20.useRef)(null);
|
|
2597
|
+
const containerRef = (0, import_react20.useRef)(null);
|
|
2350
2598
|
const apiKey = token || "";
|
|
2351
2599
|
const countries = import_country_state_city.Country.getAllCountries();
|
|
2352
|
-
const [states, setStates] = (0,
|
|
2353
|
-
const [cities, setCities] = (0,
|
|
2354
|
-
(0,
|
|
2600
|
+
const [states, setStates] = (0, import_react20.useState)([]);
|
|
2601
|
+
const [cities, setCities] = (0, import_react20.useState)([]);
|
|
2602
|
+
(0, import_react20.useEffect)(() => {
|
|
2355
2603
|
const handleClickOutside = (event) => {
|
|
2356
2604
|
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
2357
2605
|
setShowSuggestions(false);
|
|
@@ -2360,7 +2608,7 @@ var AddressLookup = ({
|
|
|
2360
2608
|
document.addEventListener("mousedown", handleClickOutside);
|
|
2361
2609
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2362
2610
|
}, []);
|
|
2363
|
-
(0,
|
|
2611
|
+
(0, import_react20.useEffect)(() => {
|
|
2364
2612
|
if (value.country) {
|
|
2365
2613
|
const country = countries.find((c) => c.name === value.country);
|
|
2366
2614
|
if (country) {
|
|
@@ -2373,7 +2621,7 @@ var AddressLookup = ({
|
|
|
2373
2621
|
setStates([]);
|
|
2374
2622
|
}
|
|
2375
2623
|
}, [value.country]);
|
|
2376
|
-
(0,
|
|
2624
|
+
(0, import_react20.useEffect)(() => {
|
|
2377
2625
|
if (value.state && value.country) {
|
|
2378
2626
|
const country = countries.find((c) => c.name === value.country);
|
|
2379
2627
|
if (country) {
|
|
@@ -2478,7 +2726,7 @@ var AddressLookup = ({
|
|
|
2478
2726
|
city: ""
|
|
2479
2727
|
});
|
|
2480
2728
|
};
|
|
2481
|
-
return /* @__PURE__ */
|
|
2729
|
+
return /* @__PURE__ */ import_react20.default.createElement("div", { className: "address-lookup-container", style: sx, ref: containerRef }, /* @__PURE__ */ import_react20.default.createElement("div", { className: `address-lookup-grid address-lookup-grid-${layout}` }, /* @__PURE__ */ import_react20.default.createElement("div", { className: "address-lookup-grid-item col-l1" }, /* @__PURE__ */ import_react20.default.createElement(
|
|
2482
2730
|
TextField,
|
|
2483
2731
|
{
|
|
2484
2732
|
label,
|
|
@@ -2510,7 +2758,7 @@ var AddressLookup = ({
|
|
|
2510
2758
|
},
|
|
2511
2759
|
onFocus: () => suggestions.length > 0 && setShowSuggestions(true)
|
|
2512
2760
|
}
|
|
2513
|
-
), loading && /* @__PURE__ */
|
|
2761
|
+
), loading && /* @__PURE__ */ import_react20.default.createElement("div", { className: "loading-indicator" }, /* @__PURE__ */ import_react20.default.createElement(circularProgress_default, { size: 20 })), showSuggestions && suggestions.length > 0 && /* @__PURE__ */ import_react20.default.createElement("div", { className: "autocomplete-dropdown" }, suggestions.map((option, idx) => /* @__PURE__ */ import_react20.default.createElement(
|
|
2514
2762
|
"div",
|
|
2515
2763
|
{
|
|
2516
2764
|
key: idx,
|
|
@@ -2521,9 +2769,9 @@ var AddressLookup = ({
|
|
|
2521
2769
|
fetchPlaceDetails(option.placePrediction.placeId, mainText);
|
|
2522
2770
|
}
|
|
2523
2771
|
},
|
|
2524
|
-
/* @__PURE__ */
|
|
2525
|
-
/* @__PURE__ */
|
|
2526
|
-
))), error.addressLine1 && /* @__PURE__ */
|
|
2772
|
+
/* @__PURE__ */ import_react20.default.createElement("div", { className: "autocomplete-main-text" }, option?.placePrediction?.structuredFormat?.mainText?.text),
|
|
2773
|
+
/* @__PURE__ */ import_react20.default.createElement("div", { className: "autocomplete-secondary-text" }, option?.placePrediction?.structuredFormat?.secondaryText?.text)
|
|
2774
|
+
))), error.addressLine1 && /* @__PURE__ */ import_react20.default.createElement("div", { className: "field-error-text" }, error.addressLine1)), layout === "compact" && /* @__PURE__ */ import_react20.default.createElement("div", { className: "address-lookup-grid-item col-l2" }, /* @__PURE__ */ import_react20.default.createElement(
|
|
2527
2775
|
TextField,
|
|
2528
2776
|
{
|
|
2529
2777
|
label: "Address Line 2",
|
|
@@ -2532,7 +2780,7 @@ var AddressLookup = ({
|
|
|
2532
2780
|
value: value.addressLine2 || "",
|
|
2533
2781
|
onChange: (e) => handleChange("addressLine2", e.target.value)
|
|
2534
2782
|
}
|
|
2535
|
-
)), layout !== "compact" && /* @__PURE__ */
|
|
2783
|
+
)), layout !== "compact" && /* @__PURE__ */ import_react20.default.createElement("div", { className: "address-lookup-grid-item col-l2" }, /* @__PURE__ */ import_react20.default.createElement(
|
|
2536
2784
|
TextField,
|
|
2537
2785
|
{
|
|
2538
2786
|
label: "Address Line 2",
|
|
@@ -2541,7 +2789,7 @@ var AddressLookup = ({
|
|
|
2541
2789
|
value: value.addressLine2 || "",
|
|
2542
2790
|
onChange: (e) => handleChange("addressLine2", e.target.value)
|
|
2543
2791
|
}
|
|
2544
|
-
)), /* @__PURE__ */
|
|
2792
|
+
)), /* @__PURE__ */ import_react20.default.createElement("div", { className: "address-lookup-grid-item col-country" }, /* @__PURE__ */ import_react20.default.createElement(
|
|
2545
2793
|
Autocomplete,
|
|
2546
2794
|
{
|
|
2547
2795
|
options: countries.map((c) => c.name),
|
|
@@ -2552,7 +2800,7 @@ var AddressLookup = ({
|
|
|
2552
2800
|
required,
|
|
2553
2801
|
error: !!error.country
|
|
2554
2802
|
}
|
|
2555
|
-
), error.country && /* @__PURE__ */
|
|
2803
|
+
), error.country && /* @__PURE__ */ import_react20.default.createElement("div", { className: "field-error-text" }, error.country)), /* @__PURE__ */ import_react20.default.createElement("div", { className: "address-lookup-grid-item col-state" }, /* @__PURE__ */ import_react20.default.createElement(
|
|
2556
2804
|
Autocomplete,
|
|
2557
2805
|
{
|
|
2558
2806
|
options: states.map((s2) => s2.name),
|
|
@@ -2563,7 +2811,7 @@ var AddressLookup = ({
|
|
|
2563
2811
|
required,
|
|
2564
2812
|
error: !!error.state
|
|
2565
2813
|
}
|
|
2566
|
-
), error.state && /* @__PURE__ */
|
|
2814
|
+
), error.state && /* @__PURE__ */ import_react20.default.createElement("div", { className: "field-error-text" }, error.state)), /* @__PURE__ */ import_react20.default.createElement("div", { className: "address-lookup-grid-item col-city" }, /* @__PURE__ */ import_react20.default.createElement(
|
|
2567
2815
|
Autocomplete,
|
|
2568
2816
|
{
|
|
2569
2817
|
options: cities.map((c) => c.name),
|
|
@@ -2574,7 +2822,7 @@ var AddressLookup = ({
|
|
|
2574
2822
|
required,
|
|
2575
2823
|
error: !!error.city
|
|
2576
2824
|
}
|
|
2577
|
-
), error.city && /* @__PURE__ */
|
|
2825
|
+
), error.city && /* @__PURE__ */ import_react20.default.createElement("div", { className: "field-error-text" }, error.city)), /* @__PURE__ */ import_react20.default.createElement("div", { className: "address-lookup-grid-item col-pin" }, /* @__PURE__ */ import_react20.default.createElement(
|
|
2578
2826
|
TextField,
|
|
2579
2827
|
{
|
|
2580
2828
|
label: "Pincode",
|
|
@@ -2584,13 +2832,13 @@ var AddressLookup = ({
|
|
|
2584
2832
|
required,
|
|
2585
2833
|
onChange: (e) => handleChange("pincode", e.target.value)
|
|
2586
2834
|
}
|
|
2587
|
-
), error.pincode && /* @__PURE__ */
|
|
2835
|
+
), error.pincode && /* @__PURE__ */ import_react20.default.createElement("div", { className: "field-error-text" }, error.pincode))));
|
|
2588
2836
|
};
|
|
2589
2837
|
var AddressLookup_default = AddressLookup;
|
|
2590
2838
|
|
|
2591
2839
|
// lib/TextFields/DateField.tsx
|
|
2592
|
-
var
|
|
2593
|
-
var
|
|
2840
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
2841
|
+
var import_react_dom4 = require("react-dom");
|
|
2594
2842
|
var WEEKDAYS = ["SU", "MO", "TU", "WE", "TH", "FR", "SA"];
|
|
2595
2843
|
var MONTHS = [
|
|
2596
2844
|
"January",
|
|
@@ -2750,25 +2998,25 @@ var parseTimeFromISO = (iso) => {
|
|
|
2750
2998
|
if (h === 0) h = 12;
|
|
2751
2999
|
return { h, m, ampm };
|
|
2752
3000
|
};
|
|
2753
|
-
var CalendarIcon = () => /* @__PURE__ */
|
|
2754
|
-
var ChevUp = () => /* @__PURE__ */
|
|
2755
|
-
var ChevDown = () => /* @__PURE__ */
|
|
3001
|
+
var CalendarIcon = () => /* @__PURE__ */ import_react21.default.createElement("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ import_react21.default.createElement("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }), /* @__PURE__ */ import_react21.default.createElement("line", { x1: "16", y1: "2", x2: "16", y2: "6" }), /* @__PURE__ */ import_react21.default.createElement("line", { x1: "8", y1: "2", x2: "8", y2: "6" }), /* @__PURE__ */ import_react21.default.createElement("line", { x1: "3", y1: "10", x2: "21", y2: "10" }));
|
|
3002
|
+
var ChevUp = () => /* @__PURE__ */ import_react21.default.createElement("svg", { width: "10", height: "7", viewBox: "0 0 10 7", fill: "currentColor" }, /* @__PURE__ */ import_react21.default.createElement("path", { d: "M5 0L10 7H0L5 0Z" }));
|
|
3003
|
+
var ChevDown = () => /* @__PURE__ */ import_react21.default.createElement("svg", { width: "10", height: "7", viewBox: "0 0 10 7", fill: "currentColor" }, /* @__PURE__ */ import_react21.default.createElement("path", { d: "M5 7L0 0H10L5 7Z" }));
|
|
2756
3004
|
var ITEM_H = 36;
|
|
2757
3005
|
var ScrollColumn = ({ items, selected, onSelect, infinite = true }) => {
|
|
2758
|
-
const listRef = (0,
|
|
2759
|
-
const isInternalScroll = (0,
|
|
2760
|
-
const scrollTimeout = (0,
|
|
3006
|
+
const listRef = (0, import_react21.useRef)(null);
|
|
3007
|
+
const isInternalScroll = (0, import_react21.useRef)(false);
|
|
3008
|
+
const scrollTimeout = (0, import_react21.useRef)(null);
|
|
2761
3009
|
const MULTIPLIER = infinite ? 100 : 1;
|
|
2762
3010
|
const virtualItems = infinite ? Array(MULTIPLIER).fill(items).flat() : items;
|
|
2763
3011
|
const centerOffset = infinite ? Math.floor(MULTIPLIER / 2) * items.length : 0;
|
|
2764
3012
|
const VISUAL_OFFSET = 54;
|
|
2765
|
-
(0,
|
|
3013
|
+
(0, import_react21.useEffect)(() => {
|
|
2766
3014
|
if (listRef.current) {
|
|
2767
3015
|
const targetIndex = centerOffset + selected;
|
|
2768
3016
|
listRef.current.scrollTop = targetIndex * ITEM_H - (infinite ? VISUAL_OFFSET : 0);
|
|
2769
3017
|
}
|
|
2770
3018
|
}, [centerOffset, infinite, selected]);
|
|
2771
|
-
(0,
|
|
3019
|
+
(0, import_react21.useEffect)(() => {
|
|
2772
3020
|
if (listRef.current && !isInternalScroll.current) {
|
|
2773
3021
|
const targetIndex = centerOffset + selected;
|
|
2774
3022
|
listRef.current.scrollTo({
|
|
@@ -2800,15 +3048,15 @@ var ScrollColumn = ({ items, selected, onSelect, infinite = true }) => {
|
|
|
2800
3048
|
}
|
|
2801
3049
|
}, 100);
|
|
2802
3050
|
};
|
|
2803
|
-
return /* @__PURE__ */
|
|
3051
|
+
return /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-timescroll__col-wrapper" }, /* @__PURE__ */ import_react21.default.createElement(
|
|
2804
3052
|
"div",
|
|
2805
3053
|
{
|
|
2806
3054
|
className: "rf-timescroll__col",
|
|
2807
3055
|
ref: listRef,
|
|
2808
3056
|
onScroll: handleScroll
|
|
2809
3057
|
},
|
|
2810
|
-
!infinite && /* @__PURE__ */
|
|
2811
|
-
virtualItems.map((label, idx) => /* @__PURE__ */
|
|
3058
|
+
!infinite && /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-timescroll__spacer" }),
|
|
3059
|
+
virtualItems.map((label, idx) => /* @__PURE__ */ import_react21.default.createElement(
|
|
2812
3060
|
"div",
|
|
2813
3061
|
{
|
|
2814
3062
|
key: `${label}-${idx}`,
|
|
@@ -2816,8 +3064,8 @@ var ScrollColumn = ({ items, selected, onSelect, infinite = true }) => {
|
|
|
2816
3064
|
},
|
|
2817
3065
|
label
|
|
2818
3066
|
)),
|
|
2819
|
-
!infinite && /* @__PURE__ */
|
|
2820
|
-
), /* @__PURE__ */
|
|
3067
|
+
!infinite && /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-timescroll__spacer" })
|
|
3068
|
+
), /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-timescroll__mask rf-timescroll__mask--top" }), /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-timescroll__mask rf-timescroll__mask--bottom" }));
|
|
2821
3069
|
};
|
|
2822
3070
|
var SpinnerPanel = ({
|
|
2823
3071
|
hour,
|
|
@@ -2828,7 +3076,7 @@ var SpinnerPanel = ({
|
|
|
2828
3076
|
onHourInput,
|
|
2829
3077
|
onMinuteInput,
|
|
2830
3078
|
onAmpmToggle
|
|
2831
|
-
}) => /* @__PURE__ */
|
|
3079
|
+
}) => /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__time-row" }, /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__time-input-wrap" }, /* @__PURE__ */ import_react21.default.createElement("button", { type: "button", className: "rf-date-picker__time-spin-btn", onMouseDown: (e) => e.preventDefault(), onClick: () => onHourChange(1) }, /* @__PURE__ */ import_react21.default.createElement(ChevUp, null)), /* @__PURE__ */ import_react21.default.createElement(
|
|
2832
3080
|
"input",
|
|
2833
3081
|
{
|
|
2834
3082
|
type: "number",
|
|
@@ -2839,7 +3087,7 @@ var SpinnerPanel = ({
|
|
|
2839
3087
|
onChange: onHourInput,
|
|
2840
3088
|
onMouseDown: (e) => e.stopPropagation()
|
|
2841
3089
|
}
|
|
2842
|
-
), /* @__PURE__ */
|
|
3090
|
+
), /* @__PURE__ */ import_react21.default.createElement("button", { type: "button", className: "rf-date-picker__time-spin-btn", onMouseDown: (e) => e.preventDefault(), onClick: () => onHourChange(-1) }, /* @__PURE__ */ import_react21.default.createElement(ChevDown, null))), /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__time-colon" }, ":"), /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__time-input-wrap" }, /* @__PURE__ */ import_react21.default.createElement("button", { type: "button", className: "rf-date-picker__time-spin-btn", onMouseDown: (e) => e.preventDefault(), onClick: () => onMinuteChange(1) }, /* @__PURE__ */ import_react21.default.createElement(ChevUp, null)), /* @__PURE__ */ import_react21.default.createElement(
|
|
2843
3091
|
"input",
|
|
2844
3092
|
{
|
|
2845
3093
|
type: "number",
|
|
@@ -2850,7 +3098,7 @@ var SpinnerPanel = ({
|
|
|
2850
3098
|
onChange: onMinuteInput,
|
|
2851
3099
|
onMouseDown: (e) => e.stopPropagation()
|
|
2852
3100
|
}
|
|
2853
|
-
), /* @__PURE__ */
|
|
3101
|
+
), /* @__PURE__ */ import_react21.default.createElement("button", { type: "button", className: "rf-date-picker__time-spin-btn", onMouseDown: (e) => e.preventDefault(), onClick: () => onMinuteChange(-1) }, /* @__PURE__ */ import_react21.default.createElement(ChevDown, null))), /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__ampm" }, /* @__PURE__ */ import_react21.default.createElement(
|
|
2854
3102
|
"button",
|
|
2855
3103
|
{
|
|
2856
3104
|
type: "button",
|
|
@@ -2859,7 +3107,7 @@ var SpinnerPanel = ({
|
|
|
2859
3107
|
onClick: () => onAmpmToggle("AM")
|
|
2860
3108
|
},
|
|
2861
3109
|
"AM"
|
|
2862
|
-
), /* @__PURE__ */
|
|
3110
|
+
), /* @__PURE__ */ import_react21.default.createElement(
|
|
2863
3111
|
"button",
|
|
2864
3112
|
{
|
|
2865
3113
|
type: "button",
|
|
@@ -2881,7 +3129,7 @@ var CalendarBody = ({
|
|
|
2881
3129
|
onMonthSelect,
|
|
2882
3130
|
onYearSelect
|
|
2883
3131
|
}) => {
|
|
2884
|
-
const [pickerView, setPickerView] = (0,
|
|
3132
|
+
const [pickerView, setPickerView] = (0, import_react21.useState)("calendar");
|
|
2885
3133
|
const handleMonthClick = () => {
|
|
2886
3134
|
setPickerView(pickerView === "month" ? "calendar" : "month");
|
|
2887
3135
|
};
|
|
@@ -2899,21 +3147,21 @@ var CalendarBody = ({
|
|
|
2899
3147
|
const currentYear = todayDate.getFullYear();
|
|
2900
3148
|
const yearStart = viewYear - 6;
|
|
2901
3149
|
const years = Array.from({ length: 16 }, (_, i) => yearStart + i);
|
|
2902
|
-
return /* @__PURE__ */
|
|
3150
|
+
return /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, null, /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__header" }, /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__header-labels" }, /* @__PURE__ */ import_react21.default.createElement(
|
|
2903
3151
|
"span",
|
|
2904
3152
|
{
|
|
2905
3153
|
className: `rf-date-picker__month-label ${pickerView === "month" ? "rf-date-picker__month-label--active" : ""}`,
|
|
2906
3154
|
onClick: handleMonthClick
|
|
2907
3155
|
},
|
|
2908
3156
|
MONTHS[viewMonth]
|
|
2909
|
-
), /* @__PURE__ */
|
|
3157
|
+
), /* @__PURE__ */ import_react21.default.createElement(
|
|
2910
3158
|
"span",
|
|
2911
3159
|
{
|
|
2912
3160
|
className: `rf-date-picker__year-label ${pickerView === "year" ? "rf-date-picker__year-label--active" : ""}`,
|
|
2913
3161
|
onClick: handleYearClick
|
|
2914
3162
|
},
|
|
2915
3163
|
viewYear
|
|
2916
|
-
)), /* @__PURE__ */
|
|
3164
|
+
)), /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__nav" }, pickerView === "year" ? /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, null, /* @__PURE__ */ import_react21.default.createElement("button", { type: "button", className: "rf-date-picker__nav-btn", onClick: () => onYearSelect(viewYear - 16), "aria-label": "Previous years" }, "\u2039"), /* @__PURE__ */ import_react21.default.createElement("button", { type: "button", className: "rf-date-picker__nav-btn", onClick: () => onYearSelect(viewYear + 16), "aria-label": "Next years" }, "\u203A")) : /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, null, /* @__PURE__ */ import_react21.default.createElement("button", { type: "button", className: "rf-date-picker__nav-btn", onClick: onPrev, "aria-label": "Previous month" }, "\u2039"), /* @__PURE__ */ import_react21.default.createElement("button", { type: "button", className: "rf-date-picker__nav-btn", onClick: onNext, "aria-label": "Next month" }, "\u203A")))), pickerView === "month" && /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__month-grid" }, MONTHS_SHORT.map((m, idx) => /* @__PURE__ */ import_react21.default.createElement(
|
|
2917
3165
|
"button",
|
|
2918
3166
|
{
|
|
2919
3167
|
key: m,
|
|
@@ -2926,7 +3174,7 @@ var CalendarBody = ({
|
|
|
2926
3174
|
onClick: () => handleMonthPick(idx)
|
|
2927
3175
|
},
|
|
2928
3176
|
m
|
|
2929
|
-
))), pickerView === "year" && /* @__PURE__ */
|
|
3177
|
+
))), pickerView === "year" && /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__year-grid" }, years.map((y) => /* @__PURE__ */ import_react21.default.createElement(
|
|
2930
3178
|
"button",
|
|
2931
3179
|
{
|
|
2932
3180
|
key: y,
|
|
@@ -2939,12 +3187,12 @@ var CalendarBody = ({
|
|
|
2939
3187
|
onClick: () => handleYearPick(y)
|
|
2940
3188
|
},
|
|
2941
3189
|
y
|
|
2942
|
-
))), pickerView === "calendar" && /* @__PURE__ */
|
|
2943
|
-
if (day === null) return /* @__PURE__ */
|
|
3190
|
+
))), pickerView === "calendar" && /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, null, /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__weekdays" }, WEEKDAYS.map((w) => /* @__PURE__ */ import_react21.default.createElement("div", { key: w, className: "rf-date-picker__weekday" }, w))), /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__grid" }, dayCells.map((day, idx) => {
|
|
3191
|
+
if (day === null) return /* @__PURE__ */ import_react21.default.createElement("div", { key: `e-${idx}`, className: "rf-date-picker__day rf-date-picker__day--empty" });
|
|
2944
3192
|
const cellDate = new Date(viewYear, viewMonth, day);
|
|
2945
3193
|
const isSelected = selectedDate ? isSameDay(cellDate, selectedDate) : false;
|
|
2946
3194
|
const isToday = isSameDay(cellDate, todayDate);
|
|
2947
|
-
return /* @__PURE__ */
|
|
3195
|
+
return /* @__PURE__ */ import_react21.default.createElement(
|
|
2948
3196
|
"button",
|
|
2949
3197
|
{
|
|
2950
3198
|
key: day,
|
|
@@ -2980,29 +3228,29 @@ var DateField = ({
|
|
|
2980
3228
|
sx
|
|
2981
3229
|
}) => {
|
|
2982
3230
|
const sxClass = useSx(sx);
|
|
2983
|
-
const [open, setOpen] = (0,
|
|
2984
|
-
const [selectedDate, setSelectedDate] = (0,
|
|
2985
|
-
const [hour, setHour] = (0,
|
|
3231
|
+
const [open, setOpen] = (0, import_react21.useState)(false);
|
|
3232
|
+
const [selectedDate, setSelectedDate] = (0, import_react21.useState)(() => value ? isoToDate(value) : null);
|
|
3233
|
+
const [hour, setHour] = (0, import_react21.useState)(() => {
|
|
2986
3234
|
if (value && isDatetimeType(type)) return parseTimeFromISO(value).h;
|
|
2987
3235
|
return 12;
|
|
2988
3236
|
});
|
|
2989
|
-
const [minute, setMinute] = (0,
|
|
3237
|
+
const [minute, setMinute] = (0, import_react21.useState)(() => {
|
|
2990
3238
|
if (value && isDatetimeType(type)) return parseTimeFromISO(value).m;
|
|
2991
3239
|
return 0;
|
|
2992
3240
|
});
|
|
2993
|
-
const [ampm, setAmpm] = (0,
|
|
3241
|
+
const [ampm, setAmpm] = (0, import_react21.useState)(() => {
|
|
2994
3242
|
if (value && isDatetimeType(type)) return parseTimeFromISO(value).ampm;
|
|
2995
3243
|
return "AM";
|
|
2996
3244
|
});
|
|
2997
|
-
const [viewYear, setViewYear] = (0,
|
|
3245
|
+
const [viewYear, setViewYear] = (0, import_react21.useState)(() => {
|
|
2998
3246
|
const base = value ? isoToDate(value) : null;
|
|
2999
3247
|
return base ? base.getFullYear() : today().getFullYear();
|
|
3000
3248
|
});
|
|
3001
|
-
const [viewMonth, setViewMonth] = (0,
|
|
3249
|
+
const [viewMonth, setViewMonth] = (0, import_react21.useState)(() => {
|
|
3002
3250
|
const base = value ? isoToDate(value) : null;
|
|
3003
3251
|
return base ? base.getMonth() : today().getMonth();
|
|
3004
3252
|
});
|
|
3005
|
-
const [inputStr, setInputStr] = (0,
|
|
3253
|
+
const [inputStr, setInputStr] = (0, import_react21.useState)(() => {
|
|
3006
3254
|
if (!value) return "";
|
|
3007
3255
|
const d = isoToDate(value);
|
|
3008
3256
|
if (!d) return "";
|
|
@@ -3016,12 +3264,12 @@ var DateField = ({
|
|
|
3016
3264
|
const HOURS = Array.from({ length: 12 }, (_, i) => String(i + 1).padStart(2, "0"));
|
|
3017
3265
|
const MINUTES = Array.from({ length: 60 }, (_, i) => String(i).padStart(2, "0"));
|
|
3018
3266
|
const AMPMS = ["AM", "PM"];
|
|
3019
|
-
const containerRef = (0,
|
|
3020
|
-
const pickerRef = (0,
|
|
3021
|
-
const [dropUp, setDropUp] = (0,
|
|
3022
|
-
const inputId = (0,
|
|
3023
|
-
const isInternalChange = (0,
|
|
3024
|
-
(0,
|
|
3267
|
+
const containerRef = (0, import_react21.useRef)(null);
|
|
3268
|
+
const pickerRef = (0, import_react21.useRef)(null);
|
|
3269
|
+
const [dropUp, setDropUp] = (0, import_react21.useState)(false);
|
|
3270
|
+
const inputId = (0, import_react21.useRef)(`rf-df-${Math.random().toString(36).substring(2, 11)}`).current;
|
|
3271
|
+
const isInternalChange = (0, import_react21.useRef)(false);
|
|
3272
|
+
(0, import_react21.useEffect)(() => {
|
|
3025
3273
|
if (value === void 0) return;
|
|
3026
3274
|
if (isInternalChange.current) {
|
|
3027
3275
|
isInternalChange.current = false;
|
|
@@ -3048,7 +3296,7 @@ var DateField = ({
|
|
|
3048
3296
|
setInputStr(str);
|
|
3049
3297
|
}
|
|
3050
3298
|
}, [value, type]);
|
|
3051
|
-
(0,
|
|
3299
|
+
(0, import_react21.useEffect)(() => {
|
|
3052
3300
|
if (!open) return;
|
|
3053
3301
|
const handler = (e) => {
|
|
3054
3302
|
const target = e.target;
|
|
@@ -3059,14 +3307,14 @@ var DateField = ({
|
|
|
3059
3307
|
document.addEventListener("mousedown", handler);
|
|
3060
3308
|
return () => document.removeEventListener("mousedown", handler);
|
|
3061
3309
|
}, [open]);
|
|
3062
|
-
(0,
|
|
3310
|
+
(0, import_react21.useEffect)(() => {
|
|
3063
3311
|
if (!open || !containerRef.current) return;
|
|
3064
3312
|
const rect = containerRef.current.getBoundingClientRect();
|
|
3065
3313
|
const spaceBelow = window.innerHeight - rect.bottom;
|
|
3066
3314
|
const pickerHeight = 400;
|
|
3067
3315
|
setDropUp(spaceBelow < pickerHeight && rect.top > pickerHeight);
|
|
3068
3316
|
}, [open]);
|
|
3069
|
-
const commitDate = (0,
|
|
3317
|
+
const commitDate = (0, import_react21.useCallback)((d, h, m, ap) => {
|
|
3070
3318
|
setSelectedDate(d);
|
|
3071
3319
|
if (!d) {
|
|
3072
3320
|
setInputStr("");
|
|
@@ -3217,7 +3465,7 @@ var DateField = ({
|
|
|
3217
3465
|
const inputPlaceholder = placeholder || (variant === "outlined" ? " " : void 0);
|
|
3218
3466
|
const todayDate = today();
|
|
3219
3467
|
const isSideVariant = type === "datetime-side" || type === "datetime-scroll";
|
|
3220
|
-
return /* @__PURE__ */
|
|
3468
|
+
return /* @__PURE__ */ import_react21.default.createElement("div", { ref: containerRef, className: rootClasses, style }, /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-field__anchor" }, /* @__PURE__ */ import_react21.default.createElement(
|
|
3221
3469
|
"div",
|
|
3222
3470
|
{
|
|
3223
3471
|
className: "rf-text-field__wrapper",
|
|
@@ -3226,7 +3474,7 @@ var DateField = ({
|
|
|
3226
3474
|
},
|
|
3227
3475
|
style: { cursor: disabled ? "default" : "pointer" }
|
|
3228
3476
|
},
|
|
3229
|
-
/* @__PURE__ */
|
|
3477
|
+
/* @__PURE__ */ import_react21.default.createElement(
|
|
3230
3478
|
"input",
|
|
3231
3479
|
{
|
|
3232
3480
|
id: inputId,
|
|
@@ -3242,7 +3490,7 @@ var DateField = ({
|
|
|
3242
3490
|
}
|
|
3243
3491
|
}
|
|
3244
3492
|
),
|
|
3245
|
-
/* @__PURE__ */
|
|
3493
|
+
/* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-text-field__adornment rf-text-field__adornment--end" }, /* @__PURE__ */ import_react21.default.createElement(
|
|
3246
3494
|
"button",
|
|
3247
3495
|
{
|
|
3248
3496
|
type: "button",
|
|
@@ -3255,12 +3503,12 @@ var DateField = ({
|
|
|
3255
3503
|
},
|
|
3256
3504
|
"aria-label": "Pick date"
|
|
3257
3505
|
},
|
|
3258
|
-
/* @__PURE__ */
|
|
3506
|
+
/* @__PURE__ */ import_react21.default.createElement(CalendarIcon, null)
|
|
3259
3507
|
)),
|
|
3260
|
-
label && /* @__PURE__ */
|
|
3261
|
-
variant === "outlined" && /* @__PURE__ */
|
|
3262
|
-
), open && !disabled && (0,
|
|
3263
|
-
/* @__PURE__ */
|
|
3508
|
+
label && /* @__PURE__ */ import_react21.default.createElement("label", { htmlFor: inputId, className: "rf-text-field__label" }, label, " ", required && /* @__PURE__ */ import_react21.default.createElement("span", { className: "rf-text-field__asterisk" }, "*")),
|
|
3509
|
+
variant === "outlined" && /* @__PURE__ */ import_react21.default.createElement("fieldset", { className: "rf-text-field__notch" }, label && /* @__PURE__ */ import_react21.default.createElement("legend", { className: "rf-text-field__legend" }, /* @__PURE__ */ import_react21.default.createElement("span", null, label, required ? " *" : "")))
|
|
3510
|
+
), open && !disabled && (0, import_react_dom4.createPortal)(
|
|
3511
|
+
/* @__PURE__ */ import_react21.default.createElement(
|
|
3264
3512
|
"div",
|
|
3265
3513
|
{
|
|
3266
3514
|
ref: pickerRef,
|
|
@@ -3285,7 +3533,7 @@ var DateField = ({
|
|
|
3285
3533
|
})(),
|
|
3286
3534
|
onMouseDown: (e) => e.preventDefault()
|
|
3287
3535
|
},
|
|
3288
|
-
/* @__PURE__ */
|
|
3536
|
+
/* @__PURE__ */ import_react21.default.createElement("div", { className: isSideVariant ? "rf-date-picker__cal-col" : void 0 }, /* @__PURE__ */ import_react21.default.createElement(
|
|
3289
3537
|
CalendarBody,
|
|
3290
3538
|
{
|
|
3291
3539
|
viewMonth,
|
|
@@ -3299,7 +3547,7 @@ var DateField = ({
|
|
|
3299
3547
|
onMonthSelect: setViewMonth,
|
|
3300
3548
|
onYearSelect: setViewYear
|
|
3301
3549
|
}
|
|
3302
|
-
), type === "datetime" && /* @__PURE__ */
|
|
3550
|
+
), type === "datetime" && /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__time-section" }, /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__time-label" }, "Time"), /* @__PURE__ */ import_react21.default.createElement(
|
|
3303
3551
|
SpinnerPanel,
|
|
3304
3552
|
{
|
|
3305
3553
|
hour,
|
|
@@ -3311,8 +3559,8 @@ var DateField = ({
|
|
|
3311
3559
|
onMinuteInput: handleMinuteInput,
|
|
3312
3560
|
onAmpmToggle: handleAmpmToggle
|
|
3313
3561
|
}
|
|
3314
|
-
)), /* @__PURE__ */
|
|
3315
|
-
type === "datetime-side" && /* @__PURE__ */
|
|
3562
|
+
)), /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__divider" }), /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__footer" }, /* @__PURE__ */ import_react21.default.createElement("button", { type: "button", className: "rf-date-picker__footer-btn", onClick: handleToday }, "Today"), /* @__PURE__ */ import_react21.default.createElement("button", { type: "button", className: "rf-date-picker__footer-btn rf-date-picker__footer-btn--clear", onClick: handleClear }, "Clear"))),
|
|
3563
|
+
type === "datetime-side" && /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__side-panel" }, /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__side-label" }, "Time"), /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__side-spinner" }, /* @__PURE__ */ import_react21.default.createElement(
|
|
3316
3564
|
SpinnerPanel,
|
|
3317
3565
|
{
|
|
3318
3566
|
hour,
|
|
@@ -3324,22 +3572,22 @@ var DateField = ({
|
|
|
3324
3572
|
onMinuteInput: handleMinuteInput,
|
|
3325
3573
|
onAmpmToggle: handleAmpmToggle
|
|
3326
3574
|
}
|
|
3327
|
-
)), /* @__PURE__ */
|
|
3328
|
-
type === "datetime-scroll" && /* @__PURE__ */
|
|
3575
|
+
)), /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__side-time-display" }, String(hour).padStart(2, "0"), ":", String(minute).padStart(2, "0"), " ", ampm)),
|
|
3576
|
+
type === "datetime-scroll" && /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__side-panel" }, /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__side-label" }, "Time"), /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-timescroll" }, /* @__PURE__ */ import_react21.default.createElement(
|
|
3329
3577
|
ScrollColumn,
|
|
3330
3578
|
{
|
|
3331
3579
|
items: HOURS,
|
|
3332
3580
|
selected: hour - 1,
|
|
3333
3581
|
onSelect: handleScrollHour
|
|
3334
3582
|
}
|
|
3335
|
-
), /* @__PURE__ */
|
|
3583
|
+
), /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-timescroll__colon" }, ":"), /* @__PURE__ */ import_react21.default.createElement(
|
|
3336
3584
|
ScrollColumn,
|
|
3337
3585
|
{
|
|
3338
3586
|
items: MINUTES,
|
|
3339
3587
|
selected: minute,
|
|
3340
3588
|
onSelect: handleScrollMinute
|
|
3341
3589
|
}
|
|
3342
|
-
), /* @__PURE__ */
|
|
3590
|
+
), /* @__PURE__ */ import_react21.default.createElement(
|
|
3343
3591
|
ScrollColumn,
|
|
3344
3592
|
{
|
|
3345
3593
|
items: AMPMS,
|
|
@@ -3347,15 +3595,15 @@ var DateField = ({
|
|
|
3347
3595
|
onSelect: handleScrollAmpm,
|
|
3348
3596
|
infinite: false
|
|
3349
3597
|
}
|
|
3350
|
-
)), /* @__PURE__ */
|
|
3598
|
+
)), /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-date-picker__side-time-display" }, String(hour).padStart(2, "0"), ":", String(minute).padStart(2, "0"), " ", ampm))
|
|
3351
3599
|
),
|
|
3352
3600
|
document.body
|
|
3353
|
-
)), helperText && /* @__PURE__ */
|
|
3601
|
+
)), helperText && /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-text-field__helper-text" }, helperText));
|
|
3354
3602
|
};
|
|
3355
3603
|
DateField.displayName = "DateField";
|
|
3356
3604
|
|
|
3357
3605
|
// lib/TextFields/DateRangeField.tsx
|
|
3358
|
-
var
|
|
3606
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
3359
3607
|
var WEEKDAYS2 = ["SU", "MO", "TU", "WE", "TH", "FR", "SA"];
|
|
3360
3608
|
var MONTHS2 = [
|
|
3361
3609
|
"January",
|
|
@@ -3480,7 +3728,7 @@ var detectPreset = (start, end) => {
|
|
|
3480
3728
|
if (isSameDay2(start, new Date(2e3, 0, 1)) && isSameDay2(end, today2)) return "all";
|
|
3481
3729
|
return null;
|
|
3482
3730
|
};
|
|
3483
|
-
var CalendarIcon2 = () => /* @__PURE__ */
|
|
3731
|
+
var CalendarIcon2 = () => /* @__PURE__ */ import_react22.default.createElement("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ import_react22.default.createElement("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }), /* @__PURE__ */ import_react22.default.createElement("line", { x1: "16", y1: "2", x2: "16", y2: "6" }), /* @__PURE__ */ import_react22.default.createElement("line", { x1: "8", y1: "2", x2: "8", y2: "6" }), /* @__PURE__ */ import_react22.default.createElement("line", { x1: "3", y1: "10", x2: "21", y2: "10" }));
|
|
3484
3732
|
var RangeCalendarBody = ({
|
|
3485
3733
|
viewYear,
|
|
3486
3734
|
viewMonth,
|
|
@@ -3505,7 +3753,7 @@ var RangeCalendarBody = ({
|
|
|
3505
3753
|
const hasRange = startDate != null && effectiveEnd != null && !isSameDay2(startDate, effectiveEnd);
|
|
3506
3754
|
const lo = startDate && effectiveEnd ? startDate <= effectiveEnd ? startDate : effectiveEnd : null;
|
|
3507
3755
|
const hi = startDate && effectiveEnd ? startDate <= effectiveEnd ? effectiveEnd : startDate : null;
|
|
3508
|
-
return /* @__PURE__ */
|
|
3756
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-calendar" }, /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-calendar__header" }, /* @__PURE__ */ import_react22.default.createElement(
|
|
3509
3757
|
"button",
|
|
3510
3758
|
{
|
|
3511
3759
|
type: "button",
|
|
@@ -3515,7 +3763,7 @@ var RangeCalendarBody = ({
|
|
|
3515
3763
|
"aria-label": "Previous month"
|
|
3516
3764
|
},
|
|
3517
3765
|
"\u2039"
|
|
3518
|
-
), /* @__PURE__ */
|
|
3766
|
+
), /* @__PURE__ */ import_react22.default.createElement("span", { className: "rf-dr-calendar__month-label" }, MONTHS2[viewMonth], " ", viewYear), /* @__PURE__ */ import_react22.default.createElement(
|
|
3519
3767
|
"button",
|
|
3520
3768
|
{
|
|
3521
3769
|
type: "button",
|
|
@@ -3525,9 +3773,9 @@ var RangeCalendarBody = ({
|
|
|
3525
3773
|
"aria-label": "Next month"
|
|
3526
3774
|
},
|
|
3527
3775
|
"\u203A"
|
|
3528
|
-
)), /* @__PURE__ */
|
|
3776
|
+
)), /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-calendar__weekdays" }, WEEKDAYS2.map((w) => /* @__PURE__ */ import_react22.default.createElement("div", { key: w, className: "rf-dr-calendar__weekday" }, w))), /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-calendar__grid" }, dayCells.map((day, idx) => {
|
|
3529
3777
|
if (day === null) {
|
|
3530
|
-
return /* @__PURE__ */
|
|
3778
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", { key: `e-${idx}`, className: "rf-dr-calendar__cell rf-dr-calendar__cell--empty" });
|
|
3531
3779
|
}
|
|
3532
3780
|
const cellDate = new Date(viewYear, viewMonth, day);
|
|
3533
3781
|
const isStart = startDate ? isSameDay2(cellDate, startDate) : false;
|
|
@@ -3547,7 +3795,7 @@ var RangeCalendarBody = ({
|
|
|
3547
3795
|
isStart || isEnd ? "rf-dr-calendar__day--selected" : "",
|
|
3548
3796
|
isToday && !isStart && !isEnd ? "rf-dr-calendar__day--today" : ""
|
|
3549
3797
|
].filter(Boolean).join(" ");
|
|
3550
|
-
return /* @__PURE__ */
|
|
3798
|
+
return /* @__PURE__ */ import_react22.default.createElement(
|
|
3551
3799
|
"div",
|
|
3552
3800
|
{
|
|
3553
3801
|
key: day,
|
|
@@ -3555,7 +3803,7 @@ var RangeCalendarBody = ({
|
|
|
3555
3803
|
onMouseEnter: () => onDayHover(cellDate),
|
|
3556
3804
|
onMouseLeave: () => onDayHover(null)
|
|
3557
3805
|
},
|
|
3558
|
-
/* @__PURE__ */
|
|
3806
|
+
/* @__PURE__ */ import_react22.default.createElement(
|
|
3559
3807
|
"button",
|
|
3560
3808
|
{
|
|
3561
3809
|
type: "button",
|
|
@@ -3569,8 +3817,8 @@ var RangeCalendarBody = ({
|
|
|
3569
3817
|
};
|
|
3570
3818
|
var MiniCalendar = ({ selectedDate, todayDate, onSelect, onClose }) => {
|
|
3571
3819
|
const init = selectedDate ?? todayDate;
|
|
3572
|
-
const [viewYear, setViewYear] = (0,
|
|
3573
|
-
const [viewMonth, setViewMonth] = (0,
|
|
3820
|
+
const [viewYear, setViewYear] = (0, import_react22.useState)(init.getFullYear());
|
|
3821
|
+
const [viewMonth, setViewMonth] = (0, import_react22.useState)(init.getMonth());
|
|
3574
3822
|
const firstDay = new Date(viewYear, viewMonth, 1).getDay();
|
|
3575
3823
|
const daysInMonth = new Date(viewYear, viewMonth + 1, 0).getDate();
|
|
3576
3824
|
const dayCells = [
|
|
@@ -3589,14 +3837,14 @@ var MiniCalendar = ({ selectedDate, todayDate, onSelect, onClose }) => {
|
|
|
3589
3837
|
setViewYear((y) => y + 1);
|
|
3590
3838
|
} else setViewMonth((m) => m + 1);
|
|
3591
3839
|
};
|
|
3592
|
-
return /* @__PURE__ */
|
|
3840
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-mini-cal" }, /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-mini-cal__header" }, /* @__PURE__ */ import_react22.default.createElement("button", { type: "button", className: "rf-dr-calendar__nav-btn", onClick: prevMonth }, "\u2039"), /* @__PURE__ */ import_react22.default.createElement("span", { className: "rf-dr-calendar__month-label", style: { fontSize: "0.88rem" } }, MONTHS2[viewMonth], " ", viewYear), /* @__PURE__ */ import_react22.default.createElement("button", { type: "button", className: "rf-dr-calendar__nav-btn", onClick: nextMonth }, "\u203A")), /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-calendar__weekdays" }, WEEKDAYS2.map((w) => /* @__PURE__ */ import_react22.default.createElement("div", { key: w, className: "rf-dr-calendar__weekday" }, w))), /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-calendar__grid" }, dayCells.map((day, idx) => {
|
|
3593
3841
|
if (day === null) {
|
|
3594
|
-
return /* @__PURE__ */
|
|
3842
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", { key: `e-${idx}`, className: "rf-dr-calendar__cell rf-dr-calendar__cell--empty" });
|
|
3595
3843
|
}
|
|
3596
3844
|
const cellDate = new Date(viewYear, viewMonth, day);
|
|
3597
3845
|
const isSel = selectedDate ? isSameDay2(cellDate, selectedDate) : false;
|
|
3598
3846
|
const isToday = isSameDay2(cellDate, todayDate);
|
|
3599
|
-
return /* @__PURE__ */
|
|
3847
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", { key: day, className: "rf-dr-calendar__cell" }, /* @__PURE__ */ import_react22.default.createElement(
|
|
3600
3848
|
"button",
|
|
3601
3849
|
{
|
|
3602
3850
|
type: "button",
|
|
@@ -3635,22 +3883,22 @@ var DateRangeField = ({
|
|
|
3635
3883
|
const today2 = todayFn();
|
|
3636
3884
|
const committedStart = value?.start ? isoToDate2(value.start) : null;
|
|
3637
3885
|
const committedEnd = value?.end ? isoToDate2(value.end) : null;
|
|
3638
|
-
const [open, setOpen] = (0,
|
|
3639
|
-
const [draftStart, setDraftStart] = (0,
|
|
3640
|
-
const [draftEnd, setDraftEnd] = (0,
|
|
3641
|
-
const [activePreset, setActivePreset] = (0,
|
|
3886
|
+
const [open, setOpen] = (0, import_react22.useState)(false);
|
|
3887
|
+
const [draftStart, setDraftStart] = (0, import_react22.useState)(committedStart);
|
|
3888
|
+
const [draftEnd, setDraftEnd] = (0, import_react22.useState)(committedEnd);
|
|
3889
|
+
const [activePreset, setActivePreset] = (0, import_react22.useState)(
|
|
3642
3890
|
() => detectPreset(committedStart, committedEnd)
|
|
3643
3891
|
);
|
|
3644
|
-
const [startInputStr, setStartInputStr] = (0,
|
|
3645
|
-
const [endInputStr, setEndInputStr] = (0,
|
|
3646
|
-
const [inlineCal, setInlineCal] = (0,
|
|
3647
|
-
const [hoverDate, setHoverDate] = (0,
|
|
3648
|
-
const [selecting, setSelecting] = (0,
|
|
3649
|
-
const [leftViewYear, setLeftViewYear] = (0,
|
|
3650
|
-
const [leftViewMonth, setLeftViewMonth] = (0,
|
|
3651
|
-
const containerRef = (0,
|
|
3652
|
-
const inputId = (0,
|
|
3653
|
-
(0,
|
|
3892
|
+
const [startInputStr, setStartInputStr] = (0, import_react22.useState)(() => committedStart ? formatShort(committedStart) : "");
|
|
3893
|
+
const [endInputStr, setEndInputStr] = (0, import_react22.useState)(() => committedEnd ? formatShort(committedEnd) : "");
|
|
3894
|
+
const [inlineCal, setInlineCal] = (0, import_react22.useState)(null);
|
|
3895
|
+
const [hoverDate, setHoverDate] = (0, import_react22.useState)(null);
|
|
3896
|
+
const [selecting, setSelecting] = (0, import_react22.useState)("start");
|
|
3897
|
+
const [leftViewYear, setLeftViewYear] = (0, import_react22.useState)(() => today2.getFullYear());
|
|
3898
|
+
const [leftViewMonth, setLeftViewMonth] = (0, import_react22.useState)(() => today2.getMonth());
|
|
3899
|
+
const containerRef = (0, import_react22.useRef)(null);
|
|
3900
|
+
const inputId = (0, import_react22.useRef)(`rf-dr-${Math.random().toString(36).substr(2, 9)}`).current;
|
|
3901
|
+
(0, import_react22.useEffect)(() => {
|
|
3654
3902
|
const s2 = value?.start ? isoToDate2(value.start) : null;
|
|
3655
3903
|
const e = value?.end ? isoToDate2(value.end) : null;
|
|
3656
3904
|
setDraftStart(s2);
|
|
@@ -3659,10 +3907,10 @@ var DateRangeField = ({
|
|
|
3659
3907
|
setEndInputStr(e ? formatShort(e) : "");
|
|
3660
3908
|
setActivePreset(detectPreset(s2, e));
|
|
3661
3909
|
}, [value?.start, value?.end]);
|
|
3662
|
-
(0,
|
|
3910
|
+
(0, import_react22.useEffect)(() => {
|
|
3663
3911
|
setActivePreset(detectPreset(draftStart, draftEnd));
|
|
3664
3912
|
}, [draftStart?.getTime(), draftEnd?.getTime()]);
|
|
3665
|
-
(0,
|
|
3913
|
+
(0, import_react22.useEffect)(() => {
|
|
3666
3914
|
if (!open) return;
|
|
3667
3915
|
const handler = (e) => {
|
|
3668
3916
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -3804,7 +4052,7 @@ var DateRangeField = ({
|
|
|
3804
4052
|
className
|
|
3805
4053
|
].filter(Boolean).join(" ");
|
|
3806
4054
|
const inputPlaceholder = variant === "outlined" ? " " : void 0;
|
|
3807
|
-
return /* @__PURE__ */
|
|
4055
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", { ref: containerRef, className: rootClasses, style }, /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-date-field__anchor" }, /* @__PURE__ */ import_react22.default.createElement(
|
|
3808
4056
|
"div",
|
|
3809
4057
|
{
|
|
3810
4058
|
className: "rf-text-field__wrapper",
|
|
@@ -3813,7 +4061,7 @@ var DateRangeField = ({
|
|
|
3813
4061
|
},
|
|
3814
4062
|
style: { cursor: disabled ? "default" : "pointer" }
|
|
3815
4063
|
},
|
|
3816
|
-
/* @__PURE__ */
|
|
4064
|
+
/* @__PURE__ */ import_react22.default.createElement(
|
|
3817
4065
|
"input",
|
|
3818
4066
|
{
|
|
3819
4067
|
id: inputId,
|
|
@@ -3829,7 +4077,7 @@ var DateRangeField = ({
|
|
|
3829
4077
|
}
|
|
3830
4078
|
}
|
|
3831
4079
|
),
|
|
3832
|
-
/* @__PURE__ */
|
|
4080
|
+
/* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-text-field__adornment rf-text-field__adornment--end" }, /* @__PURE__ */ import_react22.default.createElement(
|
|
3833
4081
|
"button",
|
|
3834
4082
|
{
|
|
3835
4083
|
type: "button",
|
|
@@ -3842,13 +4090,13 @@ var DateRangeField = ({
|
|
|
3842
4090
|
},
|
|
3843
4091
|
"aria-label": "Pick date range"
|
|
3844
4092
|
},
|
|
3845
|
-
/* @__PURE__ */
|
|
4093
|
+
/* @__PURE__ */ import_react22.default.createElement(CalendarIcon2, null)
|
|
3846
4094
|
)),
|
|
3847
|
-
label && /* @__PURE__ */
|
|
3848
|
-
variant === "outlined" && /* @__PURE__ */
|
|
4095
|
+
label && /* @__PURE__ */ import_react22.default.createElement("label", { htmlFor: inputId, className: "rf-text-field__label" }, label, " ", required && /* @__PURE__ */ import_react22.default.createElement("span", { className: "rf-text-field__asterisk" }, "*")),
|
|
4096
|
+
variant === "outlined" && /* @__PURE__ */ import_react22.default.createElement("fieldset", { className: "rf-text-field__notch" }, label ? /* @__PURE__ */ import_react22.default.createElement("legend", { className: "rf-text-field__legend" }, /* @__PURE__ */ import_react22.default.createElement("span", null, label, required ? " *" : "")) : /* @__PURE__ */ import_react22.default.createElement("legend", { className: "rf-text-field__legend--empty" }))
|
|
3849
4097
|
), open && !disabled && (pickerType === "panel" ? (
|
|
3850
4098
|
/* ── Panel Mode ── */
|
|
3851
|
-
/* @__PURE__ */
|
|
4099
|
+
/* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker rf-dr-picker--panel", onMouseDown: (e) => e.preventDefault() }, /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker__presets" }, PRESETS.map((p, i) => /* @__PURE__ */ import_react22.default.createElement(import_react22.default.Fragment, { key: p.id }, i > 0 && /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker__preset-sep" }), /* @__PURE__ */ import_react22.default.createElement(
|
|
3852
4100
|
"button",
|
|
3853
4101
|
{
|
|
3854
4102
|
type: "button",
|
|
@@ -3859,7 +4107,7 @@ var DateRangeField = ({
|
|
|
3859
4107
|
onClick: () => handlePreset(p.id)
|
|
3860
4108
|
},
|
|
3861
4109
|
p.label
|
|
3862
|
-
)))), /* @__PURE__ */
|
|
4110
|
+
)))), /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker__manual" }, /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker__date-field-wrap" }, /* @__PURE__ */ import_react22.default.createElement(
|
|
3863
4111
|
"div",
|
|
3864
4112
|
{
|
|
3865
4113
|
className: [
|
|
@@ -3867,8 +4115,8 @@ var DateRangeField = ({
|
|
|
3867
4115
|
inlineCal === "start" ? "rf-dr-picker__date-field--active" : ""
|
|
3868
4116
|
].filter(Boolean).join(" ")
|
|
3869
4117
|
},
|
|
3870
|
-
/* @__PURE__ */
|
|
3871
|
-
/* @__PURE__ */
|
|
4118
|
+
/* @__PURE__ */ import_react22.default.createElement("span", { className: "rf-dr-picker__date-floating-label" }, "Start Date"),
|
|
4119
|
+
/* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker__date-display" }, /* @__PURE__ */ import_react22.default.createElement(
|
|
3872
4120
|
"input",
|
|
3873
4121
|
{
|
|
3874
4122
|
type: "text",
|
|
@@ -3879,7 +4127,7 @@ var DateRangeField = ({
|
|
|
3879
4127
|
onBlur: handleStartInputBlur,
|
|
3880
4128
|
onMouseDown: (e) => e.stopPropagation()
|
|
3881
4129
|
}
|
|
3882
|
-
), /* @__PURE__ */
|
|
4130
|
+
), /* @__PURE__ */ import_react22.default.createElement(
|
|
3883
4131
|
"button",
|
|
3884
4132
|
{
|
|
3885
4133
|
type: "button",
|
|
@@ -3888,9 +4136,9 @@ var DateRangeField = ({
|
|
|
3888
4136
|
onClick: () => setInlineCal((v) => v === "start" ? null : "start"),
|
|
3889
4137
|
"aria-label": "Pick start date"
|
|
3890
4138
|
},
|
|
3891
|
-
/* @__PURE__ */
|
|
4139
|
+
/* @__PURE__ */ import_react22.default.createElement(CalendarIcon2, null)
|
|
3892
4140
|
))
|
|
3893
|
-
), inlineCal === "start" && /* @__PURE__ */
|
|
4141
|
+
), inlineCal === "start" && /* @__PURE__ */ import_react22.default.createElement(
|
|
3894
4142
|
MiniCalendar,
|
|
3895
4143
|
{
|
|
3896
4144
|
selectedDate: draftStart,
|
|
@@ -3901,7 +4149,7 @@ var DateRangeField = ({
|
|
|
3901
4149
|
},
|
|
3902
4150
|
onClose: () => setInlineCal(null)
|
|
3903
4151
|
}
|
|
3904
|
-
)), /* @__PURE__ */
|
|
4152
|
+
)), /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker__date-field-wrap" }, /* @__PURE__ */ import_react22.default.createElement(
|
|
3905
4153
|
"div",
|
|
3906
4154
|
{
|
|
3907
4155
|
className: [
|
|
@@ -3909,8 +4157,8 @@ var DateRangeField = ({
|
|
|
3909
4157
|
inlineCal === "end" ? "rf-dr-picker__date-field--active" : ""
|
|
3910
4158
|
].filter(Boolean).join(" ")
|
|
3911
4159
|
},
|
|
3912
|
-
/* @__PURE__ */
|
|
3913
|
-
/* @__PURE__ */
|
|
4160
|
+
/* @__PURE__ */ import_react22.default.createElement("span", { className: "rf-dr-picker__date-floating-label" }, "End Date"),
|
|
4161
|
+
/* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker__date-display" }, /* @__PURE__ */ import_react22.default.createElement(
|
|
3914
4162
|
"input",
|
|
3915
4163
|
{
|
|
3916
4164
|
type: "text",
|
|
@@ -3921,7 +4169,7 @@ var DateRangeField = ({
|
|
|
3921
4169
|
onBlur: handleEndInputBlur,
|
|
3922
4170
|
onMouseDown: (e) => e.stopPropagation()
|
|
3923
4171
|
}
|
|
3924
|
-
), /* @__PURE__ */
|
|
4172
|
+
), /* @__PURE__ */ import_react22.default.createElement(
|
|
3925
4173
|
"button",
|
|
3926
4174
|
{
|
|
3927
4175
|
type: "button",
|
|
@@ -3930,9 +4178,9 @@ var DateRangeField = ({
|
|
|
3930
4178
|
onClick: () => setInlineCal((v) => v === "end" ? null : "end"),
|
|
3931
4179
|
"aria-label": "Pick end date"
|
|
3932
4180
|
},
|
|
3933
|
-
/* @__PURE__ */
|
|
4181
|
+
/* @__PURE__ */ import_react22.default.createElement(CalendarIcon2, null)
|
|
3934
4182
|
))
|
|
3935
|
-
), inlineCal === "end" && /* @__PURE__ */
|
|
4183
|
+
), inlineCal === "end" && /* @__PURE__ */ import_react22.default.createElement(
|
|
3936
4184
|
MiniCalendar,
|
|
3937
4185
|
{
|
|
3938
4186
|
selectedDate: draftEnd,
|
|
@@ -3943,7 +4191,7 @@ var DateRangeField = ({
|
|
|
3943
4191
|
},
|
|
3944
4192
|
onClose: () => setInlineCal(null)
|
|
3945
4193
|
}
|
|
3946
|
-
)), !inlineCal && /* @__PURE__ */
|
|
4194
|
+
)), !inlineCal && /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker__days-section" }, /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker__days-row" }, /* @__PURE__ */ import_react22.default.createElement("span", { className: "rf-dr-picker__days-label" }, "Days until today"), /* @__PURE__ */ import_react22.default.createElement(
|
|
3947
4195
|
"input",
|
|
3948
4196
|
{
|
|
3949
4197
|
type: "number",
|
|
@@ -3954,7 +4202,7 @@ var DateRangeField = ({
|
|
|
3954
4202
|
onMouseDown: (e) => e.stopPropagation(),
|
|
3955
4203
|
placeholder: "\u2014"
|
|
3956
4204
|
}
|
|
3957
|
-
)), /* @__PURE__ */
|
|
4205
|
+
)), /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker__days-row" }, /* @__PURE__ */ import_react22.default.createElement("span", { className: "rf-dr-picker__days-label" }, "Days from today"), /* @__PURE__ */ import_react22.default.createElement(
|
|
3958
4206
|
"input",
|
|
3959
4207
|
{
|
|
3960
4208
|
type: "number",
|
|
@@ -3965,10 +4213,10 @@ var DateRangeField = ({
|
|
|
3965
4213
|
onMouseDown: (e) => e.stopPropagation(),
|
|
3966
4214
|
placeholder: "\u2014"
|
|
3967
4215
|
}
|
|
3968
|
-
))), /* @__PURE__ */
|
|
4216
|
+
))), /* @__PURE__ */ import_react22.default.createElement("div", { style: { flex: 1 } }), /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker__footer" }, /* @__PURE__ */ import_react22.default.createElement("button", { type: "button", className: "rf-dr-picker__close-btn", onClick: handleClose }, "CLOSE"), /* @__PURE__ */ import_react22.default.createElement("button", { type: "button", className: "rf-dr-picker__apply-btn", onClick: handleApply }, "APPLY"))))
|
|
3969
4217
|
) : (
|
|
3970
4218
|
/* ── Calendar Mode ── */
|
|
3971
|
-
/* @__PURE__ */
|
|
4219
|
+
/* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker rf-dr-picker--calendar", onMouseDown: (e) => e.preventDefault() }, /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker__calendars" }, /* @__PURE__ */ import_react22.default.createElement(
|
|
3972
4220
|
RangeCalendarBody,
|
|
3973
4221
|
{
|
|
3974
4222
|
viewYear: leftViewYear,
|
|
@@ -3983,7 +4231,7 @@ var DateRangeField = ({
|
|
|
3983
4231
|
onNext: nextMonth,
|
|
3984
4232
|
showNext: false
|
|
3985
4233
|
}
|
|
3986
|
-
), /* @__PURE__ */
|
|
4234
|
+
), /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker__cal-col-divider" }), /* @__PURE__ */ import_react22.default.createElement(
|
|
3987
4235
|
RangeCalendarBody,
|
|
3988
4236
|
{
|
|
3989
4237
|
viewYear: rightViewYear,
|
|
@@ -3998,19 +4246,19 @@ var DateRangeField = ({
|
|
|
3998
4246
|
onNext: nextMonth,
|
|
3999
4247
|
showPrev: false
|
|
4000
4248
|
}
|
|
4001
|
-
)), selecting === "end" && draftStart && /* @__PURE__ */
|
|
4002
|
-
))), helperText && /* @__PURE__ */
|
|
4249
|
+
)), selecting === "end" && draftStart && /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker__cal-hint" }, /* @__PURE__ */ import_react22.default.createElement("span", { className: "rf-dr-picker__cal-hint-dot" }), /* @__PURE__ */ import_react22.default.createElement("span", null, "Select end date \xB7 started from ", /* @__PURE__ */ import_react22.default.createElement("strong", null, formatShort(draftStart)))), /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker__divider" }), /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker__cal-footer" }, draftStart && draftEnd && /* @__PURE__ */ import_react22.default.createElement("span", { className: "rf-dr-picker__cal-range-label" }, formatShort(draftStart <= draftEnd ? draftStart : draftEnd), " \u2013 ", formatShort(draftStart <= draftEnd ? draftEnd : draftStart), /* @__PURE__ */ import_react22.default.createElement("span", { className: "rf-dr-picker__cal-range-days" }, " ", "(", Math.abs(daysBetween(draftStart, draftEnd)) + 1, " days)")), /* @__PURE__ */ import_react22.default.createElement("div", { style: { flex: 1 } }), /* @__PURE__ */ import_react22.default.createElement("button", { type: "button", className: "rf-dr-picker__close-btn", onClick: handleClose }, "CLOSE"), /* @__PURE__ */ import_react22.default.createElement("button", { type: "button", className: "rf-dr-picker__apply-btn", onClick: handleApply }, "APPLY")))
|
|
4250
|
+
))), helperText && /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-text-field__helper-text" }, helperText));
|
|
4003
4251
|
};
|
|
4004
4252
|
DateRangeField.displayName = "DateRangeField";
|
|
4005
4253
|
|
|
4006
4254
|
// lib/Progress/RufousLogoLoader.tsx
|
|
4007
|
-
var
|
|
4255
|
+
var React74 = __toESM(require("react"), 1);
|
|
4008
4256
|
var _uid = 0;
|
|
4009
4257
|
var RufousLogoLoader = ({ size = 80, sx, className }) => {
|
|
4010
|
-
const clipId =
|
|
4258
|
+
const clipId = React74.useRef(`rll-${++_uid}`).current;
|
|
4011
4259
|
const height = size * (38.795 / 54.585);
|
|
4012
4260
|
const sxClass = useSx(sx);
|
|
4013
|
-
return /* @__PURE__ */
|
|
4261
|
+
return /* @__PURE__ */ React74.createElement("div", { className: ["rufous-logo-loader", sxClass, className].filter(Boolean).join(" "), style: { width: size, height } }, /* @__PURE__ */ React74.createElement(
|
|
4014
4262
|
"svg",
|
|
4015
4263
|
{
|
|
4016
4264
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -4019,247 +4267,20 @@ var RufousLogoLoader = ({ size = 80, sx, className }) => {
|
|
|
4019
4267
|
height,
|
|
4020
4268
|
className: "rufous-logo-loader__svg"
|
|
4021
4269
|
},
|
|
4022
|
-
/* @__PURE__ */
|
|
4270
|
+
/* @__PURE__ */ React74.createElement("defs", null, /* @__PURE__ */ React74.createElement("clipPath", { id: clipId }, /* @__PURE__ */ React74.createElement(
|
|
4023
4271
|
"path",
|
|
4024
4272
|
{
|
|
4025
4273
|
transform: "translate(2208 18.205)",
|
|
4026
4274
|
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"
|
|
4027
4275
|
}
|
|
4028
4276
|
))),
|
|
4029
|
-
/* @__PURE__ */
|
|
4277
|
+
/* @__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" })))
|
|
4030
4278
|
));
|
|
4031
4279
|
};
|
|
4032
4280
|
|
|
4033
4281
|
// lib/DataGrid/DataGrid.tsx
|
|
4034
4282
|
var import_react23 = __toESM(require("react"), 1);
|
|
4035
4283
|
var import_lucide_react2 = require("lucide-react");
|
|
4036
|
-
|
|
4037
|
-
// lib/Tooltip/Tooltip.tsx
|
|
4038
|
-
var import_react22 = __toESM(require("react"), 1);
|
|
4039
|
-
var import_react_dom4 = __toESM(require("react-dom"), 1);
|
|
4040
|
-
var GAP = 8;
|
|
4041
|
-
function computePosition(anchor, tooltip, placement) {
|
|
4042
|
-
const { top: aTop, left: aLeft, width: aW, height: aH } = anchor;
|
|
4043
|
-
const { width: tW, height: tH } = tooltip;
|
|
4044
|
-
let top = 0;
|
|
4045
|
-
let left = 0;
|
|
4046
|
-
let arrowLeft;
|
|
4047
|
-
let arrowTop;
|
|
4048
|
-
switch (placement) {
|
|
4049
|
-
case "top":
|
|
4050
|
-
top = aTop - tH - GAP;
|
|
4051
|
-
left = aLeft + aW / 2 - tW / 2;
|
|
4052
|
-
arrowLeft = tW / 2 - 4;
|
|
4053
|
-
break;
|
|
4054
|
-
case "top-start":
|
|
4055
|
-
top = aTop - tH - GAP;
|
|
4056
|
-
left = aLeft;
|
|
4057
|
-
arrowLeft = Math.min(aW / 2, tW - 16);
|
|
4058
|
-
break;
|
|
4059
|
-
case "top-end":
|
|
4060
|
-
top = aTop - tH - GAP;
|
|
4061
|
-
left = aLeft + aW - tW;
|
|
4062
|
-
arrowLeft = Math.max(tW - aW / 2 - 4, 8);
|
|
4063
|
-
break;
|
|
4064
|
-
case "bottom":
|
|
4065
|
-
top = aTop + aH + GAP;
|
|
4066
|
-
left = aLeft + aW / 2 - tW / 2;
|
|
4067
|
-
arrowLeft = tW / 2 - 4;
|
|
4068
|
-
break;
|
|
4069
|
-
case "bottom-start":
|
|
4070
|
-
top = aTop + aH + GAP;
|
|
4071
|
-
left = aLeft;
|
|
4072
|
-
arrowLeft = Math.min(aW / 2, tW - 16);
|
|
4073
|
-
break;
|
|
4074
|
-
case "bottom-end":
|
|
4075
|
-
top = aTop + aH + GAP;
|
|
4076
|
-
left = aLeft + aW - tW;
|
|
4077
|
-
arrowLeft = Math.max(tW - aW / 2 - 4, 8);
|
|
4078
|
-
break;
|
|
4079
|
-
case "left":
|
|
4080
|
-
top = aTop + aH / 2 - tH / 2;
|
|
4081
|
-
left = aLeft - tW - GAP;
|
|
4082
|
-
arrowTop = tH / 2 - 4;
|
|
4083
|
-
break;
|
|
4084
|
-
case "left-start":
|
|
4085
|
-
top = aTop;
|
|
4086
|
-
left = aLeft - tW - GAP;
|
|
4087
|
-
arrowTop = Math.min(aH / 2, tH - 16);
|
|
4088
|
-
break;
|
|
4089
|
-
case "left-end":
|
|
4090
|
-
top = aTop + aH - tH;
|
|
4091
|
-
left = aLeft - tW - GAP;
|
|
4092
|
-
arrowTop = Math.max(tH - aH / 2 - 4, 8);
|
|
4093
|
-
break;
|
|
4094
|
-
case "right":
|
|
4095
|
-
top = aTop + aH / 2 - tH / 2;
|
|
4096
|
-
left = aLeft + aW + GAP;
|
|
4097
|
-
arrowTop = tH / 2 - 4;
|
|
4098
|
-
break;
|
|
4099
|
-
case "right-start":
|
|
4100
|
-
top = aTop;
|
|
4101
|
-
left = aLeft + aW + GAP;
|
|
4102
|
-
arrowTop = Math.min(aH / 2, tH - 16);
|
|
4103
|
-
break;
|
|
4104
|
-
case "right-end":
|
|
4105
|
-
top = aTop + aH - tH;
|
|
4106
|
-
left = aLeft + aW + GAP;
|
|
4107
|
-
arrowTop = Math.max(tH - aH / 2 - 4, 8);
|
|
4108
|
-
break;
|
|
4109
|
-
default:
|
|
4110
|
-
top = aTop - tH - GAP;
|
|
4111
|
-
left = aLeft + aW / 2 - tW / 2;
|
|
4112
|
-
}
|
|
4113
|
-
const vw = window.innerWidth;
|
|
4114
|
-
const vh = window.innerHeight;
|
|
4115
|
-
left = Math.max(8, Math.min(left, vw - tW - 8));
|
|
4116
|
-
top = Math.max(8, Math.min(top, vh - tH - 8));
|
|
4117
|
-
return { top, left, arrowLeft, arrowTop };
|
|
4118
|
-
}
|
|
4119
|
-
var Tooltip = ({
|
|
4120
|
-
title,
|
|
4121
|
-
placement = "top",
|
|
4122
|
-
arrow = false,
|
|
4123
|
-
open: controlledOpen,
|
|
4124
|
-
disableHoverListener = false,
|
|
4125
|
-
disableFocusListener = false,
|
|
4126
|
-
enterDelay = 100,
|
|
4127
|
-
leaveDelay = 0,
|
|
4128
|
-
children,
|
|
4129
|
-
followCursor = false,
|
|
4130
|
-
className = "",
|
|
4131
|
-
style,
|
|
4132
|
-
sx
|
|
4133
|
-
}) => {
|
|
4134
|
-
const sxClass = useSx(sx);
|
|
4135
|
-
const [internalOpen, setInternalOpen] = (0, import_react22.useState)(false);
|
|
4136
|
-
const [position, setPosition] = (0, import_react22.useState)({ top: 0, left: 0 });
|
|
4137
|
-
const anchorRef = (0, import_react22.useRef)(null);
|
|
4138
|
-
const tooltipRef = (0, import_react22.useRef)(null);
|
|
4139
|
-
const enterTimer = (0, import_react22.useRef)(null);
|
|
4140
|
-
const leaveTimer = (0, import_react22.useRef)(null);
|
|
4141
|
-
const cursorPos = (0, import_react22.useRef)({ x: 0, y: 0 });
|
|
4142
|
-
const isOpen = controlledOpen !== void 0 ? controlledOpen : internalOpen;
|
|
4143
|
-
const clearTimers = (0, import_react22.useCallback)(() => {
|
|
4144
|
-
if (enterTimer.current) clearTimeout(enterTimer.current);
|
|
4145
|
-
if (leaveTimer.current) clearTimeout(leaveTimer.current);
|
|
4146
|
-
}, []);
|
|
4147
|
-
const updatePosition = (0, import_react22.useCallback)(() => {
|
|
4148
|
-
if (!anchorRef.current || !tooltipRef.current) return;
|
|
4149
|
-
const anchorRect = anchorRef.current.getBoundingClientRect();
|
|
4150
|
-
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
4151
|
-
if (followCursor) {
|
|
4152
|
-
const fakeRect = {
|
|
4153
|
-
top: cursorPos.current.y,
|
|
4154
|
-
left: cursorPos.current.x,
|
|
4155
|
-
right: cursorPos.current.x,
|
|
4156
|
-
bottom: cursorPos.current.y,
|
|
4157
|
-
width: 0,
|
|
4158
|
-
height: 0,
|
|
4159
|
-
x: cursorPos.current.x,
|
|
4160
|
-
y: cursorPos.current.y,
|
|
4161
|
-
toJSON: () => ({})
|
|
4162
|
-
};
|
|
4163
|
-
setPosition(computePosition(fakeRect, tooltipRect, placement));
|
|
4164
|
-
} else {
|
|
4165
|
-
setPosition(computePosition(anchorRect, tooltipRect, placement));
|
|
4166
|
-
}
|
|
4167
|
-
}, [placement, followCursor]);
|
|
4168
|
-
(0, import_react22.useEffect)(() => {
|
|
4169
|
-
if (isOpen) {
|
|
4170
|
-
requestAnimationFrame(() => {
|
|
4171
|
-
updatePosition();
|
|
4172
|
-
});
|
|
4173
|
-
}
|
|
4174
|
-
}, [isOpen, updatePosition]);
|
|
4175
|
-
const handleOpen = (0, import_react22.useCallback)(() => {
|
|
4176
|
-
clearTimers();
|
|
4177
|
-
if (enterDelay > 0) {
|
|
4178
|
-
enterTimer.current = setTimeout(() => {
|
|
4179
|
-
setInternalOpen(true);
|
|
4180
|
-
}, enterDelay);
|
|
4181
|
-
} else {
|
|
4182
|
-
setInternalOpen(true);
|
|
4183
|
-
}
|
|
4184
|
-
}, [enterDelay, clearTimers]);
|
|
4185
|
-
const handleClose = (0, import_react22.useCallback)(() => {
|
|
4186
|
-
clearTimers();
|
|
4187
|
-
if (leaveDelay > 0) {
|
|
4188
|
-
leaveTimer.current = setTimeout(() => {
|
|
4189
|
-
setInternalOpen(false);
|
|
4190
|
-
}, leaveDelay);
|
|
4191
|
-
} else {
|
|
4192
|
-
setInternalOpen(false);
|
|
4193
|
-
}
|
|
4194
|
-
}, [leaveDelay, clearTimers]);
|
|
4195
|
-
const handleMouseMove = (0, import_react22.useCallback)(
|
|
4196
|
-
(e) => {
|
|
4197
|
-
cursorPos.current = { x: e.clientX, y: e.clientY };
|
|
4198
|
-
if (isOpen && followCursor) {
|
|
4199
|
-
updatePosition();
|
|
4200
|
-
}
|
|
4201
|
-
},
|
|
4202
|
-
[isOpen, followCursor, updatePosition]
|
|
4203
|
-
);
|
|
4204
|
-
(0, import_react22.useEffect)(() => {
|
|
4205
|
-
return () => clearTimers();
|
|
4206
|
-
}, [clearTimers]);
|
|
4207
|
-
const childProps = {};
|
|
4208
|
-
if (!disableHoverListener) {
|
|
4209
|
-
childProps.onMouseEnter = handleOpen;
|
|
4210
|
-
childProps.onMouseLeave = handleClose;
|
|
4211
|
-
childProps.onMouseMove = followCursor ? handleMouseMove : void 0;
|
|
4212
|
-
}
|
|
4213
|
-
if (!disableFocusListener) {
|
|
4214
|
-
childProps.onFocus = handleOpen;
|
|
4215
|
-
childProps.onBlur = handleClose;
|
|
4216
|
-
}
|
|
4217
|
-
const tooltipClasses = [
|
|
4218
|
-
"rf-tooltip",
|
|
4219
|
-
`rf-tooltip--placement-${placement}`,
|
|
4220
|
-
isOpen ? "rf-tooltip--visible" : "",
|
|
4221
|
-
sxClass,
|
|
4222
|
-
className
|
|
4223
|
-
].filter(Boolean).join(" ");
|
|
4224
|
-
const tooltipElement = /* @__PURE__ */ import_react22.default.createElement(
|
|
4225
|
-
"div",
|
|
4226
|
-
{
|
|
4227
|
-
ref: tooltipRef,
|
|
4228
|
-
className: tooltipClasses,
|
|
4229
|
-
style: {
|
|
4230
|
-
top: position.top,
|
|
4231
|
-
left: position.left,
|
|
4232
|
-
...style
|
|
4233
|
-
},
|
|
4234
|
-
role: "tooltip",
|
|
4235
|
-
"aria-hidden": !isOpen
|
|
4236
|
-
},
|
|
4237
|
-
title,
|
|
4238
|
-
arrow && /* @__PURE__ */ import_react22.default.createElement(
|
|
4239
|
-
"span",
|
|
4240
|
-
{
|
|
4241
|
-
className: "rf-tooltip__arrow",
|
|
4242
|
-
style: {
|
|
4243
|
-
...position.arrowLeft !== void 0 ? { left: position.arrowLeft } : {},
|
|
4244
|
-
...position.arrowTop !== void 0 ? { top: position.arrowTop } : {}
|
|
4245
|
-
}
|
|
4246
|
-
}
|
|
4247
|
-
)
|
|
4248
|
-
);
|
|
4249
|
-
return /* @__PURE__ */ import_react22.default.createElement(import_react22.default.Fragment, null, /* @__PURE__ */ import_react22.default.createElement(
|
|
4250
|
-
"span",
|
|
4251
|
-
{
|
|
4252
|
-
ref: anchorRef,
|
|
4253
|
-
style: { display: "inline-flex", position: "relative" },
|
|
4254
|
-
"aria-describedby": isOpen ? "rf-tooltip" : void 0,
|
|
4255
|
-
...childProps
|
|
4256
|
-
},
|
|
4257
|
-
import_react22.default.cloneElement(children)
|
|
4258
|
-
), import_react_dom4.default.createPortal(tooltipElement, document.body));
|
|
4259
|
-
};
|
|
4260
|
-
Tooltip.displayName = "Tooltip";
|
|
4261
|
-
|
|
4262
|
-
// lib/DataGrid/DataGrid.tsx
|
|
4263
4284
|
var getOperatorsForType = (type) => {
|
|
4264
4285
|
if (type === "date") return [
|
|
4265
4286
|
{ value: "is", label: "is" },
|