@local-civics/hub-ui 0.1.180 → 0.1.182
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.d.ts +1 -0
- package/dist/index.js +4 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1035,6 +1035,7 @@ type PathwayCardProps = {
|
|
|
1035
1035
|
target?: number;
|
|
1036
1036
|
displayTags?: string[];
|
|
1037
1037
|
criteria?: PathwayCriteria;
|
|
1038
|
+
rawCriteria?: PathwayCriteria;
|
|
1038
1039
|
categoryNames?: Record<string, string>;
|
|
1039
1040
|
points?: Record<string, number>;
|
|
1040
1041
|
onClose?: () => void;
|
package/dist/index.js
CHANGED
|
@@ -5584,20 +5584,10 @@ const PathwayCard = (props) => {
|
|
|
5584
5584
|
const categoryIds = React__namespace.useMemo(
|
|
5585
5585
|
() => {
|
|
5586
5586
|
var _a2;
|
|
5587
|
-
return Object.keys((_a2 = props.
|
|
5587
|
+
return Object.keys((_a2 = props.rawCriteria) != null ? _a2 : {});
|
|
5588
5588
|
},
|
|
5589
5589
|
[props.criteria]
|
|
5590
5590
|
);
|
|
5591
|
-
const categoryIdByLabel = React__namespace.useMemo(
|
|
5592
|
-
() => {
|
|
5593
|
-
var _a2;
|
|
5594
|
-
return Object.entries((_a2 = props.categoryNames) != null ? _a2 : {}).reduce((acc, [id, label]) => {
|
|
5595
|
-
acc[label] = id;
|
|
5596
|
-
return acc;
|
|
5597
|
-
}, {});
|
|
5598
|
-
},
|
|
5599
|
-
[props.categoryNames]
|
|
5600
|
-
);
|
|
5601
5591
|
const [activeFilters, setActiveFilters] = React__namespace.useState(
|
|
5602
5592
|
() => /* @__PURE__ */ new Set()
|
|
5603
5593
|
);
|
|
@@ -5618,10 +5608,10 @@ const PathwayCard = (props) => {
|
|
|
5618
5608
|
return (_a2 = b.categories) == null ? void 0 : _a2.map((c) => activeFilters.has(c));
|
|
5619
5609
|
}
|
|
5620
5610
|
));
|
|
5621
|
-
const toggleFilter = (
|
|
5611
|
+
const toggleFilter = (categoryId) => {
|
|
5622
5612
|
setActiveFilters((prev) => {
|
|
5623
5613
|
const next = new Set(prev);
|
|
5624
|
-
next.has(
|
|
5614
|
+
next.has(categoryId) ? next.delete(categoryId) : next.add(categoryId);
|
|
5625
5615
|
return next;
|
|
5626
5616
|
});
|
|
5627
5617
|
};
|
|
@@ -5647,10 +5637,7 @@ const PathwayCard = (props) => {
|
|
|
5647
5637
|
"div",
|
|
5648
5638
|
{
|
|
5649
5639
|
key: id,
|
|
5650
|
-
onClick: () =>
|
|
5651
|
-
var _a3;
|
|
5652
|
-
return toggleFilter((_a3 = categoryIdByLabel[label]) != null ? _a3 : id);
|
|
5653
|
-
},
|
|
5640
|
+
onClick: () => toggleFilter(id),
|
|
5654
5641
|
className: isActive ? `${filterClassName} bg-gray-700` : "inline-block px-4 py-2 rounded-full hover:bg-gray-200 cursor-pointer text-sm"
|
|
5655
5642
|
},
|
|
5656
5643
|
label
|