@rufous/ui 0.2.93 → 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 +426 -411
- package/dist/main.js +439 -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,18 +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 [filterQuery, setFilterQuery] = (0,
|
|
1980
|
-
const [focusedIdx, setFocusedIdx] = (0,
|
|
1981
|
-
const [popupStyle, setPopupStyle] = (0,
|
|
1982
|
-
const containerRef = (0,
|
|
1983
|
-
const popupRef = (0,
|
|
1984
|
-
const inputRef = (0,
|
|
1985
|
-
const listRef = (0,
|
|
1986
|
-
const inputId = (0,
|
|
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;
|
|
1987
2222
|
const sxClass = useSx(sx);
|
|
1988
|
-
const calcPopupStyle = (0,
|
|
2223
|
+
const calcPopupStyle = (0, import_react19.useCallback)(() => {
|
|
1989
2224
|
if (!containerRef.current) return;
|
|
1990
2225
|
const rect = containerRef.current.getBoundingClientRect();
|
|
1991
2226
|
const POPUP_MAX_HEIGHT = 280;
|
|
@@ -2016,11 +2251,11 @@ function AutocompleteInner(props, _ref) {
|
|
|
2016
2251
|
}, []);
|
|
2017
2252
|
const activeInput = controlledInput !== void 0 ? controlledInput : inputStr;
|
|
2018
2253
|
const selectedValues = multiple ? Array.isArray(value) ? value : [] : value != null ? [value] : [];
|
|
2019
|
-
const isEqual = (0,
|
|
2254
|
+
const isEqual = (0, import_react19.useCallback)(
|
|
2020
2255
|
(a, b) => isOptionEqualToValue ? isOptionEqualToValue(a, b) : defaultIsEqual(a, b),
|
|
2021
2256
|
[isOptionEqualToValue]
|
|
2022
2257
|
);
|
|
2023
|
-
const isSelected = (0,
|
|
2258
|
+
const isSelected = (0, import_react19.useCallback)(
|
|
2024
2259
|
(opt) => selectedValues.some((v) => isEqual(opt, v)),
|
|
2025
2260
|
[selectedValues, isEqual]
|
|
2026
2261
|
);
|
|
@@ -2047,7 +2282,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2047
2282
|
filtered.forEach((opt, i) => flatEntries.push({ kind: "option", option: opt, flatIdx: i }));
|
|
2048
2283
|
}
|
|
2049
2284
|
const selectableOptions = flatEntries.filter((e) => e.kind === "option");
|
|
2050
|
-
const openPopup = (0,
|
|
2285
|
+
const openPopup = (0, import_react19.useCallback)(() => {
|
|
2051
2286
|
if (disabled) return;
|
|
2052
2287
|
calcPopupStyle();
|
|
2053
2288
|
setOpen(true);
|
|
@@ -2055,7 +2290,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2055
2290
|
setFilterQuery("");
|
|
2056
2291
|
onOpen?.();
|
|
2057
2292
|
}, [disabled, calcPopupStyle, onOpen]);
|
|
2058
|
-
const closePopup = (0,
|
|
2293
|
+
const closePopup = (0, import_react19.useCallback)((justSelected = false) => {
|
|
2059
2294
|
setOpen(false);
|
|
2060
2295
|
setFocusedIdx(-1);
|
|
2061
2296
|
onClose?.();
|
|
@@ -2064,7 +2299,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2064
2299
|
onInputChange?.("");
|
|
2065
2300
|
}
|
|
2066
2301
|
}, [freeSolo, multiple, value, onInputChange, onClose]);
|
|
2067
|
-
(0,
|
|
2302
|
+
(0, import_react19.useEffect)(() => {
|
|
2068
2303
|
if (!open) return;
|
|
2069
2304
|
const handleOutside = (e) => {
|
|
2070
2305
|
const target = e.target;
|
|
@@ -2083,7 +2318,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2083
2318
|
window.removeEventListener("resize", calcPopupStyle);
|
|
2084
2319
|
};
|
|
2085
2320
|
}, [open, closePopup, calcPopupStyle]);
|
|
2086
|
-
(0,
|
|
2321
|
+
(0, import_react19.useEffect)(() => {
|
|
2087
2322
|
if (controlledInput !== void 0) return;
|
|
2088
2323
|
if (!multiple) {
|
|
2089
2324
|
const v = value;
|
|
@@ -2199,7 +2434,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2199
2434
|
className
|
|
2200
2435
|
].filter(Boolean).join(" ");
|
|
2201
2436
|
const inputPlaceholder = placeholder || (variant === "outlined" ? " " : void 0);
|
|
2202
|
-
return /* @__PURE__ */
|
|
2437
|
+
return /* @__PURE__ */ import_react19.default.createElement("div", { ref: containerRef, className: rootClasses, style }, /* @__PURE__ */ import_react19.default.createElement(
|
|
2203
2438
|
"div",
|
|
2204
2439
|
{
|
|
2205
2440
|
className: "rf-text-field__wrapper",
|
|
@@ -2210,7 +2445,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2210
2445
|
}
|
|
2211
2446
|
}
|
|
2212
2447
|
},
|
|
2213
|
-
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(
|
|
2214
2449
|
"button",
|
|
2215
2450
|
{
|
|
2216
2451
|
type: "button",
|
|
@@ -2219,10 +2454,17 @@ function AutocompleteInner(props, _ref) {
|
|
|
2219
2454
|
onClick: (e) => removeTag(opt, e),
|
|
2220
2455
|
tabIndex: -1
|
|
2221
2456
|
},
|
|
2222
|
-
/* @__PURE__ */
|
|
2457
|
+
/* @__PURE__ */ import_react19.default.createElement(CloseSmIcon, { size: 12 })
|
|
2223
2458
|
))),
|
|
2224
|
-
hiddenCount > 0 && /* @__PURE__ */
|
|
2225
|
-
|
|
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(
|
|
2226
2468
|
"input",
|
|
2227
2469
|
{
|
|
2228
2470
|
ref: inputRef,
|
|
@@ -2244,9 +2486,9 @@ function AutocompleteInner(props, _ref) {
|
|
|
2244
2486
|
"aria-autocomplete": "list"
|
|
2245
2487
|
}
|
|
2246
2488
|
),
|
|
2247
|
-
label && /* @__PURE__ */
|
|
2248
|
-
variant === "outlined" && /* @__PURE__ */
|
|
2249
|
-
/* @__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(
|
|
2250
2492
|
"button",
|
|
2251
2493
|
{
|
|
2252
2494
|
type: "button",
|
|
@@ -2256,8 +2498,8 @@ function AutocompleteInner(props, _ref) {
|
|
|
2256
2498
|
tabIndex: -1,
|
|
2257
2499
|
"aria-label": "Clear"
|
|
2258
2500
|
},
|
|
2259
|
-
/* @__PURE__ */
|
|
2260
|
-
), !freeSolo && /* @__PURE__ */
|
|
2501
|
+
/* @__PURE__ */ import_react19.default.createElement(CloseSmIcon, { size: 16 })
|
|
2502
|
+
), !freeSolo && /* @__PURE__ */ import_react19.default.createElement(
|
|
2261
2503
|
"button",
|
|
2262
2504
|
{
|
|
2263
2505
|
type: "button",
|
|
@@ -2269,10 +2511,10 @@ function AutocompleteInner(props, _ref) {
|
|
|
2269
2511
|
tabIndex: -1,
|
|
2270
2512
|
"aria-label": open ? "Close" : "Open"
|
|
2271
2513
|
},
|
|
2272
|
-
/* @__PURE__ */
|
|
2514
|
+
/* @__PURE__ */ import_react19.default.createElement(ChevronDownIcon, null)
|
|
2273
2515
|
))
|
|
2274
|
-
), helperText && /* @__PURE__ */
|
|
2275
|
-
/* @__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 ? (
|
|
2276
2518
|
// Grouped render
|
|
2277
2519
|
(() => {
|
|
2278
2520
|
const rendered = [];
|
|
@@ -2282,7 +2524,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2282
2524
|
if (entry.kind === "group") {
|
|
2283
2525
|
if (groupItems.length > 0) {
|
|
2284
2526
|
rendered.push(
|
|
2285
|
-
/* @__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))
|
|
2286
2528
|
);
|
|
2287
2529
|
groupItems = [];
|
|
2288
2530
|
}
|
|
@@ -2293,7 +2535,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2293
2535
|
}
|
|
2294
2536
|
if (ei === flatEntries.length - 1 && groupItems.length > 0) {
|
|
2295
2537
|
rendered.push(
|
|
2296
|
-
/* @__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))
|
|
2297
2539
|
);
|
|
2298
2540
|
}
|
|
2299
2541
|
});
|
|
@@ -2307,7 +2549,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
2307
2549
|
const focused = focusedIdx === flatIdx;
|
|
2308
2550
|
const optDisabled = getOptionDisabled?.(option) ?? false;
|
|
2309
2551
|
const label2 = getOptionLabel(option);
|
|
2310
|
-
return /* @__PURE__ */
|
|
2552
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
2311
2553
|
"li",
|
|
2312
2554
|
{
|
|
2313
2555
|
key: label2 + flatIdx,
|
|
@@ -2326,12 +2568,12 @@ function AutocompleteInner(props, _ref) {
|
|
|
2326
2568
|
onMouseDown: (e) => e.preventDefault(),
|
|
2327
2569
|
onClick: (e) => selectOption(option, e)
|
|
2328
2570
|
},
|
|
2329
|
-
renderOption ? renderOption(option, { selected, focused, index: flatIdx }) : /* @__PURE__ */
|
|
2330
|
-
!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))
|
|
2331
2573
|
);
|
|
2332
2574
|
}
|
|
2333
2575
|
}
|
|
2334
|
-
var Autocomplete =
|
|
2576
|
+
var Autocomplete = import_react19.default.forwardRef(AutocompleteInner);
|
|
2335
2577
|
Autocomplete.displayName = "Autocomplete";
|
|
2336
2578
|
|
|
2337
2579
|
// lib/TextFields/AddressLookup.tsx
|
|
@@ -2348,16 +2590,16 @@ var AddressLookup = ({
|
|
|
2348
2590
|
token = ""
|
|
2349
2591
|
}) => {
|
|
2350
2592
|
const { theme } = useRufousTheme();
|
|
2351
|
-
const [suggestions, setSuggestions] = (0,
|
|
2352
|
-
const [loading, setLoading] = (0,
|
|
2353
|
-
const [showSuggestions, setShowSuggestions] = (0,
|
|
2354
|
-
const debounceTimeout = (0,
|
|
2355
|
-
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);
|
|
2356
2598
|
const apiKey = token || "";
|
|
2357
2599
|
const countries = import_country_state_city.Country.getAllCountries();
|
|
2358
|
-
const [states, setStates] = (0,
|
|
2359
|
-
const [cities, setCities] = (0,
|
|
2360
|
-
(0,
|
|
2600
|
+
const [states, setStates] = (0, import_react20.useState)([]);
|
|
2601
|
+
const [cities, setCities] = (0, import_react20.useState)([]);
|
|
2602
|
+
(0, import_react20.useEffect)(() => {
|
|
2361
2603
|
const handleClickOutside = (event) => {
|
|
2362
2604
|
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
2363
2605
|
setShowSuggestions(false);
|
|
@@ -2366,7 +2608,7 @@ var AddressLookup = ({
|
|
|
2366
2608
|
document.addEventListener("mousedown", handleClickOutside);
|
|
2367
2609
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2368
2610
|
}, []);
|
|
2369
|
-
(0,
|
|
2611
|
+
(0, import_react20.useEffect)(() => {
|
|
2370
2612
|
if (value.country) {
|
|
2371
2613
|
const country = countries.find((c) => c.name === value.country);
|
|
2372
2614
|
if (country) {
|
|
@@ -2379,7 +2621,7 @@ var AddressLookup = ({
|
|
|
2379
2621
|
setStates([]);
|
|
2380
2622
|
}
|
|
2381
2623
|
}, [value.country]);
|
|
2382
|
-
(0,
|
|
2624
|
+
(0, import_react20.useEffect)(() => {
|
|
2383
2625
|
if (value.state && value.country) {
|
|
2384
2626
|
const country = countries.find((c) => c.name === value.country);
|
|
2385
2627
|
if (country) {
|
|
@@ -2484,7 +2726,7 @@ var AddressLookup = ({
|
|
|
2484
2726
|
city: ""
|
|
2485
2727
|
});
|
|
2486
2728
|
};
|
|
2487
|
-
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(
|
|
2488
2730
|
TextField,
|
|
2489
2731
|
{
|
|
2490
2732
|
label,
|
|
@@ -2516,7 +2758,7 @@ var AddressLookup = ({
|
|
|
2516
2758
|
},
|
|
2517
2759
|
onFocus: () => suggestions.length > 0 && setShowSuggestions(true)
|
|
2518
2760
|
}
|
|
2519
|
-
), 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(
|
|
2520
2762
|
"div",
|
|
2521
2763
|
{
|
|
2522
2764
|
key: idx,
|
|
@@ -2527,9 +2769,9 @@ var AddressLookup = ({
|
|
|
2527
2769
|
fetchPlaceDetails(option.placePrediction.placeId, mainText);
|
|
2528
2770
|
}
|
|
2529
2771
|
},
|
|
2530
|
-
/* @__PURE__ */
|
|
2531
|
-
/* @__PURE__ */
|
|
2532
|
-
))), 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(
|
|
2533
2775
|
TextField,
|
|
2534
2776
|
{
|
|
2535
2777
|
label: "Address Line 2",
|
|
@@ -2538,7 +2780,7 @@ var AddressLookup = ({
|
|
|
2538
2780
|
value: value.addressLine2 || "",
|
|
2539
2781
|
onChange: (e) => handleChange("addressLine2", e.target.value)
|
|
2540
2782
|
}
|
|
2541
|
-
)), layout !== "compact" && /* @__PURE__ */
|
|
2783
|
+
)), layout !== "compact" && /* @__PURE__ */ import_react20.default.createElement("div", { className: "address-lookup-grid-item col-l2" }, /* @__PURE__ */ import_react20.default.createElement(
|
|
2542
2784
|
TextField,
|
|
2543
2785
|
{
|
|
2544
2786
|
label: "Address Line 2",
|
|
@@ -2547,7 +2789,7 @@ var AddressLookup = ({
|
|
|
2547
2789
|
value: value.addressLine2 || "",
|
|
2548
2790
|
onChange: (e) => handleChange("addressLine2", e.target.value)
|
|
2549
2791
|
}
|
|
2550
|
-
)), /* @__PURE__ */
|
|
2792
|
+
)), /* @__PURE__ */ import_react20.default.createElement("div", { className: "address-lookup-grid-item col-country" }, /* @__PURE__ */ import_react20.default.createElement(
|
|
2551
2793
|
Autocomplete,
|
|
2552
2794
|
{
|
|
2553
2795
|
options: countries.map((c) => c.name),
|
|
@@ -2558,7 +2800,7 @@ var AddressLookup = ({
|
|
|
2558
2800
|
required,
|
|
2559
2801
|
error: !!error.country
|
|
2560
2802
|
}
|
|
2561
|
-
), 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(
|
|
2562
2804
|
Autocomplete,
|
|
2563
2805
|
{
|
|
2564
2806
|
options: states.map((s2) => s2.name),
|
|
@@ -2569,7 +2811,7 @@ var AddressLookup = ({
|
|
|
2569
2811
|
required,
|
|
2570
2812
|
error: !!error.state
|
|
2571
2813
|
}
|
|
2572
|
-
), 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(
|
|
2573
2815
|
Autocomplete,
|
|
2574
2816
|
{
|
|
2575
2817
|
options: cities.map((c) => c.name),
|
|
@@ -2580,7 +2822,7 @@ var AddressLookup = ({
|
|
|
2580
2822
|
required,
|
|
2581
2823
|
error: !!error.city
|
|
2582
2824
|
}
|
|
2583
|
-
), 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(
|
|
2584
2826
|
TextField,
|
|
2585
2827
|
{
|
|
2586
2828
|
label: "Pincode",
|
|
@@ -2590,13 +2832,13 @@ var AddressLookup = ({
|
|
|
2590
2832
|
required,
|
|
2591
2833
|
onChange: (e) => handleChange("pincode", e.target.value)
|
|
2592
2834
|
}
|
|
2593
|
-
), error.pincode && /* @__PURE__ */
|
|
2835
|
+
), error.pincode && /* @__PURE__ */ import_react20.default.createElement("div", { className: "field-error-text" }, error.pincode))));
|
|
2594
2836
|
};
|
|
2595
2837
|
var AddressLookup_default = AddressLookup;
|
|
2596
2838
|
|
|
2597
2839
|
// lib/TextFields/DateField.tsx
|
|
2598
|
-
var
|
|
2599
|
-
var
|
|
2840
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
2841
|
+
var import_react_dom4 = require("react-dom");
|
|
2600
2842
|
var WEEKDAYS = ["SU", "MO", "TU", "WE", "TH", "FR", "SA"];
|
|
2601
2843
|
var MONTHS = [
|
|
2602
2844
|
"January",
|
|
@@ -2756,25 +2998,25 @@ var parseTimeFromISO = (iso) => {
|
|
|
2756
2998
|
if (h === 0) h = 12;
|
|
2757
2999
|
return { h, m, ampm };
|
|
2758
3000
|
};
|
|
2759
|
-
var CalendarIcon = () => /* @__PURE__ */
|
|
2760
|
-
var ChevUp = () => /* @__PURE__ */
|
|
2761
|
-
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" }));
|
|
2762
3004
|
var ITEM_H = 36;
|
|
2763
3005
|
var ScrollColumn = ({ items, selected, onSelect, infinite = true }) => {
|
|
2764
|
-
const listRef = (0,
|
|
2765
|
-
const isInternalScroll = (0,
|
|
2766
|
-
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);
|
|
2767
3009
|
const MULTIPLIER = infinite ? 100 : 1;
|
|
2768
3010
|
const virtualItems = infinite ? Array(MULTIPLIER).fill(items).flat() : items;
|
|
2769
3011
|
const centerOffset = infinite ? Math.floor(MULTIPLIER / 2) * items.length : 0;
|
|
2770
3012
|
const VISUAL_OFFSET = 54;
|
|
2771
|
-
(0,
|
|
3013
|
+
(0, import_react21.useEffect)(() => {
|
|
2772
3014
|
if (listRef.current) {
|
|
2773
3015
|
const targetIndex = centerOffset + selected;
|
|
2774
3016
|
listRef.current.scrollTop = targetIndex * ITEM_H - (infinite ? VISUAL_OFFSET : 0);
|
|
2775
3017
|
}
|
|
2776
3018
|
}, [centerOffset, infinite, selected]);
|
|
2777
|
-
(0,
|
|
3019
|
+
(0, import_react21.useEffect)(() => {
|
|
2778
3020
|
if (listRef.current && !isInternalScroll.current) {
|
|
2779
3021
|
const targetIndex = centerOffset + selected;
|
|
2780
3022
|
listRef.current.scrollTo({
|
|
@@ -2806,15 +3048,15 @@ var ScrollColumn = ({ items, selected, onSelect, infinite = true }) => {
|
|
|
2806
3048
|
}
|
|
2807
3049
|
}, 100);
|
|
2808
3050
|
};
|
|
2809
|
-
return /* @__PURE__ */
|
|
3051
|
+
return /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-timescroll__col-wrapper" }, /* @__PURE__ */ import_react21.default.createElement(
|
|
2810
3052
|
"div",
|
|
2811
3053
|
{
|
|
2812
3054
|
className: "rf-timescroll__col",
|
|
2813
3055
|
ref: listRef,
|
|
2814
3056
|
onScroll: handleScroll
|
|
2815
3057
|
},
|
|
2816
|
-
!infinite && /* @__PURE__ */
|
|
2817
|
-
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(
|
|
2818
3060
|
"div",
|
|
2819
3061
|
{
|
|
2820
3062
|
key: `${label}-${idx}`,
|
|
@@ -2822,8 +3064,8 @@ var ScrollColumn = ({ items, selected, onSelect, infinite = true }) => {
|
|
|
2822
3064
|
},
|
|
2823
3065
|
label
|
|
2824
3066
|
)),
|
|
2825
|
-
!infinite && /* @__PURE__ */
|
|
2826
|
-
), /* @__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" }));
|
|
2827
3069
|
};
|
|
2828
3070
|
var SpinnerPanel = ({
|
|
2829
3071
|
hour,
|
|
@@ -2834,7 +3076,7 @@ var SpinnerPanel = ({
|
|
|
2834
3076
|
onHourInput,
|
|
2835
3077
|
onMinuteInput,
|
|
2836
3078
|
onAmpmToggle
|
|
2837
|
-
}) => /* @__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(
|
|
2838
3080
|
"input",
|
|
2839
3081
|
{
|
|
2840
3082
|
type: "number",
|
|
@@ -2845,7 +3087,7 @@ var SpinnerPanel = ({
|
|
|
2845
3087
|
onChange: onHourInput,
|
|
2846
3088
|
onMouseDown: (e) => e.stopPropagation()
|
|
2847
3089
|
}
|
|
2848
|
-
), /* @__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(
|
|
2849
3091
|
"input",
|
|
2850
3092
|
{
|
|
2851
3093
|
type: "number",
|
|
@@ -2856,7 +3098,7 @@ var SpinnerPanel = ({
|
|
|
2856
3098
|
onChange: onMinuteInput,
|
|
2857
3099
|
onMouseDown: (e) => e.stopPropagation()
|
|
2858
3100
|
}
|
|
2859
|
-
), /* @__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(
|
|
2860
3102
|
"button",
|
|
2861
3103
|
{
|
|
2862
3104
|
type: "button",
|
|
@@ -2865,7 +3107,7 @@ var SpinnerPanel = ({
|
|
|
2865
3107
|
onClick: () => onAmpmToggle("AM")
|
|
2866
3108
|
},
|
|
2867
3109
|
"AM"
|
|
2868
|
-
), /* @__PURE__ */
|
|
3110
|
+
), /* @__PURE__ */ import_react21.default.createElement(
|
|
2869
3111
|
"button",
|
|
2870
3112
|
{
|
|
2871
3113
|
type: "button",
|
|
@@ -2887,7 +3129,7 @@ var CalendarBody = ({
|
|
|
2887
3129
|
onMonthSelect,
|
|
2888
3130
|
onYearSelect
|
|
2889
3131
|
}) => {
|
|
2890
|
-
const [pickerView, setPickerView] = (0,
|
|
3132
|
+
const [pickerView, setPickerView] = (0, import_react21.useState)("calendar");
|
|
2891
3133
|
const handleMonthClick = () => {
|
|
2892
3134
|
setPickerView(pickerView === "month" ? "calendar" : "month");
|
|
2893
3135
|
};
|
|
@@ -2905,21 +3147,21 @@ var CalendarBody = ({
|
|
|
2905
3147
|
const currentYear = todayDate.getFullYear();
|
|
2906
3148
|
const yearStart = viewYear - 6;
|
|
2907
3149
|
const years = Array.from({ length: 16 }, (_, i) => yearStart + i);
|
|
2908
|
-
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(
|
|
2909
3151
|
"span",
|
|
2910
3152
|
{
|
|
2911
3153
|
className: `rf-date-picker__month-label ${pickerView === "month" ? "rf-date-picker__month-label--active" : ""}`,
|
|
2912
3154
|
onClick: handleMonthClick
|
|
2913
3155
|
},
|
|
2914
3156
|
MONTHS[viewMonth]
|
|
2915
|
-
), /* @__PURE__ */
|
|
3157
|
+
), /* @__PURE__ */ import_react21.default.createElement(
|
|
2916
3158
|
"span",
|
|
2917
3159
|
{
|
|
2918
3160
|
className: `rf-date-picker__year-label ${pickerView === "year" ? "rf-date-picker__year-label--active" : ""}`,
|
|
2919
3161
|
onClick: handleYearClick
|
|
2920
3162
|
},
|
|
2921
3163
|
viewYear
|
|
2922
|
-
)), /* @__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(
|
|
2923
3165
|
"button",
|
|
2924
3166
|
{
|
|
2925
3167
|
key: m,
|
|
@@ -2932,7 +3174,7 @@ var CalendarBody = ({
|
|
|
2932
3174
|
onClick: () => handleMonthPick(idx)
|
|
2933
3175
|
},
|
|
2934
3176
|
m
|
|
2935
|
-
))), 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(
|
|
2936
3178
|
"button",
|
|
2937
3179
|
{
|
|
2938
3180
|
key: y,
|
|
@@ -2945,12 +3187,12 @@ var CalendarBody = ({
|
|
|
2945
3187
|
onClick: () => handleYearPick(y)
|
|
2946
3188
|
},
|
|
2947
3189
|
y
|
|
2948
|
-
))), pickerView === "calendar" && /* @__PURE__ */
|
|
2949
|
-
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" });
|
|
2950
3192
|
const cellDate = new Date(viewYear, viewMonth, day);
|
|
2951
3193
|
const isSelected = selectedDate ? isSameDay(cellDate, selectedDate) : false;
|
|
2952
3194
|
const isToday = isSameDay(cellDate, todayDate);
|
|
2953
|
-
return /* @__PURE__ */
|
|
3195
|
+
return /* @__PURE__ */ import_react21.default.createElement(
|
|
2954
3196
|
"button",
|
|
2955
3197
|
{
|
|
2956
3198
|
key: day,
|
|
@@ -2986,29 +3228,29 @@ var DateField = ({
|
|
|
2986
3228
|
sx
|
|
2987
3229
|
}) => {
|
|
2988
3230
|
const sxClass = useSx(sx);
|
|
2989
|
-
const [open, setOpen] = (0,
|
|
2990
|
-
const [selectedDate, setSelectedDate] = (0,
|
|
2991
|
-
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)(() => {
|
|
2992
3234
|
if (value && isDatetimeType(type)) return parseTimeFromISO(value).h;
|
|
2993
3235
|
return 12;
|
|
2994
3236
|
});
|
|
2995
|
-
const [minute, setMinute] = (0,
|
|
3237
|
+
const [minute, setMinute] = (0, import_react21.useState)(() => {
|
|
2996
3238
|
if (value && isDatetimeType(type)) return parseTimeFromISO(value).m;
|
|
2997
3239
|
return 0;
|
|
2998
3240
|
});
|
|
2999
|
-
const [ampm, setAmpm] = (0,
|
|
3241
|
+
const [ampm, setAmpm] = (0, import_react21.useState)(() => {
|
|
3000
3242
|
if (value && isDatetimeType(type)) return parseTimeFromISO(value).ampm;
|
|
3001
3243
|
return "AM";
|
|
3002
3244
|
});
|
|
3003
|
-
const [viewYear, setViewYear] = (0,
|
|
3245
|
+
const [viewYear, setViewYear] = (0, import_react21.useState)(() => {
|
|
3004
3246
|
const base = value ? isoToDate(value) : null;
|
|
3005
3247
|
return base ? base.getFullYear() : today().getFullYear();
|
|
3006
3248
|
});
|
|
3007
|
-
const [viewMonth, setViewMonth] = (0,
|
|
3249
|
+
const [viewMonth, setViewMonth] = (0, import_react21.useState)(() => {
|
|
3008
3250
|
const base = value ? isoToDate(value) : null;
|
|
3009
3251
|
return base ? base.getMonth() : today().getMonth();
|
|
3010
3252
|
});
|
|
3011
|
-
const [inputStr, setInputStr] = (0,
|
|
3253
|
+
const [inputStr, setInputStr] = (0, import_react21.useState)(() => {
|
|
3012
3254
|
if (!value) return "";
|
|
3013
3255
|
const d = isoToDate(value);
|
|
3014
3256
|
if (!d) return "";
|
|
@@ -3022,12 +3264,12 @@ var DateField = ({
|
|
|
3022
3264
|
const HOURS = Array.from({ length: 12 }, (_, i) => String(i + 1).padStart(2, "0"));
|
|
3023
3265
|
const MINUTES = Array.from({ length: 60 }, (_, i) => String(i).padStart(2, "0"));
|
|
3024
3266
|
const AMPMS = ["AM", "PM"];
|
|
3025
|
-
const containerRef = (0,
|
|
3026
|
-
const pickerRef = (0,
|
|
3027
|
-
const [dropUp, setDropUp] = (0,
|
|
3028
|
-
const inputId = (0,
|
|
3029
|
-
const isInternalChange = (0,
|
|
3030
|
-
(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)(() => {
|
|
3031
3273
|
if (value === void 0) return;
|
|
3032
3274
|
if (isInternalChange.current) {
|
|
3033
3275
|
isInternalChange.current = false;
|
|
@@ -3054,7 +3296,7 @@ var DateField = ({
|
|
|
3054
3296
|
setInputStr(str);
|
|
3055
3297
|
}
|
|
3056
3298
|
}, [value, type]);
|
|
3057
|
-
(0,
|
|
3299
|
+
(0, import_react21.useEffect)(() => {
|
|
3058
3300
|
if (!open) return;
|
|
3059
3301
|
const handler = (e) => {
|
|
3060
3302
|
const target = e.target;
|
|
@@ -3065,14 +3307,14 @@ var DateField = ({
|
|
|
3065
3307
|
document.addEventListener("mousedown", handler);
|
|
3066
3308
|
return () => document.removeEventListener("mousedown", handler);
|
|
3067
3309
|
}, [open]);
|
|
3068
|
-
(0,
|
|
3310
|
+
(0, import_react21.useEffect)(() => {
|
|
3069
3311
|
if (!open || !containerRef.current) return;
|
|
3070
3312
|
const rect = containerRef.current.getBoundingClientRect();
|
|
3071
3313
|
const spaceBelow = window.innerHeight - rect.bottom;
|
|
3072
3314
|
const pickerHeight = 400;
|
|
3073
3315
|
setDropUp(spaceBelow < pickerHeight && rect.top > pickerHeight);
|
|
3074
3316
|
}, [open]);
|
|
3075
|
-
const commitDate = (0,
|
|
3317
|
+
const commitDate = (0, import_react21.useCallback)((d, h, m, ap) => {
|
|
3076
3318
|
setSelectedDate(d);
|
|
3077
3319
|
if (!d) {
|
|
3078
3320
|
setInputStr("");
|
|
@@ -3223,7 +3465,7 @@ var DateField = ({
|
|
|
3223
3465
|
const inputPlaceholder = placeholder || (variant === "outlined" ? " " : void 0);
|
|
3224
3466
|
const todayDate = today();
|
|
3225
3467
|
const isSideVariant = type === "datetime-side" || type === "datetime-scroll";
|
|
3226
|
-
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(
|
|
3227
3469
|
"div",
|
|
3228
3470
|
{
|
|
3229
3471
|
className: "rf-text-field__wrapper",
|
|
@@ -3232,7 +3474,7 @@ var DateField = ({
|
|
|
3232
3474
|
},
|
|
3233
3475
|
style: { cursor: disabled ? "default" : "pointer" }
|
|
3234
3476
|
},
|
|
3235
|
-
/* @__PURE__ */
|
|
3477
|
+
/* @__PURE__ */ import_react21.default.createElement(
|
|
3236
3478
|
"input",
|
|
3237
3479
|
{
|
|
3238
3480
|
id: inputId,
|
|
@@ -3248,7 +3490,7 @@ var DateField = ({
|
|
|
3248
3490
|
}
|
|
3249
3491
|
}
|
|
3250
3492
|
),
|
|
3251
|
-
/* @__PURE__ */
|
|
3493
|
+
/* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-text-field__adornment rf-text-field__adornment--end" }, /* @__PURE__ */ import_react21.default.createElement(
|
|
3252
3494
|
"button",
|
|
3253
3495
|
{
|
|
3254
3496
|
type: "button",
|
|
@@ -3261,12 +3503,12 @@ var DateField = ({
|
|
|
3261
3503
|
},
|
|
3262
3504
|
"aria-label": "Pick date"
|
|
3263
3505
|
},
|
|
3264
|
-
/* @__PURE__ */
|
|
3506
|
+
/* @__PURE__ */ import_react21.default.createElement(CalendarIcon, null)
|
|
3265
3507
|
)),
|
|
3266
|
-
label && /* @__PURE__ */
|
|
3267
|
-
variant === "outlined" && /* @__PURE__ */
|
|
3268
|
-
), open && !disabled && (0,
|
|
3269
|
-
/* @__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(
|
|
3270
3512
|
"div",
|
|
3271
3513
|
{
|
|
3272
3514
|
ref: pickerRef,
|
|
@@ -3291,7 +3533,7 @@ var DateField = ({
|
|
|
3291
3533
|
})(),
|
|
3292
3534
|
onMouseDown: (e) => e.preventDefault()
|
|
3293
3535
|
},
|
|
3294
|
-
/* @__PURE__ */
|
|
3536
|
+
/* @__PURE__ */ import_react21.default.createElement("div", { className: isSideVariant ? "rf-date-picker__cal-col" : void 0 }, /* @__PURE__ */ import_react21.default.createElement(
|
|
3295
3537
|
CalendarBody,
|
|
3296
3538
|
{
|
|
3297
3539
|
viewMonth,
|
|
@@ -3305,7 +3547,7 @@ var DateField = ({
|
|
|
3305
3547
|
onMonthSelect: setViewMonth,
|
|
3306
3548
|
onYearSelect: setViewYear
|
|
3307
3549
|
}
|
|
3308
|
-
), 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(
|
|
3309
3551
|
SpinnerPanel,
|
|
3310
3552
|
{
|
|
3311
3553
|
hour,
|
|
@@ -3317,8 +3559,8 @@ var DateField = ({
|
|
|
3317
3559
|
onMinuteInput: handleMinuteInput,
|
|
3318
3560
|
onAmpmToggle: handleAmpmToggle
|
|
3319
3561
|
}
|
|
3320
|
-
)), /* @__PURE__ */
|
|
3321
|
-
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(
|
|
3322
3564
|
SpinnerPanel,
|
|
3323
3565
|
{
|
|
3324
3566
|
hour,
|
|
@@ -3330,22 +3572,22 @@ var DateField = ({
|
|
|
3330
3572
|
onMinuteInput: handleMinuteInput,
|
|
3331
3573
|
onAmpmToggle: handleAmpmToggle
|
|
3332
3574
|
}
|
|
3333
|
-
)), /* @__PURE__ */
|
|
3334
|
-
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(
|
|
3335
3577
|
ScrollColumn,
|
|
3336
3578
|
{
|
|
3337
3579
|
items: HOURS,
|
|
3338
3580
|
selected: hour - 1,
|
|
3339
3581
|
onSelect: handleScrollHour
|
|
3340
3582
|
}
|
|
3341
|
-
), /* @__PURE__ */
|
|
3583
|
+
), /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-timescroll__colon" }, ":"), /* @__PURE__ */ import_react21.default.createElement(
|
|
3342
3584
|
ScrollColumn,
|
|
3343
3585
|
{
|
|
3344
3586
|
items: MINUTES,
|
|
3345
3587
|
selected: minute,
|
|
3346
3588
|
onSelect: handleScrollMinute
|
|
3347
3589
|
}
|
|
3348
|
-
), /* @__PURE__ */
|
|
3590
|
+
), /* @__PURE__ */ import_react21.default.createElement(
|
|
3349
3591
|
ScrollColumn,
|
|
3350
3592
|
{
|
|
3351
3593
|
items: AMPMS,
|
|
@@ -3353,15 +3595,15 @@ var DateField = ({
|
|
|
3353
3595
|
onSelect: handleScrollAmpm,
|
|
3354
3596
|
infinite: false
|
|
3355
3597
|
}
|
|
3356
|
-
)), /* @__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))
|
|
3357
3599
|
),
|
|
3358
3600
|
document.body
|
|
3359
|
-
)), helperText && /* @__PURE__ */
|
|
3601
|
+
)), helperText && /* @__PURE__ */ import_react21.default.createElement("div", { className: "rf-text-field__helper-text" }, helperText));
|
|
3360
3602
|
};
|
|
3361
3603
|
DateField.displayName = "DateField";
|
|
3362
3604
|
|
|
3363
3605
|
// lib/TextFields/DateRangeField.tsx
|
|
3364
|
-
var
|
|
3606
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
3365
3607
|
var WEEKDAYS2 = ["SU", "MO", "TU", "WE", "TH", "FR", "SA"];
|
|
3366
3608
|
var MONTHS2 = [
|
|
3367
3609
|
"January",
|
|
@@ -3486,7 +3728,7 @@ var detectPreset = (start, end) => {
|
|
|
3486
3728
|
if (isSameDay2(start, new Date(2e3, 0, 1)) && isSameDay2(end, today2)) return "all";
|
|
3487
3729
|
return null;
|
|
3488
3730
|
};
|
|
3489
|
-
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" }));
|
|
3490
3732
|
var RangeCalendarBody = ({
|
|
3491
3733
|
viewYear,
|
|
3492
3734
|
viewMonth,
|
|
@@ -3511,7 +3753,7 @@ var RangeCalendarBody = ({
|
|
|
3511
3753
|
const hasRange = startDate != null && effectiveEnd != null && !isSameDay2(startDate, effectiveEnd);
|
|
3512
3754
|
const lo = startDate && effectiveEnd ? startDate <= effectiveEnd ? startDate : effectiveEnd : null;
|
|
3513
3755
|
const hi = startDate && effectiveEnd ? startDate <= effectiveEnd ? effectiveEnd : startDate : null;
|
|
3514
|
-
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(
|
|
3515
3757
|
"button",
|
|
3516
3758
|
{
|
|
3517
3759
|
type: "button",
|
|
@@ -3521,7 +3763,7 @@ var RangeCalendarBody = ({
|
|
|
3521
3763
|
"aria-label": "Previous month"
|
|
3522
3764
|
},
|
|
3523
3765
|
"\u2039"
|
|
3524
|
-
), /* @__PURE__ */
|
|
3766
|
+
), /* @__PURE__ */ import_react22.default.createElement("span", { className: "rf-dr-calendar__month-label" }, MONTHS2[viewMonth], " ", viewYear), /* @__PURE__ */ import_react22.default.createElement(
|
|
3525
3767
|
"button",
|
|
3526
3768
|
{
|
|
3527
3769
|
type: "button",
|
|
@@ -3531,9 +3773,9 @@ var RangeCalendarBody = ({
|
|
|
3531
3773
|
"aria-label": "Next month"
|
|
3532
3774
|
},
|
|
3533
3775
|
"\u203A"
|
|
3534
|
-
)), /* @__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) => {
|
|
3535
3777
|
if (day === null) {
|
|
3536
|
-
return /* @__PURE__ */
|
|
3778
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", { key: `e-${idx}`, className: "rf-dr-calendar__cell rf-dr-calendar__cell--empty" });
|
|
3537
3779
|
}
|
|
3538
3780
|
const cellDate = new Date(viewYear, viewMonth, day);
|
|
3539
3781
|
const isStart = startDate ? isSameDay2(cellDate, startDate) : false;
|
|
@@ -3553,7 +3795,7 @@ var RangeCalendarBody = ({
|
|
|
3553
3795
|
isStart || isEnd ? "rf-dr-calendar__day--selected" : "",
|
|
3554
3796
|
isToday && !isStart && !isEnd ? "rf-dr-calendar__day--today" : ""
|
|
3555
3797
|
].filter(Boolean).join(" ");
|
|
3556
|
-
return /* @__PURE__ */
|
|
3798
|
+
return /* @__PURE__ */ import_react22.default.createElement(
|
|
3557
3799
|
"div",
|
|
3558
3800
|
{
|
|
3559
3801
|
key: day,
|
|
@@ -3561,7 +3803,7 @@ var RangeCalendarBody = ({
|
|
|
3561
3803
|
onMouseEnter: () => onDayHover(cellDate),
|
|
3562
3804
|
onMouseLeave: () => onDayHover(null)
|
|
3563
3805
|
},
|
|
3564
|
-
/* @__PURE__ */
|
|
3806
|
+
/* @__PURE__ */ import_react22.default.createElement(
|
|
3565
3807
|
"button",
|
|
3566
3808
|
{
|
|
3567
3809
|
type: "button",
|
|
@@ -3575,8 +3817,8 @@ var RangeCalendarBody = ({
|
|
|
3575
3817
|
};
|
|
3576
3818
|
var MiniCalendar = ({ selectedDate, todayDate, onSelect, onClose }) => {
|
|
3577
3819
|
const init = selectedDate ?? todayDate;
|
|
3578
|
-
const [viewYear, setViewYear] = (0,
|
|
3579
|
-
const [viewMonth, setViewMonth] = (0,
|
|
3820
|
+
const [viewYear, setViewYear] = (0, import_react22.useState)(init.getFullYear());
|
|
3821
|
+
const [viewMonth, setViewMonth] = (0, import_react22.useState)(init.getMonth());
|
|
3580
3822
|
const firstDay = new Date(viewYear, viewMonth, 1).getDay();
|
|
3581
3823
|
const daysInMonth = new Date(viewYear, viewMonth + 1, 0).getDate();
|
|
3582
3824
|
const dayCells = [
|
|
@@ -3595,14 +3837,14 @@ var MiniCalendar = ({ selectedDate, todayDate, onSelect, onClose }) => {
|
|
|
3595
3837
|
setViewYear((y) => y + 1);
|
|
3596
3838
|
} else setViewMonth((m) => m + 1);
|
|
3597
3839
|
};
|
|
3598
|
-
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) => {
|
|
3599
3841
|
if (day === null) {
|
|
3600
|
-
return /* @__PURE__ */
|
|
3842
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", { key: `e-${idx}`, className: "rf-dr-calendar__cell rf-dr-calendar__cell--empty" });
|
|
3601
3843
|
}
|
|
3602
3844
|
const cellDate = new Date(viewYear, viewMonth, day);
|
|
3603
3845
|
const isSel = selectedDate ? isSameDay2(cellDate, selectedDate) : false;
|
|
3604
3846
|
const isToday = isSameDay2(cellDate, todayDate);
|
|
3605
|
-
return /* @__PURE__ */
|
|
3847
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", { key: day, className: "rf-dr-calendar__cell" }, /* @__PURE__ */ import_react22.default.createElement(
|
|
3606
3848
|
"button",
|
|
3607
3849
|
{
|
|
3608
3850
|
type: "button",
|
|
@@ -3641,22 +3883,22 @@ var DateRangeField = ({
|
|
|
3641
3883
|
const today2 = todayFn();
|
|
3642
3884
|
const committedStart = value?.start ? isoToDate2(value.start) : null;
|
|
3643
3885
|
const committedEnd = value?.end ? isoToDate2(value.end) : null;
|
|
3644
|
-
const [open, setOpen] = (0,
|
|
3645
|
-
const [draftStart, setDraftStart] = (0,
|
|
3646
|
-
const [draftEnd, setDraftEnd] = (0,
|
|
3647
|
-
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)(
|
|
3648
3890
|
() => detectPreset(committedStart, committedEnd)
|
|
3649
3891
|
);
|
|
3650
|
-
const [startInputStr, setStartInputStr] = (0,
|
|
3651
|
-
const [endInputStr, setEndInputStr] = (0,
|
|
3652
|
-
const [inlineCal, setInlineCal] = (0,
|
|
3653
|
-
const [hoverDate, setHoverDate] = (0,
|
|
3654
|
-
const [selecting, setSelecting] = (0,
|
|
3655
|
-
const [leftViewYear, setLeftViewYear] = (0,
|
|
3656
|
-
const [leftViewMonth, setLeftViewMonth] = (0,
|
|
3657
|
-
const containerRef = (0,
|
|
3658
|
-
const inputId = (0,
|
|
3659
|
-
(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)(() => {
|
|
3660
3902
|
const s2 = value?.start ? isoToDate2(value.start) : null;
|
|
3661
3903
|
const e = value?.end ? isoToDate2(value.end) : null;
|
|
3662
3904
|
setDraftStart(s2);
|
|
@@ -3665,10 +3907,10 @@ var DateRangeField = ({
|
|
|
3665
3907
|
setEndInputStr(e ? formatShort(e) : "");
|
|
3666
3908
|
setActivePreset(detectPreset(s2, e));
|
|
3667
3909
|
}, [value?.start, value?.end]);
|
|
3668
|
-
(0,
|
|
3910
|
+
(0, import_react22.useEffect)(() => {
|
|
3669
3911
|
setActivePreset(detectPreset(draftStart, draftEnd));
|
|
3670
3912
|
}, [draftStart?.getTime(), draftEnd?.getTime()]);
|
|
3671
|
-
(0,
|
|
3913
|
+
(0, import_react22.useEffect)(() => {
|
|
3672
3914
|
if (!open) return;
|
|
3673
3915
|
const handler = (e) => {
|
|
3674
3916
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -3810,7 +4052,7 @@ var DateRangeField = ({
|
|
|
3810
4052
|
className
|
|
3811
4053
|
].filter(Boolean).join(" ");
|
|
3812
4054
|
const inputPlaceholder = variant === "outlined" ? " " : void 0;
|
|
3813
|
-
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(
|
|
3814
4056
|
"div",
|
|
3815
4057
|
{
|
|
3816
4058
|
className: "rf-text-field__wrapper",
|
|
@@ -3819,7 +4061,7 @@ var DateRangeField = ({
|
|
|
3819
4061
|
},
|
|
3820
4062
|
style: { cursor: disabled ? "default" : "pointer" }
|
|
3821
4063
|
},
|
|
3822
|
-
/* @__PURE__ */
|
|
4064
|
+
/* @__PURE__ */ import_react22.default.createElement(
|
|
3823
4065
|
"input",
|
|
3824
4066
|
{
|
|
3825
4067
|
id: inputId,
|
|
@@ -3835,7 +4077,7 @@ var DateRangeField = ({
|
|
|
3835
4077
|
}
|
|
3836
4078
|
}
|
|
3837
4079
|
),
|
|
3838
|
-
/* @__PURE__ */
|
|
4080
|
+
/* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-text-field__adornment rf-text-field__adornment--end" }, /* @__PURE__ */ import_react22.default.createElement(
|
|
3839
4081
|
"button",
|
|
3840
4082
|
{
|
|
3841
4083
|
type: "button",
|
|
@@ -3848,13 +4090,13 @@ var DateRangeField = ({
|
|
|
3848
4090
|
},
|
|
3849
4091
|
"aria-label": "Pick date range"
|
|
3850
4092
|
},
|
|
3851
|
-
/* @__PURE__ */
|
|
4093
|
+
/* @__PURE__ */ import_react22.default.createElement(CalendarIcon2, null)
|
|
3852
4094
|
)),
|
|
3853
|
-
label && /* @__PURE__ */
|
|
3854
|
-
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" }))
|
|
3855
4097
|
), open && !disabled && (pickerType === "panel" ? (
|
|
3856
4098
|
/* ── Panel Mode ── */
|
|
3857
|
-
/* @__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(
|
|
3858
4100
|
"button",
|
|
3859
4101
|
{
|
|
3860
4102
|
type: "button",
|
|
@@ -3865,7 +4107,7 @@ var DateRangeField = ({
|
|
|
3865
4107
|
onClick: () => handlePreset(p.id)
|
|
3866
4108
|
},
|
|
3867
4109
|
p.label
|
|
3868
|
-
)))), /* @__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(
|
|
3869
4111
|
"div",
|
|
3870
4112
|
{
|
|
3871
4113
|
className: [
|
|
@@ -3873,8 +4115,8 @@ var DateRangeField = ({
|
|
|
3873
4115
|
inlineCal === "start" ? "rf-dr-picker__date-field--active" : ""
|
|
3874
4116
|
].filter(Boolean).join(" ")
|
|
3875
4117
|
},
|
|
3876
|
-
/* @__PURE__ */
|
|
3877
|
-
/* @__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(
|
|
3878
4120
|
"input",
|
|
3879
4121
|
{
|
|
3880
4122
|
type: "text",
|
|
@@ -3885,7 +4127,7 @@ var DateRangeField = ({
|
|
|
3885
4127
|
onBlur: handleStartInputBlur,
|
|
3886
4128
|
onMouseDown: (e) => e.stopPropagation()
|
|
3887
4129
|
}
|
|
3888
|
-
), /* @__PURE__ */
|
|
4130
|
+
), /* @__PURE__ */ import_react22.default.createElement(
|
|
3889
4131
|
"button",
|
|
3890
4132
|
{
|
|
3891
4133
|
type: "button",
|
|
@@ -3894,9 +4136,9 @@ var DateRangeField = ({
|
|
|
3894
4136
|
onClick: () => setInlineCal((v) => v === "start" ? null : "start"),
|
|
3895
4137
|
"aria-label": "Pick start date"
|
|
3896
4138
|
},
|
|
3897
|
-
/* @__PURE__ */
|
|
4139
|
+
/* @__PURE__ */ import_react22.default.createElement(CalendarIcon2, null)
|
|
3898
4140
|
))
|
|
3899
|
-
), inlineCal === "start" && /* @__PURE__ */
|
|
4141
|
+
), inlineCal === "start" && /* @__PURE__ */ import_react22.default.createElement(
|
|
3900
4142
|
MiniCalendar,
|
|
3901
4143
|
{
|
|
3902
4144
|
selectedDate: draftStart,
|
|
@@ -3907,7 +4149,7 @@ var DateRangeField = ({
|
|
|
3907
4149
|
},
|
|
3908
4150
|
onClose: () => setInlineCal(null)
|
|
3909
4151
|
}
|
|
3910
|
-
)), /* @__PURE__ */
|
|
4152
|
+
)), /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker__date-field-wrap" }, /* @__PURE__ */ import_react22.default.createElement(
|
|
3911
4153
|
"div",
|
|
3912
4154
|
{
|
|
3913
4155
|
className: [
|
|
@@ -3915,8 +4157,8 @@ var DateRangeField = ({
|
|
|
3915
4157
|
inlineCal === "end" ? "rf-dr-picker__date-field--active" : ""
|
|
3916
4158
|
].filter(Boolean).join(" ")
|
|
3917
4159
|
},
|
|
3918
|
-
/* @__PURE__ */
|
|
3919
|
-
/* @__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(
|
|
3920
4162
|
"input",
|
|
3921
4163
|
{
|
|
3922
4164
|
type: "text",
|
|
@@ -3927,7 +4169,7 @@ var DateRangeField = ({
|
|
|
3927
4169
|
onBlur: handleEndInputBlur,
|
|
3928
4170
|
onMouseDown: (e) => e.stopPropagation()
|
|
3929
4171
|
}
|
|
3930
|
-
), /* @__PURE__ */
|
|
4172
|
+
), /* @__PURE__ */ import_react22.default.createElement(
|
|
3931
4173
|
"button",
|
|
3932
4174
|
{
|
|
3933
4175
|
type: "button",
|
|
@@ -3936,9 +4178,9 @@ var DateRangeField = ({
|
|
|
3936
4178
|
onClick: () => setInlineCal((v) => v === "end" ? null : "end"),
|
|
3937
4179
|
"aria-label": "Pick end date"
|
|
3938
4180
|
},
|
|
3939
|
-
/* @__PURE__ */
|
|
4181
|
+
/* @__PURE__ */ import_react22.default.createElement(CalendarIcon2, null)
|
|
3940
4182
|
))
|
|
3941
|
-
), inlineCal === "end" && /* @__PURE__ */
|
|
4183
|
+
), inlineCal === "end" && /* @__PURE__ */ import_react22.default.createElement(
|
|
3942
4184
|
MiniCalendar,
|
|
3943
4185
|
{
|
|
3944
4186
|
selectedDate: draftEnd,
|
|
@@ -3949,7 +4191,7 @@ var DateRangeField = ({
|
|
|
3949
4191
|
},
|
|
3950
4192
|
onClose: () => setInlineCal(null)
|
|
3951
4193
|
}
|
|
3952
|
-
)), !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(
|
|
3953
4195
|
"input",
|
|
3954
4196
|
{
|
|
3955
4197
|
type: "number",
|
|
@@ -3960,7 +4202,7 @@ var DateRangeField = ({
|
|
|
3960
4202
|
onMouseDown: (e) => e.stopPropagation(),
|
|
3961
4203
|
placeholder: "\u2014"
|
|
3962
4204
|
}
|
|
3963
|
-
)), /* @__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(
|
|
3964
4206
|
"input",
|
|
3965
4207
|
{
|
|
3966
4208
|
type: "number",
|
|
@@ -3971,10 +4213,10 @@ var DateRangeField = ({
|
|
|
3971
4213
|
onMouseDown: (e) => e.stopPropagation(),
|
|
3972
4214
|
placeholder: "\u2014"
|
|
3973
4215
|
}
|
|
3974
|
-
))), /* @__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"))))
|
|
3975
4217
|
) : (
|
|
3976
4218
|
/* ── Calendar Mode ── */
|
|
3977
|
-
/* @__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(
|
|
3978
4220
|
RangeCalendarBody,
|
|
3979
4221
|
{
|
|
3980
4222
|
viewYear: leftViewYear,
|
|
@@ -3989,7 +4231,7 @@ var DateRangeField = ({
|
|
|
3989
4231
|
onNext: nextMonth,
|
|
3990
4232
|
showNext: false
|
|
3991
4233
|
}
|
|
3992
|
-
), /* @__PURE__ */
|
|
4234
|
+
), /* @__PURE__ */ import_react22.default.createElement("div", { className: "rf-dr-picker__cal-col-divider" }), /* @__PURE__ */ import_react22.default.createElement(
|
|
3993
4235
|
RangeCalendarBody,
|
|
3994
4236
|
{
|
|
3995
4237
|
viewYear: rightViewYear,
|
|
@@ -4004,19 +4246,19 @@ var DateRangeField = ({
|
|
|
4004
4246
|
onNext: nextMonth,
|
|
4005
4247
|
showPrev: false
|
|
4006
4248
|
}
|
|
4007
|
-
)), selecting === "end" && draftStart && /* @__PURE__ */
|
|
4008
|
-
))), 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));
|
|
4009
4251
|
};
|
|
4010
4252
|
DateRangeField.displayName = "DateRangeField";
|
|
4011
4253
|
|
|
4012
4254
|
// lib/Progress/RufousLogoLoader.tsx
|
|
4013
|
-
var
|
|
4255
|
+
var React74 = __toESM(require("react"), 1);
|
|
4014
4256
|
var _uid = 0;
|
|
4015
4257
|
var RufousLogoLoader = ({ size = 80, sx, className }) => {
|
|
4016
|
-
const clipId =
|
|
4258
|
+
const clipId = React74.useRef(`rll-${++_uid}`).current;
|
|
4017
4259
|
const height = size * (38.795 / 54.585);
|
|
4018
4260
|
const sxClass = useSx(sx);
|
|
4019
|
-
return /* @__PURE__ */
|
|
4261
|
+
return /* @__PURE__ */ React74.createElement("div", { className: ["rufous-logo-loader", sxClass, className].filter(Boolean).join(" "), style: { width: size, height } }, /* @__PURE__ */ React74.createElement(
|
|
4020
4262
|
"svg",
|
|
4021
4263
|
{
|
|
4022
4264
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -4025,247 +4267,20 @@ var RufousLogoLoader = ({ size = 80, sx, className }) => {
|
|
|
4025
4267
|
height,
|
|
4026
4268
|
className: "rufous-logo-loader__svg"
|
|
4027
4269
|
},
|
|
4028
|
-
/* @__PURE__ */
|
|
4270
|
+
/* @__PURE__ */ React74.createElement("defs", null, /* @__PURE__ */ React74.createElement("clipPath", { id: clipId }, /* @__PURE__ */ React74.createElement(
|
|
4029
4271
|
"path",
|
|
4030
4272
|
{
|
|
4031
4273
|
transform: "translate(2208 18.205)",
|
|
4032
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"
|
|
4033
4275
|
}
|
|
4034
4276
|
))),
|
|
4035
|
-
/* @__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" })))
|
|
4036
4278
|
));
|
|
4037
4279
|
};
|
|
4038
4280
|
|
|
4039
4281
|
// lib/DataGrid/DataGrid.tsx
|
|
4040
4282
|
var import_react23 = __toESM(require("react"), 1);
|
|
4041
4283
|
var import_lucide_react2 = require("lucide-react");
|
|
4042
|
-
|
|
4043
|
-
// lib/Tooltip/Tooltip.tsx
|
|
4044
|
-
var import_react22 = __toESM(require("react"), 1);
|
|
4045
|
-
var import_react_dom4 = __toESM(require("react-dom"), 1);
|
|
4046
|
-
var GAP = 8;
|
|
4047
|
-
function computePosition(anchor, tooltip, placement) {
|
|
4048
|
-
const { top: aTop, left: aLeft, width: aW, height: aH } = anchor;
|
|
4049
|
-
const { width: tW, height: tH } = tooltip;
|
|
4050
|
-
let top = 0;
|
|
4051
|
-
let left = 0;
|
|
4052
|
-
let arrowLeft;
|
|
4053
|
-
let arrowTop;
|
|
4054
|
-
switch (placement) {
|
|
4055
|
-
case "top":
|
|
4056
|
-
top = aTop - tH - GAP;
|
|
4057
|
-
left = aLeft + aW / 2 - tW / 2;
|
|
4058
|
-
arrowLeft = tW / 2 - 4;
|
|
4059
|
-
break;
|
|
4060
|
-
case "top-start":
|
|
4061
|
-
top = aTop - tH - GAP;
|
|
4062
|
-
left = aLeft;
|
|
4063
|
-
arrowLeft = Math.min(aW / 2, tW - 16);
|
|
4064
|
-
break;
|
|
4065
|
-
case "top-end":
|
|
4066
|
-
top = aTop - tH - GAP;
|
|
4067
|
-
left = aLeft + aW - tW;
|
|
4068
|
-
arrowLeft = Math.max(tW - aW / 2 - 4, 8);
|
|
4069
|
-
break;
|
|
4070
|
-
case "bottom":
|
|
4071
|
-
top = aTop + aH + GAP;
|
|
4072
|
-
left = aLeft + aW / 2 - tW / 2;
|
|
4073
|
-
arrowLeft = tW / 2 - 4;
|
|
4074
|
-
break;
|
|
4075
|
-
case "bottom-start":
|
|
4076
|
-
top = aTop + aH + GAP;
|
|
4077
|
-
left = aLeft;
|
|
4078
|
-
arrowLeft = Math.min(aW / 2, tW - 16);
|
|
4079
|
-
break;
|
|
4080
|
-
case "bottom-end":
|
|
4081
|
-
top = aTop + aH + GAP;
|
|
4082
|
-
left = aLeft + aW - tW;
|
|
4083
|
-
arrowLeft = Math.max(tW - aW / 2 - 4, 8);
|
|
4084
|
-
break;
|
|
4085
|
-
case "left":
|
|
4086
|
-
top = aTop + aH / 2 - tH / 2;
|
|
4087
|
-
left = aLeft - tW - GAP;
|
|
4088
|
-
arrowTop = tH / 2 - 4;
|
|
4089
|
-
break;
|
|
4090
|
-
case "left-start":
|
|
4091
|
-
top = aTop;
|
|
4092
|
-
left = aLeft - tW - GAP;
|
|
4093
|
-
arrowTop = Math.min(aH / 2, tH - 16);
|
|
4094
|
-
break;
|
|
4095
|
-
case "left-end":
|
|
4096
|
-
top = aTop + aH - tH;
|
|
4097
|
-
left = aLeft - tW - GAP;
|
|
4098
|
-
arrowTop = Math.max(tH - aH / 2 - 4, 8);
|
|
4099
|
-
break;
|
|
4100
|
-
case "right":
|
|
4101
|
-
top = aTop + aH / 2 - tH / 2;
|
|
4102
|
-
left = aLeft + aW + GAP;
|
|
4103
|
-
arrowTop = tH / 2 - 4;
|
|
4104
|
-
break;
|
|
4105
|
-
case "right-start":
|
|
4106
|
-
top = aTop;
|
|
4107
|
-
left = aLeft + aW + GAP;
|
|
4108
|
-
arrowTop = Math.min(aH / 2, tH - 16);
|
|
4109
|
-
break;
|
|
4110
|
-
case "right-end":
|
|
4111
|
-
top = aTop + aH - tH;
|
|
4112
|
-
left = aLeft + aW + GAP;
|
|
4113
|
-
arrowTop = Math.max(tH - aH / 2 - 4, 8);
|
|
4114
|
-
break;
|
|
4115
|
-
default:
|
|
4116
|
-
top = aTop - tH - GAP;
|
|
4117
|
-
left = aLeft + aW / 2 - tW / 2;
|
|
4118
|
-
}
|
|
4119
|
-
const vw = window.innerWidth;
|
|
4120
|
-
const vh = window.innerHeight;
|
|
4121
|
-
left = Math.max(8, Math.min(left, vw - tW - 8));
|
|
4122
|
-
top = Math.max(8, Math.min(top, vh - tH - 8));
|
|
4123
|
-
return { top, left, arrowLeft, arrowTop };
|
|
4124
|
-
}
|
|
4125
|
-
var Tooltip = ({
|
|
4126
|
-
title,
|
|
4127
|
-
placement = "top",
|
|
4128
|
-
arrow = false,
|
|
4129
|
-
open: controlledOpen,
|
|
4130
|
-
disableHoverListener = false,
|
|
4131
|
-
disableFocusListener = false,
|
|
4132
|
-
enterDelay = 100,
|
|
4133
|
-
leaveDelay = 0,
|
|
4134
|
-
children,
|
|
4135
|
-
followCursor = false,
|
|
4136
|
-
className = "",
|
|
4137
|
-
style,
|
|
4138
|
-
sx
|
|
4139
|
-
}) => {
|
|
4140
|
-
const sxClass = useSx(sx);
|
|
4141
|
-
const [internalOpen, setInternalOpen] = (0, import_react22.useState)(false);
|
|
4142
|
-
const [position, setPosition] = (0, import_react22.useState)({ top: 0, left: 0 });
|
|
4143
|
-
const anchorRef = (0, import_react22.useRef)(null);
|
|
4144
|
-
const tooltipRef = (0, import_react22.useRef)(null);
|
|
4145
|
-
const enterTimer = (0, import_react22.useRef)(null);
|
|
4146
|
-
const leaveTimer = (0, import_react22.useRef)(null);
|
|
4147
|
-
const cursorPos = (0, import_react22.useRef)({ x: 0, y: 0 });
|
|
4148
|
-
const isOpen = controlledOpen !== void 0 ? controlledOpen : internalOpen;
|
|
4149
|
-
const clearTimers = (0, import_react22.useCallback)(() => {
|
|
4150
|
-
if (enterTimer.current) clearTimeout(enterTimer.current);
|
|
4151
|
-
if (leaveTimer.current) clearTimeout(leaveTimer.current);
|
|
4152
|
-
}, []);
|
|
4153
|
-
const updatePosition = (0, import_react22.useCallback)(() => {
|
|
4154
|
-
if (!anchorRef.current || !tooltipRef.current) return;
|
|
4155
|
-
const anchorRect = anchorRef.current.getBoundingClientRect();
|
|
4156
|
-
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
4157
|
-
if (followCursor) {
|
|
4158
|
-
const fakeRect = {
|
|
4159
|
-
top: cursorPos.current.y,
|
|
4160
|
-
left: cursorPos.current.x,
|
|
4161
|
-
right: cursorPos.current.x,
|
|
4162
|
-
bottom: cursorPos.current.y,
|
|
4163
|
-
width: 0,
|
|
4164
|
-
height: 0,
|
|
4165
|
-
x: cursorPos.current.x,
|
|
4166
|
-
y: cursorPos.current.y,
|
|
4167
|
-
toJSON: () => ({})
|
|
4168
|
-
};
|
|
4169
|
-
setPosition(computePosition(fakeRect, tooltipRect, placement));
|
|
4170
|
-
} else {
|
|
4171
|
-
setPosition(computePosition(anchorRect, tooltipRect, placement));
|
|
4172
|
-
}
|
|
4173
|
-
}, [placement, followCursor]);
|
|
4174
|
-
(0, import_react22.useEffect)(() => {
|
|
4175
|
-
if (isOpen) {
|
|
4176
|
-
requestAnimationFrame(() => {
|
|
4177
|
-
updatePosition();
|
|
4178
|
-
});
|
|
4179
|
-
}
|
|
4180
|
-
}, [isOpen, updatePosition]);
|
|
4181
|
-
const handleOpen = (0, import_react22.useCallback)(() => {
|
|
4182
|
-
clearTimers();
|
|
4183
|
-
if (enterDelay > 0) {
|
|
4184
|
-
enterTimer.current = setTimeout(() => {
|
|
4185
|
-
setInternalOpen(true);
|
|
4186
|
-
}, enterDelay);
|
|
4187
|
-
} else {
|
|
4188
|
-
setInternalOpen(true);
|
|
4189
|
-
}
|
|
4190
|
-
}, [enterDelay, clearTimers]);
|
|
4191
|
-
const handleClose = (0, import_react22.useCallback)(() => {
|
|
4192
|
-
clearTimers();
|
|
4193
|
-
if (leaveDelay > 0) {
|
|
4194
|
-
leaveTimer.current = setTimeout(() => {
|
|
4195
|
-
setInternalOpen(false);
|
|
4196
|
-
}, leaveDelay);
|
|
4197
|
-
} else {
|
|
4198
|
-
setInternalOpen(false);
|
|
4199
|
-
}
|
|
4200
|
-
}, [leaveDelay, clearTimers]);
|
|
4201
|
-
const handleMouseMove = (0, import_react22.useCallback)(
|
|
4202
|
-
(e) => {
|
|
4203
|
-
cursorPos.current = { x: e.clientX, y: e.clientY };
|
|
4204
|
-
if (isOpen && followCursor) {
|
|
4205
|
-
updatePosition();
|
|
4206
|
-
}
|
|
4207
|
-
},
|
|
4208
|
-
[isOpen, followCursor, updatePosition]
|
|
4209
|
-
);
|
|
4210
|
-
(0, import_react22.useEffect)(() => {
|
|
4211
|
-
return () => clearTimers();
|
|
4212
|
-
}, [clearTimers]);
|
|
4213
|
-
const childProps = {};
|
|
4214
|
-
if (!disableHoverListener) {
|
|
4215
|
-
childProps.onMouseEnter = handleOpen;
|
|
4216
|
-
childProps.onMouseLeave = handleClose;
|
|
4217
|
-
childProps.onMouseMove = followCursor ? handleMouseMove : void 0;
|
|
4218
|
-
}
|
|
4219
|
-
if (!disableFocusListener) {
|
|
4220
|
-
childProps.onFocus = handleOpen;
|
|
4221
|
-
childProps.onBlur = handleClose;
|
|
4222
|
-
}
|
|
4223
|
-
const tooltipClasses = [
|
|
4224
|
-
"rf-tooltip",
|
|
4225
|
-
`rf-tooltip--placement-${placement}`,
|
|
4226
|
-
isOpen ? "rf-tooltip--visible" : "",
|
|
4227
|
-
sxClass,
|
|
4228
|
-
className
|
|
4229
|
-
].filter(Boolean).join(" ");
|
|
4230
|
-
const tooltipElement = /* @__PURE__ */ import_react22.default.createElement(
|
|
4231
|
-
"div",
|
|
4232
|
-
{
|
|
4233
|
-
ref: tooltipRef,
|
|
4234
|
-
className: tooltipClasses,
|
|
4235
|
-
style: {
|
|
4236
|
-
top: position.top,
|
|
4237
|
-
left: position.left,
|
|
4238
|
-
...style
|
|
4239
|
-
},
|
|
4240
|
-
role: "tooltip",
|
|
4241
|
-
"aria-hidden": !isOpen
|
|
4242
|
-
},
|
|
4243
|
-
title,
|
|
4244
|
-
arrow && /* @__PURE__ */ import_react22.default.createElement(
|
|
4245
|
-
"span",
|
|
4246
|
-
{
|
|
4247
|
-
className: "rf-tooltip__arrow",
|
|
4248
|
-
style: {
|
|
4249
|
-
...position.arrowLeft !== void 0 ? { left: position.arrowLeft } : {},
|
|
4250
|
-
...position.arrowTop !== void 0 ? { top: position.arrowTop } : {}
|
|
4251
|
-
}
|
|
4252
|
-
}
|
|
4253
|
-
)
|
|
4254
|
-
);
|
|
4255
|
-
return /* @__PURE__ */ import_react22.default.createElement(import_react22.default.Fragment, null, /* @__PURE__ */ import_react22.default.createElement(
|
|
4256
|
-
"span",
|
|
4257
|
-
{
|
|
4258
|
-
ref: anchorRef,
|
|
4259
|
-
style: { display: "inline-flex", position: "relative" },
|
|
4260
|
-
"aria-describedby": isOpen ? "rf-tooltip" : void 0,
|
|
4261
|
-
...childProps
|
|
4262
|
-
},
|
|
4263
|
-
import_react22.default.cloneElement(children)
|
|
4264
|
-
), import_react_dom4.default.createPortal(tooltipElement, document.body));
|
|
4265
|
-
};
|
|
4266
|
-
Tooltip.displayName = "Tooltip";
|
|
4267
|
-
|
|
4268
|
-
// lib/DataGrid/DataGrid.tsx
|
|
4269
4284
|
var getOperatorsForType = (type) => {
|
|
4270
4285
|
if (type === "date") return [
|
|
4271
4286
|
{ value: "is", label: "is" },
|