@beweco/aurora-ui 0.6.58 → 0.6.59
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.js +51 -0
- package/dist/index.esm.js +51 -1
- package/dist/types/components/currency/Currency.d.ts.map +1 -1
- package/dist/types/components/phone/Phone.d.ts.map +1 -1
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/index.d.ts.map +1 -1
- package/dist/types/hooks/useCloseOnAncestorScroll.d.ts +25 -0
- package/dist/types/hooks/useCloseOnAncestorScroll.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1771,6 +1771,42 @@ var Chip = function (_a) {
|
|
|
1771
1771
|
return (jsxRuntime.jsx(react.Chip, __assign({}, props, { onClose: props.onClose, classNames: __assign({ base: colorClasses }, props.classNames) })));
|
|
1772
1772
|
};
|
|
1773
1773
|
|
|
1774
|
+
/**
|
|
1775
|
+
* Cierra un dropdown/popover porteado cuando un ancestro hace scroll.
|
|
1776
|
+
*
|
|
1777
|
+
* Los componentes que portean su contenido a `document.body` y lo posicionan
|
|
1778
|
+
* de forma absoluta con `getBoundingClientRect()` quedan "flotando" en la
|
|
1779
|
+
* posición original cuando un contenedor con scroll se desplaza, porque la
|
|
1780
|
+
* posición no se recalcula. En lugar de reposicionar en cada frame, se cierra
|
|
1781
|
+
* el dropdown ante el scroll de un ancestro (mismo comportamiento que los
|
|
1782
|
+
* overlays de React Aria/HeroUI).
|
|
1783
|
+
*/
|
|
1784
|
+
var useCloseOnAncestorScroll = function (_a) {
|
|
1785
|
+
var isOpen = _a.isOpen, onClose = _a.onClose, contentRef = _a.contentRef;
|
|
1786
|
+
React.useEffect(function () {
|
|
1787
|
+
if (!isOpen) {
|
|
1788
|
+
return;
|
|
1789
|
+
}
|
|
1790
|
+
var handleAncestorScroll = function (event) {
|
|
1791
|
+
var _a;
|
|
1792
|
+
var target = event.target;
|
|
1793
|
+
// Permitir el scroll interno del propio contenido (la lista).
|
|
1794
|
+
if (target && ((_a = contentRef === null || contentRef === void 0 ? void 0 : contentRef.current) === null || _a === void 0 ? void 0 : _a.contains(target))) {
|
|
1795
|
+
return;
|
|
1796
|
+
}
|
|
1797
|
+
onClose();
|
|
1798
|
+
};
|
|
1799
|
+
// `capture` para detectar el scroll de cualquier ancestro, no solo window.
|
|
1800
|
+
window.addEventListener("scroll", handleAncestorScroll, {
|
|
1801
|
+
capture: true,
|
|
1802
|
+
passive: true,
|
|
1803
|
+
});
|
|
1804
|
+
return function () {
|
|
1805
|
+
window.removeEventListener("scroll", handleAncestorScroll, true);
|
|
1806
|
+
};
|
|
1807
|
+
}, [isOpen, onClose, contentRef]);
|
|
1808
|
+
};
|
|
1809
|
+
|
|
1774
1810
|
// Lista de países con código telefónico y código ISO
|
|
1775
1811
|
var countries = [
|
|
1776
1812
|
{ code: "+57", name: "Colombia", country: "CO" },
|
|
@@ -2426,6 +2462,13 @@ var Currency = function (_a) {
|
|
|
2426
2462
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
2427
2463
|
};
|
|
2428
2464
|
}, [isDropdownOpen]);
|
|
2465
|
+
// El dropdown se portea a `body` con posición absoluta fija; cerrarlo cuando
|
|
2466
|
+
// un ancestro hace scroll para que no quede flotando fuera de lugar.
|
|
2467
|
+
useCloseOnAncestorScroll({
|
|
2468
|
+
isOpen: isDropdownOpen,
|
|
2469
|
+
onClose: function () { return setIsDropdownOpen(false); },
|
|
2470
|
+
contentRef: portalDropdownRef,
|
|
2471
|
+
});
|
|
2429
2472
|
var emitChange = function (opt, amount) {
|
|
2430
2473
|
if (showInput) {
|
|
2431
2474
|
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
@@ -4002,6 +4045,13 @@ var Phone = function (_a) {
|
|
|
4002
4045
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
4003
4046
|
};
|
|
4004
4047
|
}, [isDropdownOpen]);
|
|
4048
|
+
// El dropdown se portea a `body` con posición absoluta fija; cerrarlo cuando
|
|
4049
|
+
// un ancestro hace scroll para que no quede flotando fuera de lugar.
|
|
4050
|
+
useCloseOnAncestorScroll({
|
|
4051
|
+
isOpen: isDropdownOpen,
|
|
4052
|
+
onClose: function () { return setIsDropdownOpen(false); },
|
|
4053
|
+
contentRef: portalDropdownRef,
|
|
4054
|
+
});
|
|
4005
4055
|
var handleCountrySelect = function (country) {
|
|
4006
4056
|
setSelectedCountry(country);
|
|
4007
4057
|
setIsDropdownOpen(false);
|
|
@@ -9083,6 +9133,7 @@ exports.removeCustomPrimaryColor = removeCustomPrimaryColor;
|
|
|
9083
9133
|
exports.sizeMap = sizeMap;
|
|
9084
9134
|
exports.themeColors = themeColors;
|
|
9085
9135
|
exports.useAuraToast = useAuraToast;
|
|
9136
|
+
exports.useCloseOnAncestorScroll = useCloseOnAncestorScroll;
|
|
9086
9137
|
exports.useMediaQuery = useMediaQuery;
|
|
9087
9138
|
exports.useNavigationLoading = useNavigationLoading;
|
|
9088
9139
|
exports.useThemeContext = useThemeContext;
|
package/dist/index.esm.js
CHANGED
|
@@ -1772,6 +1772,42 @@ var Chip = function (_a) {
|
|
|
1772
1772
|
return (jsx(Chip$1, __assign({}, props, { onClose: props.onClose, classNames: __assign({ base: colorClasses }, props.classNames) })));
|
|
1773
1773
|
};
|
|
1774
1774
|
|
|
1775
|
+
/**
|
|
1776
|
+
* Cierra un dropdown/popover porteado cuando un ancestro hace scroll.
|
|
1777
|
+
*
|
|
1778
|
+
* Los componentes que portean su contenido a `document.body` y lo posicionan
|
|
1779
|
+
* de forma absoluta con `getBoundingClientRect()` quedan "flotando" en la
|
|
1780
|
+
* posición original cuando un contenedor con scroll se desplaza, porque la
|
|
1781
|
+
* posición no se recalcula. En lugar de reposicionar en cada frame, se cierra
|
|
1782
|
+
* el dropdown ante el scroll de un ancestro (mismo comportamiento que los
|
|
1783
|
+
* overlays de React Aria/HeroUI).
|
|
1784
|
+
*/
|
|
1785
|
+
var useCloseOnAncestorScroll = function (_a) {
|
|
1786
|
+
var isOpen = _a.isOpen, onClose = _a.onClose, contentRef = _a.contentRef;
|
|
1787
|
+
useEffect(function () {
|
|
1788
|
+
if (!isOpen) {
|
|
1789
|
+
return;
|
|
1790
|
+
}
|
|
1791
|
+
var handleAncestorScroll = function (event) {
|
|
1792
|
+
var _a;
|
|
1793
|
+
var target = event.target;
|
|
1794
|
+
// Permitir el scroll interno del propio contenido (la lista).
|
|
1795
|
+
if (target && ((_a = contentRef === null || contentRef === void 0 ? void 0 : contentRef.current) === null || _a === void 0 ? void 0 : _a.contains(target))) {
|
|
1796
|
+
return;
|
|
1797
|
+
}
|
|
1798
|
+
onClose();
|
|
1799
|
+
};
|
|
1800
|
+
// `capture` para detectar el scroll de cualquier ancestro, no solo window.
|
|
1801
|
+
window.addEventListener("scroll", handleAncestorScroll, {
|
|
1802
|
+
capture: true,
|
|
1803
|
+
passive: true,
|
|
1804
|
+
});
|
|
1805
|
+
return function () {
|
|
1806
|
+
window.removeEventListener("scroll", handleAncestorScroll, true);
|
|
1807
|
+
};
|
|
1808
|
+
}, [isOpen, onClose, contentRef]);
|
|
1809
|
+
};
|
|
1810
|
+
|
|
1775
1811
|
// Lista de países con código telefónico y código ISO
|
|
1776
1812
|
var countries = [
|
|
1777
1813
|
{ code: "+57", name: "Colombia", country: "CO" },
|
|
@@ -2427,6 +2463,13 @@ var Currency = function (_a) {
|
|
|
2427
2463
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
2428
2464
|
};
|
|
2429
2465
|
}, [isDropdownOpen]);
|
|
2466
|
+
// El dropdown se portea a `body` con posición absoluta fija; cerrarlo cuando
|
|
2467
|
+
// un ancestro hace scroll para que no quede flotando fuera de lugar.
|
|
2468
|
+
useCloseOnAncestorScroll({
|
|
2469
|
+
isOpen: isDropdownOpen,
|
|
2470
|
+
onClose: function () { return setIsDropdownOpen(false); },
|
|
2471
|
+
contentRef: portalDropdownRef,
|
|
2472
|
+
});
|
|
2430
2473
|
var emitChange = function (opt, amount) {
|
|
2431
2474
|
if (showInput) {
|
|
2432
2475
|
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
@@ -4003,6 +4046,13 @@ var Phone = function (_a) {
|
|
|
4003
4046
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
4004
4047
|
};
|
|
4005
4048
|
}, [isDropdownOpen]);
|
|
4049
|
+
// El dropdown se portea a `body` con posición absoluta fija; cerrarlo cuando
|
|
4050
|
+
// un ancestro hace scroll para que no quede flotando fuera de lugar.
|
|
4051
|
+
useCloseOnAncestorScroll({
|
|
4052
|
+
isOpen: isDropdownOpen,
|
|
4053
|
+
onClose: function () { return setIsDropdownOpen(false); },
|
|
4054
|
+
contentRef: portalDropdownRef,
|
|
4055
|
+
});
|
|
4006
4056
|
var handleCountrySelect = function (country) {
|
|
4007
4057
|
setSelectedCountry(country);
|
|
4008
4058
|
setIsDropdownOpen(false);
|
|
@@ -8972,4 +9022,4 @@ var NavigationLoadingProvider = function (_a) {
|
|
|
8972
9022
|
return (jsxs(NavigationLoadingContext.Provider, { value: value, children: [children, jsx(NavigationLoadingOverlay, { isVisible: isVisible })] }));
|
|
8973
9023
|
};
|
|
8974
9024
|
|
|
8975
|
-
export { ALL_THEMES, AURORA_THEME_FAMILIES, AURORA_THEME_REGISTRY, AccordionList, AddHolidayForm, AnalyticsCard, AreaLineChart, AuraAutocomplete, AuraTable, AuraToastProvider, BEWEOS_THEME_MODE_COOKIE_NAME, BreadcrumbsComponent, Button, Card, Chip, ColorPicker, ColorSelector, ContentCarousel, Currency, DEFAULT_PREDEFINED_COLORS, DatePicker, DateRangePicker, DateSelector, DrawerFilters, EmailPreview, EnumMenuNavListItem, GlobalToast, H1, H2, H3, H4, HeaderComponent, HolidayType, IconComponent, ImagePreview, Input, InputPassword, Kanban, KanbanCard, KanbanColumn, MenuComponent, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, MultiStepWizard, NavigationLoadingContext, NavigationLoadingOverlay, NavigationLoadingProvider, P, Pagination, Phone, PromotionalBanner, REGISTERED_THEME_COLORS, RangeFilter, RowSteps, DEFAULT_TRANSLATIONS$1 as SEGMENTATION_DEFAULT_TRANSLATIONS, ScheduleRow, SearchInput, SegmentationBuilder, Select, SimpleLineChart, SocialMediaBar, SocialMediaCarousel, SocialMediaPreview, StepIndicator, Switch as SwitchComponent, THEME_COLOR_HEX_MAP, TagsFilter, Textarea, ThemeContext, ThemePicker, ThemeProvider, TimeInput as TimeInputComponent, ToastContext, Tooltip, TwoColumnLayoutAgent, UploadFile, VerticalSteps, WhatsAppPreview, Wizard, WizardNavigation, WizardSidebar, applyCustomPrimaryColor, createCurrencyFormatter, uniqueCountries as defaultCountries, defaultCurrencyOptions, defaultTranslations$4 as defaultTranslations, forceLightOnlyThemeBeforeReact, formatAuroraThemeTooltip, generateThemeColorScale, getContrastForeground, getRegisteredThemeColorBases, getSelectedKeyFromPath, hexToThemeColor, hslToCssValue, isAuroraFullThemeId, isExactThemeColor, isGroupState, isHexColor, isSegmentationGroup, removeCustomPrimaryColor, sizeMap, themeColors, useAuraToast, useMediaQuery, useNavigationLoading, useThemeContext };
|
|
9025
|
+
export { ALL_THEMES, AURORA_THEME_FAMILIES, AURORA_THEME_REGISTRY, AccordionList, AddHolidayForm, AnalyticsCard, AreaLineChart, AuraAutocomplete, AuraTable, AuraToastProvider, BEWEOS_THEME_MODE_COOKIE_NAME, BreadcrumbsComponent, Button, Card, Chip, ColorPicker, ColorSelector, ContentCarousel, Currency, DEFAULT_PREDEFINED_COLORS, DatePicker, DateRangePicker, DateSelector, DrawerFilters, EmailPreview, EnumMenuNavListItem, GlobalToast, H1, H2, H3, H4, HeaderComponent, HolidayType, IconComponent, ImagePreview, Input, InputPassword, Kanban, KanbanCard, KanbanColumn, MenuComponent, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, MultiStepWizard, NavigationLoadingContext, NavigationLoadingOverlay, NavigationLoadingProvider, P, Pagination, Phone, PromotionalBanner, REGISTERED_THEME_COLORS, RangeFilter, RowSteps, DEFAULT_TRANSLATIONS$1 as SEGMENTATION_DEFAULT_TRANSLATIONS, ScheduleRow, SearchInput, SegmentationBuilder, Select, SimpleLineChart, SocialMediaBar, SocialMediaCarousel, SocialMediaPreview, StepIndicator, Switch as SwitchComponent, THEME_COLOR_HEX_MAP, TagsFilter, Textarea, ThemeContext, ThemePicker, ThemeProvider, TimeInput as TimeInputComponent, ToastContext, Tooltip, TwoColumnLayoutAgent, UploadFile, VerticalSteps, WhatsAppPreview, Wizard, WizardNavigation, WizardSidebar, applyCustomPrimaryColor, createCurrencyFormatter, uniqueCountries as defaultCountries, defaultCurrencyOptions, defaultTranslations$4 as defaultTranslations, forceLightOnlyThemeBeforeReact, formatAuroraThemeTooltip, generateThemeColorScale, getContrastForeground, getRegisteredThemeColorBases, getSelectedKeyFromPath, hexToThemeColor, hslToCssValue, isAuroraFullThemeId, isExactThemeColor, isGroupState, isHexColor, isSegmentationGroup, removeCustomPrimaryColor, sizeMap, themeColors, useAuraToast, useCloseOnAncestorScroll, useMediaQuery, useNavigationLoading, useThemeContext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Currency.d.ts","sourceRoot":"","sources":["../../../../src/components/currency/Currency.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Currency.d.ts","sourceRoot":"","sources":["../../../../src/components/currency/Currency.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,kBAAkB,EAAiC,MAAM,kBAAkB,CAAC;AAkD1F,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA2SjD,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Phone.d.ts","sourceRoot":"","sources":["../../../../src/components/phone/Phone.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Phone.d.ts","sourceRoot":"","sources":["../../../../src/components/phone/Phone.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAOrD,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA2P3C,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
interface UseCloseOnAncestorScrollOptions {
|
|
3
|
+
/** Si el dropdown/popover está abierto. */
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
/** Callback para cerrar el dropdown/popover. */
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
/**
|
|
8
|
+
* Ref al contenido porteado (la lista). Si el scroll ocurre dentro de este
|
|
9
|
+
* elemento (p. ej. desplazar la lista de opciones) no se cierra.
|
|
10
|
+
*/
|
|
11
|
+
contentRef?: RefObject<HTMLElement | null>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Cierra un dropdown/popover porteado cuando un ancestro hace scroll.
|
|
15
|
+
*
|
|
16
|
+
* Los componentes que portean su contenido a `document.body` y lo posicionan
|
|
17
|
+
* de forma absoluta con `getBoundingClientRect()` quedan "flotando" en la
|
|
18
|
+
* posición original cuando un contenedor con scroll se desplaza, porque la
|
|
19
|
+
* posición no se recalcula. En lugar de reposicionar en cada frame, se cierra
|
|
20
|
+
* el dropdown ante el scroll de un ancestro (mismo comportamiento que los
|
|
21
|
+
* overlays de React Aria/HeroUI).
|
|
22
|
+
*/
|
|
23
|
+
export declare const useCloseOnAncestorScroll: ({ isOpen, onClose, contentRef, }: UseCloseOnAncestorScrollOptions) => void;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=useCloseOnAncestorScroll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCloseOnAncestorScroll.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCloseOnAncestorScroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAElD,UAAU,+BAA+B;IACxC,2CAA2C;IAC3C,MAAM,EAAE,OAAO,CAAC;IAChB,gDAAgD;IAChD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAC3C;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GAAI,kCAItC,+BAA+B,KAAG,IAwBpC,CAAC"}
|