@beweco/aurora-ui 0.6.45 → 0.6.47
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/assets/css/styles.css +1 -1
- package/dist/index.cjs.js +39 -2
- package/dist/index.esm.js +39 -2
- package/dist/types/components/drawer-filters/DrawerFilters.d.ts.map +1 -1
- package/dist/types/components/drawer-filters/_internal/DayMonthPicker.d.ts.map +1 -1
- package/dist/types/components/drawer-filters/index.d.ts +1 -1
- package/dist/types/components/drawer-filters/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -6948,7 +6948,7 @@ var DrawerFiltersHeader = function (_a) {
|
|
|
6948
6948
|
return (jsxRuntime.jsxs("div", { className: "px-6 pt-10", children: [jsxRuntime.jsx(H2, { className: "text-xl font-semibold text-foreground mb-2", children: title }), jsxRuntime.jsx(P, { className: "text-default-500", children: description })] }));
|
|
6949
6949
|
};
|
|
6950
6950
|
|
|
6951
|
-
var NO_YEAR_CLASS = "[&_[data-type='year']]:
|
|
6951
|
+
var NO_YEAR_CLASS = "[&_[data-type='year']]:sr-only [&_[data-type='literal']:has(+[data-type='year'])]:hidden";
|
|
6952
6952
|
var DayMonthPicker = function (_a) {
|
|
6953
6953
|
var value = _a.value, onChange = _a.onChange, translations = _a.translations;
|
|
6954
6954
|
var t = __assign({ dayMonthAriaLabel: "Seleccionar mes y día", dayMonthRangeAriaLabel: "Seleccionar rango de mes y día", dayMonthSingleOption: "Día específico", dayMonthRangeOption: "Rango de fechas" }, translations);
|
|
@@ -6982,7 +6982,36 @@ var DayMonthPicker = function (_a) {
|
|
|
6982
6982
|
var currentYearDate = $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2());
|
|
6983
6983
|
var pickerValue = (value === null || value === void 0 ? void 0 : value.type) === "dayMonth" ? value.dayMonth : null;
|
|
6984
6984
|
var rangeValue = (value === null || value === void 0 ? void 0 : value.type) === "dayMonthRange" ? value.dayMonthRange : null;
|
|
6985
|
-
|
|
6985
|
+
var containerRef = React.useRef(null);
|
|
6986
|
+
// HeroUI DatePicker's onFocus uses React Aria's useFocusWithin internally, which only
|
|
6987
|
+
// fires when focus ENTERS the component from outside — NOT when focus moves between
|
|
6988
|
+
// internal segments (e.g., day → year). We attach a native focusin listener instead,
|
|
6989
|
+
// which fires for every focus event inside the container, including segment-to-segment.
|
|
6990
|
+
// When the sr-only year segment receives focus after the user types month+day,
|
|
6991
|
+
// we dispatch keydown events to fill the year so that DatePicker's onChange can fire.
|
|
6992
|
+
React.useEffect(function () {
|
|
6993
|
+
var container = containerRef.current;
|
|
6994
|
+
if (!container)
|
|
6995
|
+
return;
|
|
6996
|
+
var handleFocusIn = function (e) {
|
|
6997
|
+
var _a, _b;
|
|
6998
|
+
var target = e.target;
|
|
6999
|
+
if ((target === null || target === void 0 ? void 0 : target.getAttribute("data-type")) !== "year")
|
|
7000
|
+
return;
|
|
7001
|
+
// Skip if the year segment already has a numeric value (controlled picker)
|
|
7002
|
+
var yearText = (_b = (_a = target.textContent) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : "";
|
|
7003
|
+
if (/^\d+$/.test(yearText))
|
|
7004
|
+
return;
|
|
7005
|
+
var year = $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2()).year.toString();
|
|
7006
|
+
for (var _i = 0, year_1 = year; _i < year_1.length; _i++) {
|
|
7007
|
+
var char = year_1[_i];
|
|
7008
|
+
target.dispatchEvent(new KeyboardEvent("keydown", { key: char, bubbles: true, cancelable: true }));
|
|
7009
|
+
}
|
|
7010
|
+
};
|
|
7011
|
+
container.addEventListener("focusin", handleFocusIn);
|
|
7012
|
+
return function () { return container.removeEventListener("focusin", handleFocusIn); };
|
|
7013
|
+
}, []);
|
|
7014
|
+
return (jsxRuntime.jsxs("div", { ref: containerRef, className: "w-full flex flex-wrap xs:gap-5 justify-between items-center", children: [jsxRuntime.jsxs(react.RadioGroup, { color: "primary", orientation: "horizontal", size: "sm", value: mode, onValueChange: handleModeChange, children: [jsxRuntime.jsx(react.Radio, { value: "single", children: t.dayMonthSingleOption }), jsxRuntime.jsx(react.Radio, { value: "range", children: t.dayMonthRangeOption })] }), mode === "single" ? (pickerValue ? (jsxRuntime.jsx(DatePicker, { value: pickerValue, onChange: handleSingleChange, "aria-label": t.dayMonthAriaLabel, endContent: jsxRuntime.jsx(IconComponent, { icon: "solar:calendar-outline" }), className: "w-full md:w-auto md:max-w-40 ".concat(NO_YEAR_CLASS) }, "dmp-c")) : (jsxRuntime.jsx(DatePicker, { placeholderValue: currentYearDate, onChange: handleSingleChange, "aria-label": t.dayMonthAriaLabel, endContent: jsxRuntime.jsx(IconComponent, { icon: "solar:calendar-outline" }), className: "w-full md:w-auto md:max-w-40 ".concat(NO_YEAR_CLASS) }, "dmp-u"))) : (rangeValue ? (jsxRuntime.jsx(DateRangePicker, { value: rangeValue, onChange: handleRangeChange, "aria-label": t.dayMonthRangeAriaLabel, endContent: jsxRuntime.jsx(IconComponent, { icon: "solar:calendar-outline" }), className: "w-full md:w-auto md:max-w-xs ".concat(NO_YEAR_CLASS) }, "dmpr-c")) : (jsxRuntime.jsx(DateRangePicker, { placeholderValue: currentYearDate, onChange: handleRangeChange, "aria-label": t.dayMonthRangeAriaLabel, endContent: jsxRuntime.jsx(IconComponent, { icon: "solar:calendar-outline" }), className: "w-full md:w-auto md:max-w-xs ".concat(NO_YEAR_CLASS) }, "dmpr-u")))] }));
|
|
6986
7015
|
};
|
|
6987
7016
|
|
|
6988
7017
|
/**
|
|
@@ -7461,6 +7490,14 @@ var NumberFilter = function (_a) {
|
|
|
7461
7490
|
var DrawerFilters = function (_a) {
|
|
7462
7491
|
var isOpen = _a.isOpen, onOpenChange = _a.onOpenChange, config = _a.config, onApplyFilters = _a.onApplyFilters, onClearFilters = _a.onClearFilters, onCancel = _a.onCancel, className = _a.className, translations = _a.translations, initialValues = _a.initialValues;
|
|
7463
7492
|
var _b = React.useState(initialValues !== null && initialValues !== void 0 ? initialValues : {}), filterValues = _b[0], setFilterValues = _b[1];
|
|
7493
|
+
// Sync internal state when the drawer opens or when initialValues changes (e.g., external clear).
|
|
7494
|
+
// useState only captures the initial value on first mount, so we need this effect to
|
|
7495
|
+
// re-sync whenever the drawer opens with potentially updated external filter state.
|
|
7496
|
+
React.useEffect(function () {
|
|
7497
|
+
if (isOpen) {
|
|
7498
|
+
setFilterValues(initialValues !== null && initialValues !== void 0 ? initialValues : {});
|
|
7499
|
+
}
|
|
7500
|
+
}, [isOpen, initialValues]);
|
|
7464
7501
|
// Handle changes in individual filters
|
|
7465
7502
|
var handleFilterChange = React.useCallback(function (filterKey, value) {
|
|
7466
7503
|
setFilterValues(function (prev) {
|
package/dist/index.esm.js
CHANGED
|
@@ -6949,7 +6949,7 @@ var DrawerFiltersHeader = function (_a) {
|
|
|
6949
6949
|
return (jsxs("div", { className: "px-6 pt-10", children: [jsx(H2, { className: "text-xl font-semibold text-foreground mb-2", children: title }), jsx(P, { className: "text-default-500", children: description })] }));
|
|
6950
6950
|
};
|
|
6951
6951
|
|
|
6952
|
-
var NO_YEAR_CLASS = "[&_[data-type='year']]:
|
|
6952
|
+
var NO_YEAR_CLASS = "[&_[data-type='year']]:sr-only [&_[data-type='literal']:has(+[data-type='year'])]:hidden";
|
|
6953
6953
|
var DayMonthPicker = function (_a) {
|
|
6954
6954
|
var value = _a.value, onChange = _a.onChange, translations = _a.translations;
|
|
6955
6955
|
var t = __assign({ dayMonthAriaLabel: "Seleccionar mes y día", dayMonthRangeAriaLabel: "Seleccionar rango de mes y día", dayMonthSingleOption: "Día específico", dayMonthRangeOption: "Rango de fechas" }, translations);
|
|
@@ -6983,7 +6983,36 @@ var DayMonthPicker = function (_a) {
|
|
|
6983
6983
|
var currentYearDate = $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2());
|
|
6984
6984
|
var pickerValue = (value === null || value === void 0 ? void 0 : value.type) === "dayMonth" ? value.dayMonth : null;
|
|
6985
6985
|
var rangeValue = (value === null || value === void 0 ? void 0 : value.type) === "dayMonthRange" ? value.dayMonthRange : null;
|
|
6986
|
-
|
|
6986
|
+
var containerRef = useRef(null);
|
|
6987
|
+
// HeroUI DatePicker's onFocus uses React Aria's useFocusWithin internally, which only
|
|
6988
|
+
// fires when focus ENTERS the component from outside — NOT when focus moves between
|
|
6989
|
+
// internal segments (e.g., day → year). We attach a native focusin listener instead,
|
|
6990
|
+
// which fires for every focus event inside the container, including segment-to-segment.
|
|
6991
|
+
// When the sr-only year segment receives focus after the user types month+day,
|
|
6992
|
+
// we dispatch keydown events to fill the year so that DatePicker's onChange can fire.
|
|
6993
|
+
useEffect(function () {
|
|
6994
|
+
var container = containerRef.current;
|
|
6995
|
+
if (!container)
|
|
6996
|
+
return;
|
|
6997
|
+
var handleFocusIn = function (e) {
|
|
6998
|
+
var _a, _b;
|
|
6999
|
+
var target = e.target;
|
|
7000
|
+
if ((target === null || target === void 0 ? void 0 : target.getAttribute("data-type")) !== "year")
|
|
7001
|
+
return;
|
|
7002
|
+
// Skip if the year segment already has a numeric value (controlled picker)
|
|
7003
|
+
var yearText = (_b = (_a = target.textContent) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : "";
|
|
7004
|
+
if (/^\d+$/.test(yearText))
|
|
7005
|
+
return;
|
|
7006
|
+
var year = $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2()).year.toString();
|
|
7007
|
+
for (var _i = 0, year_1 = year; _i < year_1.length; _i++) {
|
|
7008
|
+
var char = year_1[_i];
|
|
7009
|
+
target.dispatchEvent(new KeyboardEvent("keydown", { key: char, bubbles: true, cancelable: true }));
|
|
7010
|
+
}
|
|
7011
|
+
};
|
|
7012
|
+
container.addEventListener("focusin", handleFocusIn);
|
|
7013
|
+
return function () { return container.removeEventListener("focusin", handleFocusIn); };
|
|
7014
|
+
}, []);
|
|
7015
|
+
return (jsxs("div", { ref: containerRef, className: "w-full flex flex-wrap xs:gap-5 justify-between items-center", children: [jsxs(RadioGroup, { color: "primary", orientation: "horizontal", size: "sm", value: mode, onValueChange: handleModeChange, children: [jsx(Radio, { value: "single", children: t.dayMonthSingleOption }), jsx(Radio, { value: "range", children: t.dayMonthRangeOption })] }), mode === "single" ? (pickerValue ? (jsx(DatePicker, { value: pickerValue, onChange: handleSingleChange, "aria-label": t.dayMonthAriaLabel, endContent: jsx(IconComponent, { icon: "solar:calendar-outline" }), className: "w-full md:w-auto md:max-w-40 ".concat(NO_YEAR_CLASS) }, "dmp-c")) : (jsx(DatePicker, { placeholderValue: currentYearDate, onChange: handleSingleChange, "aria-label": t.dayMonthAriaLabel, endContent: jsx(IconComponent, { icon: "solar:calendar-outline" }), className: "w-full md:w-auto md:max-w-40 ".concat(NO_YEAR_CLASS) }, "dmp-u"))) : (rangeValue ? (jsx(DateRangePicker, { value: rangeValue, onChange: handleRangeChange, "aria-label": t.dayMonthRangeAriaLabel, endContent: jsx(IconComponent, { icon: "solar:calendar-outline" }), className: "w-full md:w-auto md:max-w-xs ".concat(NO_YEAR_CLASS) }, "dmpr-c")) : (jsx(DateRangePicker, { placeholderValue: currentYearDate, onChange: handleRangeChange, "aria-label": t.dayMonthRangeAriaLabel, endContent: jsx(IconComponent, { icon: "solar:calendar-outline" }), className: "w-full md:w-auto md:max-w-xs ".concat(NO_YEAR_CLASS) }, "dmpr-u")))] }));
|
|
6987
7016
|
};
|
|
6988
7017
|
|
|
6989
7018
|
/**
|
|
@@ -7462,6 +7491,14 @@ var NumberFilter = function (_a) {
|
|
|
7462
7491
|
var DrawerFilters = function (_a) {
|
|
7463
7492
|
var isOpen = _a.isOpen, onOpenChange = _a.onOpenChange, config = _a.config, onApplyFilters = _a.onApplyFilters, onClearFilters = _a.onClearFilters, onCancel = _a.onCancel, className = _a.className, translations = _a.translations, initialValues = _a.initialValues;
|
|
7464
7493
|
var _b = useState(initialValues !== null && initialValues !== void 0 ? initialValues : {}), filterValues = _b[0], setFilterValues = _b[1];
|
|
7494
|
+
// Sync internal state when the drawer opens or when initialValues changes (e.g., external clear).
|
|
7495
|
+
// useState only captures the initial value on first mount, so we need this effect to
|
|
7496
|
+
// re-sync whenever the drawer opens with potentially updated external filter state.
|
|
7497
|
+
useEffect(function () {
|
|
7498
|
+
if (isOpen) {
|
|
7499
|
+
setFilterValues(initialValues !== null && initialValues !== void 0 ? initialValues : {});
|
|
7500
|
+
}
|
|
7501
|
+
}, [isOpen, initialValues]);
|
|
7465
7502
|
// Handle changes in individual filters
|
|
7466
7503
|
var handleFilterChange = useCallback(function (filterKey, value) {
|
|
7467
7504
|
setFilterValues(function (prev) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerFilters.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer-filters/DrawerFilters.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAEX,kBAAkB,EAOlB,MAAM,uBAAuB,CAAC;AAK/B;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"DrawerFilters.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer-filters/DrawerFilters.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAEX,kBAAkB,EAOlB,MAAM,uBAAuB,CAAC;AAK/B;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA6MtD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DayMonthPicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/drawer-filters/_internal/DayMonthPicker.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAKxE,UAAU,mBAAmB;IAC5B,IAAI,EAAE,UAAU,GAAG,eAAe,CAAC;IACnC,QAAQ,EAAE,SAAS,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,UAAU,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;CAC5C;AAED,UAAU,mBAAmB;IAC5B,KAAK,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC/C,YAAY,CAAC,EAAE,yBAAyB,CAAC;CACzC;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"DayMonthPicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/drawer-filters/_internal/DayMonthPicker.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAKxE,UAAU,mBAAmB;IAC5B,IAAI,EAAE,UAAU,GAAG,eAAe,CAAC;IACnC,QAAQ,EAAE,SAAS,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,UAAU,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;CAC5C;AAED,UAAU,mBAAmB;IAC5B,KAAK,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC/C,YAAY,CAAC,EAAE,yBAAyB,CAAC;CACzC;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA2IxD,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { DrawerFilters } from "./DrawerFilters";
|
|
2
|
-
export type { DrawerFiltersProps, DrawerFiltersConfig, DrawerFiltersTranslations, FilterData, FilterType, FilterValues, SelectFilterData, MultiSelectFilterData, RangeFilterData, DateFilterData, DateFilterValue, } from "./DrawerFilters.types";
|
|
2
|
+
export type { DrawerFiltersProps, DrawerFiltersConfig, DrawerFiltersTranslations, FilterData, FilterType, FilterValues, SelectFilterData, SelectFilterValue, MultiSelectFilterData, MultiSelectFilterValue, RangeFilterData, RangeFilterValue, DateFilterData, DateFilterValue, TextFilterValue, NumberFilterValue, } from "./DrawerFilters.types";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer-filters/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,YAAY,EACX,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EACzB,UAAU,EACV,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer-filters/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,YAAY,EACX,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EACzB,UAAU,EACV,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,eAAe,EACf,iBAAiB,GACjB,MAAM,uBAAuB,CAAC"}
|