@local-civics/hub-ui 0.1.163 → 0.1.165

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 CHANGED
@@ -1022,6 +1022,7 @@ type BadgeItem = {
1022
1022
  weight: number;
1023
1023
  onClick?: () => void;
1024
1024
  };
1025
+ type PathwayCriteria = Record<string, number>;
1025
1026
  /**
1026
1027
  * PathwayCardProps
1027
1028
  */
@@ -1033,6 +1034,8 @@ type PathwayCardProps = {
1033
1034
  progress?: number;
1034
1035
  target?: number;
1035
1036
  displayTags?: string[];
1037
+ criteria?: PathwayCriteria;
1038
+ points?: Record<string, number>;
1036
1039
  onClose?: () => void;
1037
1040
  onSubmit?: () => void;
1038
1041
  };
package/dist/index.js CHANGED
@@ -4943,7 +4943,7 @@ const PathwayProgress = (props) => {
4943
4943
  const nextProficiency = props.nextXP || 1;
4944
4944
  const config = defaultActivityProgressConfig();
4945
4945
  const height = props.height || "sm";
4946
- withHeight(config, height);
4946
+ withHeight$1(config, height);
4947
4947
  return /* @__PURE__ */ React.createElement("div", { className: "grid grid-cols-1 gap-2" }, /* @__PURE__ */ React.createElement("div", { className: "flex gap-x-2 items-center" }, props.icon && /* @__PURE__ */ React.createElement("div", { className: config.icon.container }, /* @__PURE__ */ React.createElement(Button, { disabled: !props.open, size: config.icon.size, icon: props.icon, onClick: props.onOpen })), /* @__PURE__ */ React.createElement("div", { className: "grow grid grid-cols-1 gap-2 items-center" }, /* @__PURE__ */ React.createElement("div", null, props.title && /* @__PURE__ */ React.createElement("p", { className: "capitalize text-xs text-slate-400" }, props.title), /* @__PURE__ */ React.createElement("div", { className: classname(config.progress) }, /* @__PURE__ */ React.createElement(Progress, { start: proficiency, end: nextProficiency }))), /* @__PURE__ */ React.createElement("div", { className: "flex" }, height !== "sm" && /* @__PURE__ */ React.createElement("div", { className: "grow flex gap-x-1" }, /* @__PURE__ */ React.createElement("p", { className: classname(config.xp.value) }, compact(proficiency)), /* @__PURE__ */ React.createElement("p", { className: classname(config.xp.suffix) }, "XP")), height !== "sm" && !!props.level && /* @__PURE__ */ React.createElement("p", { className: classname(config.magnitude) }, compact(nextProficiency - proficiency), " exp. until level ", props.level + 1)))));
4948
4948
  };
4949
4949
  const defaultActivityProgressConfig = () => {
@@ -4972,7 +4972,7 @@ const defaultActivityProgressConfig = () => {
4972
4972
  };
4973
4973
  return config;
4974
4974
  };
4975
- const withHeight = (config, height) => {
4975
+ const withHeight$1 = (config, height) => {
4976
4976
  height = height || "sm";
4977
4977
  switch (height) {
4978
4978
  case "sm":
@@ -5534,11 +5534,53 @@ const TaskList = (props) => {
5534
5534
  return /* @__PURE__ */ React.createElement("div", { className: "h-[16rem] lg:h-[22rem] w-full" }, /* @__PURE__ */ React.createElement(Board, { isLoading: props.isLoading, tabs, workflow, secondary: true }));
5535
5535
  };
5536
5536
 
5537
+ const PathwayProgressBarChart = ({
5538
+ targets,
5539
+ points,
5540
+ height = "sm"
5541
+ }) => {
5542
+ const entries = Object.entries(targets);
5543
+ const config = defaultChartConfig();
5544
+ withHeight(config, height);
5545
+ if (!entries.length)
5546
+ return null;
5547
+ return /* @__PURE__ */ React__namespace.createElement("div", { className: "grid grid-cols-1 gap-2" }, entries.map(([categoryId, max]) => {
5548
+ var _a;
5549
+ const value = (_a = points[categoryId]) != null ? _a : 0;
5550
+ return /* @__PURE__ */ React__namespace.createElement("div", { key: categoryId, className: "grid grid-cols-1 gap-1" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex justify-between items-center" }, /* @__PURE__ */ React__namespace.createElement("p", { className: "capitalize text-xs text-slate-400" }, categoryId), /* @__PURE__ */ React__namespace.createElement("p", { className: classname(config.magnitude) }, value, " / ", max)), /* @__PURE__ */ React__namespace.createElement("div", { className: classname(config.progress) }, /* @__PURE__ */ React__namespace.createElement(Progress, { start: value, end: max || 1 })));
5551
+ }));
5552
+ };
5553
+ const defaultChartConfig = () => {
5554
+ return {
5555
+ progress: {
5556
+ height: ""
5557
+ },
5558
+ magnitude: {
5559
+ base: "text-gray-400",
5560
+ text: ""
5561
+ }
5562
+ };
5563
+ };
5564
+ const withHeight = (config, height) => {
5565
+ switch (height) {
5566
+ case "sm":
5567
+ config.progress.height = "h-4";
5568
+ config.magnitude.text = "text-sm";
5569
+ break;
5570
+ case "md":
5571
+ config.progress.height = "h-8";
5572
+ config.magnitude.text = "text-sm";
5573
+ break;
5574
+ }
5575
+ };
5576
+
5537
5577
  const PathwayCard = (props) => {
5538
- var _a, _b;
5578
+ var _a, _b, _c, _d;
5539
5579
  const badges = props.badges || [];
5540
5580
  const completedCount = badges.filter((b) => b.completedAt).length;
5541
5581
  const target = props.target || badges.length;
5582
+ const categoryTargets = (_a = props.criteria) != null ? _a : {};
5583
+ const points = (_b = props.points) != null ? _b : {};
5542
5584
  return /* @__PURE__ */ React__namespace.createElement(Card, { onClose: props.onClose }, /* @__PURE__ */ React__namespace.createElement("div", { className: "pb-5 text-zinc-600" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "pb-5 px-5 flex gap-x-2" }, /* @__PURE__ */ React__namespace.createElement(
5543
5585
  BadgeEmblem,
5544
5586
  {
@@ -5546,7 +5588,14 @@ const PathwayCard = (props) => {
5546
5588
  alt: props.title,
5547
5589
  size: "md"
5548
5590
  }
5549
- ), /* @__PURE__ */ React__namespace.createElement("div", { className: "max-w-[20rem]" }, /* @__PURE__ */ React__namespace.createElement("p", { className: "font-semibold" }, props.title), /* @__PURE__ */ React__namespace.createElement("div", { className: "text-xs" }, /* @__PURE__ */ React__namespace.createElement("span", { className: "text-zinc-500 font-semibold" }, "Tags"), ((_a = props.displayTags) != null ? _a : []).length > 0 && /* @__PURE__ */ React__namespace.createElement("div", { className: "inline-block ml-1 text-green-500" }, ((_b = props.displayTags) != null ? _b : []).map((tag, index) => /* @__PURE__ */ React__namespace.createElement("span", { key: index, className: "font-semibold mr-1" }, tag)))), !!props.description && /* @__PURE__ */ React__namespace.createElement("p", { className: "mt-2 text-sm" }, props.description))), /* @__PURE__ */ React__namespace.createElement("div", { className: "p-5 grid grid-cols-1 gap-y-3 md:min-w-[30rem] max-w-[40rem] border-t border-zinc-200" }, /* @__PURE__ */ React__namespace.createElement("p", { className: "font-semibold" }, "Pathway Badges & Criteria"), /* @__PURE__ */ React__namespace.createElement("p", { className: "text-xs" }, "This pathway is comprised of ", target, " Badges. It includes required and elective programming."), /* @__PURE__ */ React__namespace.createElement("p", { className: "text-xs" }, "Progress: ", completedCount, " / ", target, " badges completed."), /* @__PURE__ */ React__namespace.createElement("div", { className: "mt-2 grid grid-cols-1 gap-y-2 max-h-[18rem] overflow-y-auto" }, badges.map((b) => {
5591
+ ), /* @__PURE__ */ React__namespace.createElement("div", { className: "max-w-[20rem]" }, /* @__PURE__ */ React__namespace.createElement("p", { className: "font-semibold" }, props.title), /* @__PURE__ */ React__namespace.createElement("div", { className: "text-xs" }, /* @__PURE__ */ React__namespace.createElement("span", { className: "text-zinc-500 font-semibold" }, "Tags"), ((_c = props.displayTags) != null ? _c : []).length > 0 && /* @__PURE__ */ React__namespace.createElement("div", { className: "inline-block ml-1 text-green-500" }, ((_d = props.displayTags) != null ? _d : []).map((tag, index) => /* @__PURE__ */ React__namespace.createElement("span", { key: index, className: "font-semibold mr-1" }, tag)))), !!props.description && /* @__PURE__ */ React__namespace.createElement("p", { className: "mt-2 text-sm" }, props.description))), /* @__PURE__ */ React__namespace.createElement("div", { className: "p-5 grid grid-cols-1 gap-y-3 md:min-w-[30rem] max-w-[40rem] border-t border-zinc-200" }, /* @__PURE__ */ React__namespace.createElement("p", { className: "font-semibold" }, "Pathway Badges & Criteria"), /* @__PURE__ */ React__namespace.createElement("p", { className: "text-xs" }, "This pathway is comprised of ", target, " Badges. It includes required and elective programming."), /* @__PURE__ */ React__namespace.createElement("p", { className: "text-xs" }, "Progress: ", completedCount, " / ", target, " badges completed."), /* @__PURE__ */ React__namespace.createElement(
5592
+ PathwayProgressBarChart,
5593
+ {
5594
+ targets: categoryTargets,
5595
+ points,
5596
+ height: "sm"
5597
+ }
5598
+ ), /* @__PURE__ */ React__namespace.createElement("div", { className: "mt-2 grid grid-cols-1 gap-y-2 max-h-[18rem] overflow-y-auto" }, badges.map((b) => {
5550
5599
  const buttonText = b.completedAt ? "Completed" : b.startedAt ? "Continue" : "Start";
5551
5600
  const buttonTheme = b.completedAt ? "light" : "dark";
5552
5601
  const iconName = b.completedAt ? "check & circle" : "circle";