@eqtylab/equality 2.1.2 → 2.1.4
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 +27 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +27 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2014,20 +2014,29 @@ var FilterDropdown = ({
|
|
|
2014
2014
|
onToggleFilter,
|
|
2015
2015
|
onClearAll,
|
|
2016
2016
|
buttonClassName,
|
|
2017
|
-
contentClassName
|
|
2017
|
+
contentClassName,
|
|
2018
|
+
disabled = false
|
|
2018
2019
|
}) => {
|
|
2019
2020
|
const hasSelectedFilters = selectedFilters.length > 0;
|
|
2020
2021
|
const filteredOptions = options.filter(
|
|
2021
2022
|
(option) => option.value && option.value.trim() !== "" && option.label && option.label.trim() !== ""
|
|
2022
2023
|
);
|
|
2023
2024
|
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
2024
|
-
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2025
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2026
|
+
Button,
|
|
2027
|
+
{
|
|
2028
|
+
variant: "tertiary",
|
|
2029
|
+
disabled,
|
|
2030
|
+
className: cn(styles24__default.default["selector-button"], buttonClassName),
|
|
2031
|
+
children: [
|
|
2032
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles24__default.default["selector-button-content"], children: [
|
|
2033
|
+
label,
|
|
2034
|
+
hasSelectedFilters && /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "primary", children: selectedFilters.length })
|
|
2035
|
+
] }),
|
|
2036
|
+
/* @__PURE__ */ jsxRuntime.jsx(ChevronDownIcon, { className: styles24__default.default["chevron-icon"] })
|
|
2037
|
+
]
|
|
2038
|
+
}
|
|
2039
|
+
) }),
|
|
2031
2040
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2032
2041
|
DropdownMenuContent,
|
|
2033
2042
|
{
|
|
@@ -3289,6 +3298,10 @@ var RELATIVE_DIVISIONS = [
|
|
|
3289
3298
|
{ amount: Number.POSITIVE_INFINITY, unit: "year" }
|
|
3290
3299
|
];
|
|
3291
3300
|
var LIVE_INTERVAL_MS = 3e4;
|
|
3301
|
+
var NO_DATE_PLACEHOLDER = "---";
|
|
3302
|
+
function isMissing(value) {
|
|
3303
|
+
return value == null || typeof value === "string" && value.trim() === "";
|
|
3304
|
+
}
|
|
3292
3305
|
function toDate(value) {
|
|
3293
3306
|
const date = value instanceof Date ? value : new Date(value);
|
|
3294
3307
|
return Number.isNaN(date.getTime()) ? null : date;
|
|
@@ -3319,7 +3332,8 @@ function FormatDate({
|
|
|
3319
3332
|
className,
|
|
3320
3333
|
...props
|
|
3321
3334
|
}) {
|
|
3322
|
-
const
|
|
3335
|
+
const missing = isMissing(date);
|
|
3336
|
+
const parsed = React16__namespace.useMemo(() => isMissing(date) ? null : toDate(date), [date]);
|
|
3323
3337
|
const [now, setNow] = React16__namespace.useState(() => /* @__PURE__ */ new Date());
|
|
3324
3338
|
const [mounted, setMounted] = React16__namespace.useState(false);
|
|
3325
3339
|
const isRelative = displayAs === "relative";
|
|
@@ -3329,8 +3343,11 @@ function FormatDate({
|
|
|
3329
3343
|
const id = setInterval(() => setNow(/* @__PURE__ */ new Date()), LIVE_INTERVAL_MS);
|
|
3330
3344
|
return () => clearInterval(id);
|
|
3331
3345
|
}, [isRelative, live]);
|
|
3346
|
+
if (missing) {
|
|
3347
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(styles56__default.default["format-date"], className), "aria-label": "No date", ...props, children: NO_DATE_PLACEHOLDER });
|
|
3348
|
+
}
|
|
3332
3349
|
if (!parsed) {
|
|
3333
|
-
return /* @__PURE__ */ jsxRuntime.jsx("
|
|
3350
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(styles56__default.default["format-date"], className), ...props, children: "Invalid date" });
|
|
3334
3351
|
}
|
|
3335
3352
|
const machineValue = parsed.toISOString();
|
|
3336
3353
|
const absolute = formatAbsolute(
|