@grandbazar/ui-baza 1.2.7 → 1.2.9
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/index.cjs +129 -68
- package/dist/index.d.ts +4 -2
- package/dist/index.js +129 -68
- package/dist/style.css +9 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1810,38 +1810,6 @@ function handleDropdownMouseLeave(event, { ignoreRelatedTargetRef, setIsOpen })
|
|
|
1810
1810
|
setIsOpen(false);
|
|
1811
1811
|
}
|
|
1812
1812
|
|
|
1813
|
-
function usePortalHandlersByEventTrigger() {
|
|
1814
|
-
const { triggerRef, setIsOpen } = useDropdownMenuContext();
|
|
1815
|
-
const handlePortalBlur = React.useCallback(
|
|
1816
|
-
(event) => {
|
|
1817
|
-
const relatedTarget = event.relatedTarget;
|
|
1818
|
-
if (!(relatedTarget instanceof Node)) {
|
|
1819
|
-
setIsOpen(false);
|
|
1820
|
-
return;
|
|
1821
|
-
}
|
|
1822
|
-
if (event.currentTarget.contains(relatedTarget) || triggerRef.current?.contains(relatedTarget)) {
|
|
1823
|
-
return;
|
|
1824
|
-
}
|
|
1825
|
-
setIsOpen(false);
|
|
1826
|
-
},
|
|
1827
|
-
[setIsOpen, triggerRef]
|
|
1828
|
-
);
|
|
1829
|
-
const portalHandlersByEvent = React.useMemo(
|
|
1830
|
-
() => ({
|
|
1831
|
-
click: {},
|
|
1832
|
-
hover: {
|
|
1833
|
-
onMouseLeave: (event) => handleDropdownMouseLeave(event, {
|
|
1834
|
-
ignoreRelatedTargetRef: triggerRef,
|
|
1835
|
-
setIsOpen
|
|
1836
|
-
}),
|
|
1837
|
-
onBlur: handlePortalBlur
|
|
1838
|
-
}
|
|
1839
|
-
}),
|
|
1840
|
-
[handlePortalBlur, setIsOpen, triggerRef]
|
|
1841
|
-
);
|
|
1842
|
-
return portalHandlersByEvent;
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
1813
|
const getAdjustedAlign = ({
|
|
1846
1814
|
align,
|
|
1847
1815
|
translateAxis,
|
|
@@ -1934,42 +1902,131 @@ function getAdjustedPlacement({
|
|
|
1934
1902
|
return { position: adjustedPosition, align: adjustedAlign };
|
|
1935
1903
|
}
|
|
1936
1904
|
|
|
1937
|
-
function
|
|
1905
|
+
function syncPortalPosition({
|
|
1906
|
+
align,
|
|
1907
|
+
position,
|
|
1908
|
+
offset,
|
|
1909
|
+
portalWidth,
|
|
1910
|
+
portalHeight,
|
|
1911
|
+
triggerRect,
|
|
1912
|
+
setPortalPlacement,
|
|
1913
|
+
setPortalPosition,
|
|
1914
|
+
scrollContainer
|
|
1915
|
+
}) {
|
|
1916
|
+
const isWindowScrollContainer = !scrollContainer;
|
|
1917
|
+
const scrollCoords = {
|
|
1918
|
+
x: isWindowScrollContainer ? window.scrollX : scrollContainer.scrollLeft,
|
|
1919
|
+
y: isWindowScrollContainer ? window.scrollY : scrollContainer.scrollTop
|
|
1920
|
+
};
|
|
1921
|
+
const viewportPosition = {
|
|
1922
|
+
left: scrollCoords.x,
|
|
1923
|
+
right: scrollCoords.x + (isWindowScrollContainer ? window.innerWidth : scrollContainer.clientWidth),
|
|
1924
|
+
top: scrollCoords.y,
|
|
1925
|
+
bottom: scrollCoords.y + (isWindowScrollContainer ? window.innerHeight : scrollContainer.clientHeight)
|
|
1926
|
+
};
|
|
1927
|
+
const { position: adjustedPosition, align: adjustedAlign } = getAdjustedPlacement({
|
|
1928
|
+
align,
|
|
1929
|
+
position,
|
|
1930
|
+
viewportPosition,
|
|
1931
|
+
portalWidth,
|
|
1932
|
+
portalHeight,
|
|
1933
|
+
scrollCoords,
|
|
1934
|
+
triggerRect
|
|
1935
|
+
});
|
|
1936
|
+
setPortalPlacement({ position: adjustedPosition, align: adjustedAlign });
|
|
1937
|
+
const newPortalPosition = getPortalPosition({
|
|
1938
|
+
align: adjustedAlign,
|
|
1939
|
+
position: adjustedPosition,
|
|
1940
|
+
offset,
|
|
1941
|
+
triggerRect,
|
|
1942
|
+
scrollCoords
|
|
1943
|
+
});
|
|
1944
|
+
setPortalPosition(newPortalPosition);
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
function usePortalHandlersByEventTrigger() {
|
|
1948
|
+
const { triggerRef, setIsOpen } = useDropdownMenuContext();
|
|
1949
|
+
const handlePortalBlur = React.useCallback(
|
|
1950
|
+
(event) => {
|
|
1951
|
+
const relatedTarget = event.relatedTarget;
|
|
1952
|
+
if (!(relatedTarget instanceof Node)) {
|
|
1953
|
+
setIsOpen(false);
|
|
1954
|
+
return;
|
|
1955
|
+
}
|
|
1956
|
+
if (event.currentTarget.contains(relatedTarget) || triggerRef.current?.contains(relatedTarget)) {
|
|
1957
|
+
return;
|
|
1958
|
+
}
|
|
1959
|
+
setIsOpen(false);
|
|
1960
|
+
},
|
|
1961
|
+
[setIsOpen, triggerRef]
|
|
1962
|
+
);
|
|
1963
|
+
const portalHandlersByEvent = React.useMemo(
|
|
1964
|
+
() => ({
|
|
1965
|
+
click: {},
|
|
1966
|
+
hover: {
|
|
1967
|
+
onMouseLeave: (event) => handleDropdownMouseLeave(event, {
|
|
1968
|
+
ignoreRelatedTargetRef: triggerRef,
|
|
1969
|
+
setIsOpen
|
|
1970
|
+
}),
|
|
1971
|
+
onBlur: handlePortalBlur
|
|
1972
|
+
}
|
|
1973
|
+
}),
|
|
1974
|
+
[handlePortalBlur, setIsOpen, triggerRef]
|
|
1975
|
+
);
|
|
1976
|
+
return portalHandlersByEvent;
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
function usePortalPosition({
|
|
1980
|
+
align,
|
|
1981
|
+
position,
|
|
1982
|
+
offset,
|
|
1983
|
+
portalWidth,
|
|
1984
|
+
portalHeight,
|
|
1985
|
+
scrollContainerRef
|
|
1986
|
+
}) {
|
|
1938
1987
|
const { isOpen, triggerRef, setPortalPlacement } = useDropdownMenuContext();
|
|
1939
1988
|
const [portalPosition, setPortalPosition] = React.useState();
|
|
1940
1989
|
React.useEffect(() => {
|
|
1941
|
-
if (isOpen
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
const
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1990
|
+
if (!isOpen || !triggerRef.current) {
|
|
1991
|
+
return;
|
|
1992
|
+
}
|
|
1993
|
+
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
1994
|
+
const scrollContainer = scrollContainerRef?.current;
|
|
1995
|
+
if (scrollContainer) {
|
|
1996
|
+
const containerRect = scrollContainer.getBoundingClientRect();
|
|
1997
|
+
const normalizedTriggerRect = {
|
|
1998
|
+
...triggerRect,
|
|
1999
|
+
x: triggerRect.x - containerRect.left - scrollContainer.clientLeft,
|
|
2000
|
+
y: triggerRect.y - containerRect.top - scrollContainer.clientTop,
|
|
2001
|
+
top: triggerRect.top - containerRect.top - scrollContainer.clientTop,
|
|
2002
|
+
right: triggerRect.right - containerRect.left - scrollContainer.clientLeft,
|
|
2003
|
+
bottom: triggerRect.bottom - containerRect.top - scrollContainer.clientTop,
|
|
2004
|
+
left: triggerRect.left - containerRect.left - scrollContainer.clientLeft
|
|
1952
2005
|
};
|
|
1953
|
-
|
|
2006
|
+
syncPortalPosition({
|
|
1954
2007
|
align,
|
|
1955
2008
|
position,
|
|
1956
|
-
|
|
2009
|
+
offset,
|
|
1957
2010
|
portalWidth,
|
|
1958
2011
|
portalHeight,
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
const newPortalPosition = getPortalPosition({
|
|
1964
|
-
align: adjustedAlign,
|
|
1965
|
-
position: adjustedPosition,
|
|
1966
|
-
offset,
|
|
1967
|
-
triggerRect,
|
|
1968
|
-
scrollCoords
|
|
2012
|
+
triggerRect: normalizedTriggerRect,
|
|
2013
|
+
setPortalPlacement,
|
|
2014
|
+
setPortalPosition,
|
|
2015
|
+
scrollContainer
|
|
1969
2016
|
});
|
|
1970
|
-
|
|
2017
|
+
return;
|
|
1971
2018
|
}
|
|
1972
|
-
|
|
2019
|
+
syncPortalPosition({
|
|
2020
|
+
align,
|
|
2021
|
+
position,
|
|
2022
|
+
offset,
|
|
2023
|
+
portalWidth,
|
|
2024
|
+
portalHeight,
|
|
2025
|
+
triggerRect,
|
|
2026
|
+
setPortalPlacement,
|
|
2027
|
+
setPortalPosition
|
|
2028
|
+
});
|
|
2029
|
+
}, [align, isOpen, offset, portalHeight, portalWidth, position, scrollContainerRef, setPortalPlacement, triggerRef]);
|
|
1973
2030
|
return portalPosition;
|
|
1974
2031
|
}
|
|
1975
2032
|
|
|
@@ -2016,7 +2073,8 @@ function DropdownPortal({
|
|
|
2016
2073
|
isNested,
|
|
2017
2074
|
offset = DROPDOWN_PORTAL_DEFAULT_OFFSET,
|
|
2018
2075
|
maxWidth,
|
|
2019
|
-
maxHeight
|
|
2076
|
+
maxHeight,
|
|
2077
|
+
scrollContainerRef
|
|
2020
2078
|
}) {
|
|
2021
2079
|
const { portalRef, triggerEvent, isOpen } = useDropdownMenuContext();
|
|
2022
2080
|
const handlersByTrigger = usePortalHandlersByEventTrigger();
|
|
@@ -2025,7 +2083,8 @@ function DropdownPortal({
|
|
|
2025
2083
|
position,
|
|
2026
2084
|
offset,
|
|
2027
2085
|
...maxWidth && { portalWidth: maxWidth + offset },
|
|
2028
|
-
...maxHeight && { portalHeight: maxHeight + offset }
|
|
2086
|
+
...maxHeight && { portalHeight: maxHeight + offset },
|
|
2087
|
+
scrollContainerRef
|
|
2029
2088
|
});
|
|
2030
2089
|
if (!isOpen || !portalPosition) {
|
|
2031
2090
|
return null;
|
|
@@ -2046,7 +2105,7 @@ function DropdownPortal({
|
|
|
2046
2105
|
children
|
|
2047
2106
|
}
|
|
2048
2107
|
),
|
|
2049
|
-
document.body
|
|
2108
|
+
scrollContainerRef?.current ?? document.body
|
|
2050
2109
|
);
|
|
2051
2110
|
}
|
|
2052
2111
|
|
|
@@ -2322,10 +2381,10 @@ function RadioButton({ className, label, ...props }) {
|
|
|
2322
2381
|
|
|
2323
2382
|
const DEFAULT_CUSTOM_SEARCH_BUTTON_WIDTH = 64;
|
|
2324
2383
|
|
|
2325
|
-
const textFieldAreaWrapper = "
|
|
2326
|
-
const textFieldAreaLabel = "
|
|
2327
|
-
const textFieldAreaLabelSuffix = "
|
|
2328
|
-
const textFieldArea = "
|
|
2384
|
+
const textFieldAreaWrapper = "_textFieldAreaWrapper_ay9ou_2";
|
|
2385
|
+
const textFieldAreaLabel = "_textFieldAreaLabel_ay9ou_14";
|
|
2386
|
+
const textFieldAreaLabelSuffix = "_textFieldAreaLabelSuffix_ay9ou_24";
|
|
2387
|
+
const textFieldArea = "_textFieldArea_ay9ou_2";
|
|
2329
2388
|
const styles$b = {
|
|
2330
2389
|
textFieldAreaWrapper: textFieldAreaWrapper,
|
|
2331
2390
|
textFieldAreaLabel: textFieldAreaLabel,
|
|
@@ -2359,9 +2418,9 @@ function TextFieldArea({
|
|
|
2359
2418
|
] }) : textFieldArea;
|
|
2360
2419
|
}
|
|
2361
2420
|
|
|
2362
|
-
const textFieldInputWrapper = "
|
|
2363
|
-
const textFieldInputLabel = "
|
|
2364
|
-
const textFieldInput = "
|
|
2421
|
+
const textFieldInputWrapper = "_textFieldInputWrapper_qpk1n_2";
|
|
2422
|
+
const textFieldInputLabel = "_textFieldInputLabel_qpk1n_9";
|
|
2423
|
+
const textFieldInput = "_textFieldInput_qpk1n_2";
|
|
2365
2424
|
const styles$a = {
|
|
2366
2425
|
textFieldInputWrapper: textFieldInputWrapper,
|
|
2367
2426
|
textFieldInputLabel: textFieldInputLabel,
|
|
@@ -2774,6 +2833,7 @@ function TooltipRoot({
|
|
|
2774
2833
|
maxWidth,
|
|
2775
2834
|
maxHeight,
|
|
2776
2835
|
withoutArrow = false,
|
|
2836
|
+
scrollContainerRef,
|
|
2777
2837
|
...tooltipContentProps
|
|
2778
2838
|
}) {
|
|
2779
2839
|
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu.Root, { children: ({ portalPlacement }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -2786,6 +2846,7 @@ function TooltipRoot({
|
|
|
2786
2846
|
offset: TOOLTIP_OFFSET,
|
|
2787
2847
|
maxWidth,
|
|
2788
2848
|
maxHeight,
|
|
2849
|
+
scrollContainerRef,
|
|
2789
2850
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2790
2851
|
TooltipContent,
|
|
2791
2852
|
{
|
package/dist/index.d.ts
CHANGED
|
@@ -190,7 +190,7 @@ export declare namespace DropdownMenu {
|
|
|
190
190
|
var Portal: typeof DropdownPortal;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
declare function DropdownPortal({ children, className, align, position, isNested, offset, maxWidth, maxHeight, }: TDropdownPortalProps): ReactPortal | null;
|
|
193
|
+
declare function DropdownPortal({ children, className, align, position, isNested, offset, maxWidth, maxHeight, scrollContainerRef, }: TDropdownPortalProps): ReactPortal | null;
|
|
194
194
|
|
|
195
195
|
declare function DropdownRoot({ children }: TDropdownRootProps): JSX.Element;
|
|
196
196
|
|
|
@@ -670,6 +670,7 @@ declare type TDropdownPortalProps = {
|
|
|
670
670
|
offset?: number;
|
|
671
671
|
maxWidth?: number;
|
|
672
672
|
maxHeight?: number;
|
|
673
|
+
scrollContainerRef?: React.RefObject<HTMLElement | null>;
|
|
673
674
|
};
|
|
674
675
|
|
|
675
676
|
declare type TDropdownRootProps = {
|
|
@@ -742,7 +743,7 @@ export declare namespace Tooltip {
|
|
|
742
743
|
|
|
743
744
|
declare function TooltipContent({ className, role, title, description, arrowAlign, arrowPosition, arrowOffset, ...props }: TTooltipContentProps): JSX.Element;
|
|
744
745
|
|
|
745
|
-
declare function TooltipRoot({ children, align, position, triggerEvent, maxWidth, maxHeight, withoutArrow, ...tooltipContentProps }: TTooltipRootProps): JSX.Element;
|
|
746
|
+
declare function TooltipRoot({ children, align, position, triggerEvent, maxWidth, maxHeight, withoutArrow, scrollContainerRef, ...tooltipContentProps }: TTooltipRootProps): JSX.Element;
|
|
746
747
|
|
|
747
748
|
declare type TPaginationItemProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
748
749
|
size?: TArrayElement<typeof PAGINATION_SIZES>;
|
|
@@ -882,6 +883,7 @@ declare type TTooltipRootProps = Omit<React.ComponentProps<typeof TooltipContent
|
|
|
882
883
|
maxWidth?: number;
|
|
883
884
|
maxHeight?: number;
|
|
884
885
|
withoutArrow?: boolean;
|
|
886
|
+
scrollContainerRef?: React.RefObject<HTMLElement | null>;
|
|
885
887
|
};
|
|
886
888
|
|
|
887
889
|
declare type TWithRef<TProps, TElement = HTMLElement> = TProps & {
|
package/dist/index.js
CHANGED
|
@@ -1806,38 +1806,6 @@ function handleDropdownMouseLeave(event, { ignoreRelatedTargetRef, setIsOpen })
|
|
|
1806
1806
|
setIsOpen(false);
|
|
1807
1807
|
}
|
|
1808
1808
|
|
|
1809
|
-
function usePortalHandlersByEventTrigger() {
|
|
1810
|
-
const { triggerRef, setIsOpen } = useDropdownMenuContext();
|
|
1811
|
-
const handlePortalBlur = useCallback(
|
|
1812
|
-
(event) => {
|
|
1813
|
-
const relatedTarget = event.relatedTarget;
|
|
1814
|
-
if (!(relatedTarget instanceof Node)) {
|
|
1815
|
-
setIsOpen(false);
|
|
1816
|
-
return;
|
|
1817
|
-
}
|
|
1818
|
-
if (event.currentTarget.contains(relatedTarget) || triggerRef.current?.contains(relatedTarget)) {
|
|
1819
|
-
return;
|
|
1820
|
-
}
|
|
1821
|
-
setIsOpen(false);
|
|
1822
|
-
},
|
|
1823
|
-
[setIsOpen, triggerRef]
|
|
1824
|
-
);
|
|
1825
|
-
const portalHandlersByEvent = useMemo(
|
|
1826
|
-
() => ({
|
|
1827
|
-
click: {},
|
|
1828
|
-
hover: {
|
|
1829
|
-
onMouseLeave: (event) => handleDropdownMouseLeave(event, {
|
|
1830
|
-
ignoreRelatedTargetRef: triggerRef,
|
|
1831
|
-
setIsOpen
|
|
1832
|
-
}),
|
|
1833
|
-
onBlur: handlePortalBlur
|
|
1834
|
-
}
|
|
1835
|
-
}),
|
|
1836
|
-
[handlePortalBlur, setIsOpen, triggerRef]
|
|
1837
|
-
);
|
|
1838
|
-
return portalHandlersByEvent;
|
|
1839
|
-
}
|
|
1840
|
-
|
|
1841
1809
|
const getAdjustedAlign = ({
|
|
1842
1810
|
align,
|
|
1843
1811
|
translateAxis,
|
|
@@ -1930,42 +1898,131 @@ function getAdjustedPlacement({
|
|
|
1930
1898
|
return { position: adjustedPosition, align: adjustedAlign };
|
|
1931
1899
|
}
|
|
1932
1900
|
|
|
1933
|
-
function
|
|
1901
|
+
function syncPortalPosition({
|
|
1902
|
+
align,
|
|
1903
|
+
position,
|
|
1904
|
+
offset,
|
|
1905
|
+
portalWidth,
|
|
1906
|
+
portalHeight,
|
|
1907
|
+
triggerRect,
|
|
1908
|
+
setPortalPlacement,
|
|
1909
|
+
setPortalPosition,
|
|
1910
|
+
scrollContainer
|
|
1911
|
+
}) {
|
|
1912
|
+
const isWindowScrollContainer = !scrollContainer;
|
|
1913
|
+
const scrollCoords = {
|
|
1914
|
+
x: isWindowScrollContainer ? window.scrollX : scrollContainer.scrollLeft,
|
|
1915
|
+
y: isWindowScrollContainer ? window.scrollY : scrollContainer.scrollTop
|
|
1916
|
+
};
|
|
1917
|
+
const viewportPosition = {
|
|
1918
|
+
left: scrollCoords.x,
|
|
1919
|
+
right: scrollCoords.x + (isWindowScrollContainer ? window.innerWidth : scrollContainer.clientWidth),
|
|
1920
|
+
top: scrollCoords.y,
|
|
1921
|
+
bottom: scrollCoords.y + (isWindowScrollContainer ? window.innerHeight : scrollContainer.clientHeight)
|
|
1922
|
+
};
|
|
1923
|
+
const { position: adjustedPosition, align: adjustedAlign } = getAdjustedPlacement({
|
|
1924
|
+
align,
|
|
1925
|
+
position,
|
|
1926
|
+
viewportPosition,
|
|
1927
|
+
portalWidth,
|
|
1928
|
+
portalHeight,
|
|
1929
|
+
scrollCoords,
|
|
1930
|
+
triggerRect
|
|
1931
|
+
});
|
|
1932
|
+
setPortalPlacement({ position: adjustedPosition, align: adjustedAlign });
|
|
1933
|
+
const newPortalPosition = getPortalPosition({
|
|
1934
|
+
align: adjustedAlign,
|
|
1935
|
+
position: adjustedPosition,
|
|
1936
|
+
offset,
|
|
1937
|
+
triggerRect,
|
|
1938
|
+
scrollCoords
|
|
1939
|
+
});
|
|
1940
|
+
setPortalPosition(newPortalPosition);
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
function usePortalHandlersByEventTrigger() {
|
|
1944
|
+
const { triggerRef, setIsOpen } = useDropdownMenuContext();
|
|
1945
|
+
const handlePortalBlur = useCallback(
|
|
1946
|
+
(event) => {
|
|
1947
|
+
const relatedTarget = event.relatedTarget;
|
|
1948
|
+
if (!(relatedTarget instanceof Node)) {
|
|
1949
|
+
setIsOpen(false);
|
|
1950
|
+
return;
|
|
1951
|
+
}
|
|
1952
|
+
if (event.currentTarget.contains(relatedTarget) || triggerRef.current?.contains(relatedTarget)) {
|
|
1953
|
+
return;
|
|
1954
|
+
}
|
|
1955
|
+
setIsOpen(false);
|
|
1956
|
+
},
|
|
1957
|
+
[setIsOpen, triggerRef]
|
|
1958
|
+
);
|
|
1959
|
+
const portalHandlersByEvent = useMemo(
|
|
1960
|
+
() => ({
|
|
1961
|
+
click: {},
|
|
1962
|
+
hover: {
|
|
1963
|
+
onMouseLeave: (event) => handleDropdownMouseLeave(event, {
|
|
1964
|
+
ignoreRelatedTargetRef: triggerRef,
|
|
1965
|
+
setIsOpen
|
|
1966
|
+
}),
|
|
1967
|
+
onBlur: handlePortalBlur
|
|
1968
|
+
}
|
|
1969
|
+
}),
|
|
1970
|
+
[handlePortalBlur, setIsOpen, triggerRef]
|
|
1971
|
+
);
|
|
1972
|
+
return portalHandlersByEvent;
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1975
|
+
function usePortalPosition({
|
|
1976
|
+
align,
|
|
1977
|
+
position,
|
|
1978
|
+
offset,
|
|
1979
|
+
portalWidth,
|
|
1980
|
+
portalHeight,
|
|
1981
|
+
scrollContainerRef
|
|
1982
|
+
}) {
|
|
1934
1983
|
const { isOpen, triggerRef, setPortalPlacement } = useDropdownMenuContext();
|
|
1935
1984
|
const [portalPosition, setPortalPosition] = useState();
|
|
1936
1985
|
useEffect(() => {
|
|
1937
|
-
if (isOpen
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
const
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1986
|
+
if (!isOpen || !triggerRef.current) {
|
|
1987
|
+
return;
|
|
1988
|
+
}
|
|
1989
|
+
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
1990
|
+
const scrollContainer = scrollContainerRef?.current;
|
|
1991
|
+
if (scrollContainer) {
|
|
1992
|
+
const containerRect = scrollContainer.getBoundingClientRect();
|
|
1993
|
+
const normalizedTriggerRect = {
|
|
1994
|
+
...triggerRect,
|
|
1995
|
+
x: triggerRect.x - containerRect.left - scrollContainer.clientLeft,
|
|
1996
|
+
y: triggerRect.y - containerRect.top - scrollContainer.clientTop,
|
|
1997
|
+
top: triggerRect.top - containerRect.top - scrollContainer.clientTop,
|
|
1998
|
+
right: triggerRect.right - containerRect.left - scrollContainer.clientLeft,
|
|
1999
|
+
bottom: triggerRect.bottom - containerRect.top - scrollContainer.clientTop,
|
|
2000
|
+
left: triggerRect.left - containerRect.left - scrollContainer.clientLeft
|
|
1948
2001
|
};
|
|
1949
|
-
|
|
2002
|
+
syncPortalPosition({
|
|
1950
2003
|
align,
|
|
1951
2004
|
position,
|
|
1952
|
-
|
|
2005
|
+
offset,
|
|
1953
2006
|
portalWidth,
|
|
1954
2007
|
portalHeight,
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
const newPortalPosition = getPortalPosition({
|
|
1960
|
-
align: adjustedAlign,
|
|
1961
|
-
position: adjustedPosition,
|
|
1962
|
-
offset,
|
|
1963
|
-
triggerRect,
|
|
1964
|
-
scrollCoords
|
|
2008
|
+
triggerRect: normalizedTriggerRect,
|
|
2009
|
+
setPortalPlacement,
|
|
2010
|
+
setPortalPosition,
|
|
2011
|
+
scrollContainer
|
|
1965
2012
|
});
|
|
1966
|
-
|
|
2013
|
+
return;
|
|
1967
2014
|
}
|
|
1968
|
-
|
|
2015
|
+
syncPortalPosition({
|
|
2016
|
+
align,
|
|
2017
|
+
position,
|
|
2018
|
+
offset,
|
|
2019
|
+
portalWidth,
|
|
2020
|
+
portalHeight,
|
|
2021
|
+
triggerRect,
|
|
2022
|
+
setPortalPlacement,
|
|
2023
|
+
setPortalPosition
|
|
2024
|
+
});
|
|
2025
|
+
}, [align, isOpen, offset, portalHeight, portalWidth, position, scrollContainerRef, setPortalPlacement, triggerRef]);
|
|
1969
2026
|
return portalPosition;
|
|
1970
2027
|
}
|
|
1971
2028
|
|
|
@@ -2012,7 +2069,8 @@ function DropdownPortal({
|
|
|
2012
2069
|
isNested,
|
|
2013
2070
|
offset = DROPDOWN_PORTAL_DEFAULT_OFFSET,
|
|
2014
2071
|
maxWidth,
|
|
2015
|
-
maxHeight
|
|
2072
|
+
maxHeight,
|
|
2073
|
+
scrollContainerRef
|
|
2016
2074
|
}) {
|
|
2017
2075
|
const { portalRef, triggerEvent, isOpen } = useDropdownMenuContext();
|
|
2018
2076
|
const handlersByTrigger = usePortalHandlersByEventTrigger();
|
|
@@ -2021,7 +2079,8 @@ function DropdownPortal({
|
|
|
2021
2079
|
position,
|
|
2022
2080
|
offset,
|
|
2023
2081
|
...maxWidth && { portalWidth: maxWidth + offset },
|
|
2024
|
-
...maxHeight && { portalHeight: maxHeight + offset }
|
|
2082
|
+
...maxHeight && { portalHeight: maxHeight + offset },
|
|
2083
|
+
scrollContainerRef
|
|
2025
2084
|
});
|
|
2026
2085
|
if (!isOpen || !portalPosition) {
|
|
2027
2086
|
return null;
|
|
@@ -2042,7 +2101,7 @@ function DropdownPortal({
|
|
|
2042
2101
|
children
|
|
2043
2102
|
}
|
|
2044
2103
|
),
|
|
2045
|
-
document.body
|
|
2104
|
+
scrollContainerRef?.current ?? document.body
|
|
2046
2105
|
);
|
|
2047
2106
|
}
|
|
2048
2107
|
|
|
@@ -2318,10 +2377,10 @@ function RadioButton({ className, label, ...props }) {
|
|
|
2318
2377
|
|
|
2319
2378
|
const DEFAULT_CUSTOM_SEARCH_BUTTON_WIDTH = 64;
|
|
2320
2379
|
|
|
2321
|
-
const textFieldAreaWrapper = "
|
|
2322
|
-
const textFieldAreaLabel = "
|
|
2323
|
-
const textFieldAreaLabelSuffix = "
|
|
2324
|
-
const textFieldArea = "
|
|
2380
|
+
const textFieldAreaWrapper = "_textFieldAreaWrapper_ay9ou_2";
|
|
2381
|
+
const textFieldAreaLabel = "_textFieldAreaLabel_ay9ou_14";
|
|
2382
|
+
const textFieldAreaLabelSuffix = "_textFieldAreaLabelSuffix_ay9ou_24";
|
|
2383
|
+
const textFieldArea = "_textFieldArea_ay9ou_2";
|
|
2325
2384
|
const styles$b = {
|
|
2326
2385
|
textFieldAreaWrapper: textFieldAreaWrapper,
|
|
2327
2386
|
textFieldAreaLabel: textFieldAreaLabel,
|
|
@@ -2355,9 +2414,9 @@ function TextFieldArea({
|
|
|
2355
2414
|
] }) : textFieldArea;
|
|
2356
2415
|
}
|
|
2357
2416
|
|
|
2358
|
-
const textFieldInputWrapper = "
|
|
2359
|
-
const textFieldInputLabel = "
|
|
2360
|
-
const textFieldInput = "
|
|
2417
|
+
const textFieldInputWrapper = "_textFieldInputWrapper_qpk1n_2";
|
|
2418
|
+
const textFieldInputLabel = "_textFieldInputLabel_qpk1n_9";
|
|
2419
|
+
const textFieldInput = "_textFieldInput_qpk1n_2";
|
|
2361
2420
|
const styles$a = {
|
|
2362
2421
|
textFieldInputWrapper: textFieldInputWrapper,
|
|
2363
2422
|
textFieldInputLabel: textFieldInputLabel,
|
|
@@ -2770,6 +2829,7 @@ function TooltipRoot({
|
|
|
2770
2829
|
maxWidth,
|
|
2771
2830
|
maxHeight,
|
|
2772
2831
|
withoutArrow = false,
|
|
2832
|
+
scrollContainerRef,
|
|
2773
2833
|
...tooltipContentProps
|
|
2774
2834
|
}) {
|
|
2775
2835
|
return /* @__PURE__ */ jsx(DropdownMenu.Root, { children: ({ portalPlacement }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
@@ -2782,6 +2842,7 @@ function TooltipRoot({
|
|
|
2782
2842
|
offset: TOOLTIP_OFFSET,
|
|
2783
2843
|
maxWidth,
|
|
2784
2844
|
maxHeight,
|
|
2845
|
+
scrollContainerRef,
|
|
2785
2846
|
children: /* @__PURE__ */ jsx(
|
|
2786
2847
|
TooltipContent,
|
|
2787
2848
|
{
|
package/dist/style.css
CHANGED
|
@@ -1306,11 +1306,10 @@ textarea {
|
|
|
1306
1306
|
}
|
|
1307
1307
|
}
|
|
1308
1308
|
@layer ui_baza_components {
|
|
1309
|
-
.
|
|
1309
|
+
._textFieldAreaWrapper_ay9ou_2 {
|
|
1310
1310
|
display: flex;
|
|
1311
1311
|
position: relative;
|
|
1312
1312
|
flex-grow: 1;
|
|
1313
|
-
height: 100%;
|
|
1314
1313
|
transition: inherit;
|
|
1315
1314
|
|
|
1316
1315
|
&:has([data-element='label']) {
|
|
@@ -1319,7 +1318,7 @@ textarea {
|
|
|
1319
1318
|
}
|
|
1320
1319
|
}
|
|
1321
1320
|
|
|
1322
|
-
.
|
|
1321
|
+
._textFieldAreaLabel_ay9ou_14 {
|
|
1323
1322
|
z-index: 0;
|
|
1324
1323
|
position: absolute;
|
|
1325
1324
|
left: 0;
|
|
@@ -1329,7 +1328,7 @@ textarea {
|
|
|
1329
1328
|
transition: inherit;
|
|
1330
1329
|
}
|
|
1331
1330
|
|
|
1332
|
-
.
|
|
1331
|
+
._textFieldAreaLabelSuffix_ay9ou_24 {
|
|
1333
1332
|
z-index: 0;
|
|
1334
1333
|
position: absolute;
|
|
1335
1334
|
right: 0;
|
|
@@ -1340,11 +1339,11 @@ textarea {
|
|
|
1340
1339
|
transition: inherit;
|
|
1341
1340
|
}
|
|
1342
1341
|
|
|
1343
|
-
.
|
|
1342
|
+
._textFieldAreaWrapper_ay9ou_2:has(._textFieldArea_ay9ou_2:disabled) ._textFieldAreaLabel_ay9ou_14 {
|
|
1344
1343
|
color: var(--color-neutral-340);
|
|
1345
1344
|
}
|
|
1346
1345
|
|
|
1347
|
-
.
|
|
1346
|
+
._textFieldArea_ay9ou_2 {
|
|
1348
1347
|
--text-area-min-height: 80px;
|
|
1349
1348
|
z-index: 1;
|
|
1350
1349
|
position: relative;
|
|
@@ -1369,15 +1368,14 @@ textarea {
|
|
|
1369
1368
|
}
|
|
1370
1369
|
}
|
|
1371
1370
|
@layer ui_baza_components {
|
|
1372
|
-
.
|
|
1371
|
+
._textFieldInputWrapper_qpk1n_2 {
|
|
1373
1372
|
display: flex;
|
|
1374
1373
|
position: relative;
|
|
1375
1374
|
flex-grow: 1;
|
|
1376
|
-
height: 100%;
|
|
1377
1375
|
transition: inherit;
|
|
1378
1376
|
}
|
|
1379
1377
|
|
|
1380
|
-
.
|
|
1378
|
+
._textFieldInputLabel_qpk1n_9 {
|
|
1381
1379
|
z-index: 0;
|
|
1382
1380
|
position: absolute;
|
|
1383
1381
|
left: 0;
|
|
@@ -1387,11 +1385,11 @@ textarea {
|
|
|
1387
1385
|
transition: inherit;
|
|
1388
1386
|
}
|
|
1389
1387
|
|
|
1390
|
-
.
|
|
1388
|
+
._textFieldInputWrapper_qpk1n_2:has(._textFieldInput_qpk1n_2:disabled) ._textFieldInputLabel_qpk1n_9 {
|
|
1391
1389
|
color: var(--color-neutral-340);
|
|
1392
1390
|
}
|
|
1393
1391
|
|
|
1394
|
-
.
|
|
1392
|
+
._textFieldInput_qpk1n_2 {
|
|
1395
1393
|
z-index: 1;
|
|
1396
1394
|
position: relative;
|
|
1397
1395
|
flex-grow: 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grandbazar/ui-baza",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.9",
|
|
4
4
|
"description": "A lightweight and modular UI kit for building modern, accessible web interfaces. Designed for flexibility, scalability, and developer happiness.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|