@platned/ui 0.10.0 → 0.10.2

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.js CHANGED
@@ -2205,7 +2205,7 @@ function FormCardFooter({
2205
2205
  );
2206
2206
  }
2207
2207
 
2208
- // src/components/forms/schema-form.tsx
2208
+ // src/components/forms/form.tsx
2209
2209
  import {
2210
2210
  useCallback as useCallback3,
2211
2211
  useEffect as useEffect4,
@@ -2214,7 +2214,7 @@ import {
2214
2214
  useState as useState11
2215
2215
  } from "react";
2216
2216
 
2217
- // src/components/forms/schema-form-fields.tsx
2217
+ // src/components/forms/form-fields.tsx
2218
2218
  import { useState as useState10 } from "react";
2219
2219
  import clsx22 from "clsx";
2220
2220
  import { EyeIcon, EyeOffIcon, PlusIcon, XIcon as XIcon2 } from "lucide-react";
@@ -2831,7 +2831,7 @@ function TimeZoneSelect({
2831
2831
  );
2832
2832
  }
2833
2833
 
2834
- // src/components/forms/schema-form-fields.tsx
2834
+ // src/components/forms/form-fields.tsx
2835
2835
  import { Fragment as Fragment4, jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
2836
2836
  function resolve(maybe, values) {
2837
2837
  return typeof maybe === "function" ? maybe(values) : maybe;
@@ -3275,7 +3275,7 @@ function formatDate(iso) {
3275
3275
  return new Intl.DateTimeFormat(void 0, { dateStyle: "medium" }).format(date);
3276
3276
  }
3277
3277
 
3278
- // src/components/forms/schema-form.tsx
3278
+ // src/components/forms/form.tsx
3279
3279
  import { jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
3280
3280
  var LAYOUT = {
3281
3281
  grid: {
@@ -3299,7 +3299,7 @@ function clean(errors) {
3299
3299
  return out;
3300
3300
  }
3301
3301
  var defaultRequired = (field) => `${field.label ?? "This field"} is required.`;
3302
- function SchemaForm({
3302
+ function Form({
3303
3303
  fields: fieldsProp,
3304
3304
  title,
3305
3305
  defaultValues,
@@ -3638,6 +3638,9 @@ function useDependentOptions(parentValue, load) {
3638
3638
  };
3639
3639
  }
3640
3640
 
3641
+ // src/components/forms/form-deprecated.ts
3642
+ var SchemaForm = Form;
3643
+
3641
3644
  // src/components/status/badge.tsx
3642
3645
  import clsx23 from "clsx";
3643
3646
  import { XIcon as XIcon3 } from "lucide-react";
@@ -8645,6 +8648,7 @@ function BarChart({
8645
8648
  length = 240,
8646
8649
  showLabels = true,
8647
8650
  showValues = false,
8651
+ reference,
8648
8652
  radius = 3,
8649
8653
  label,
8650
8654
  className
@@ -8655,73 +8659,111 @@ function BarChart({
8655
8659
  const categoryTotals = categories.map(
8656
8660
  (_, ci) => stacked ? series.reduce((sum, s) => sum + Math.max(0, s.values[ci] ?? 0), 0) : Math.max(...series.map((s) => Math.max(0, s.values[ci] ?? 0)))
8657
8661
  );
8658
- const max = Math.max(...categoryTotals, 1);
8662
+ const referenceValue = reference ? Math.max(0, reference.value) : 0;
8663
+ const max = Math.max(...categoryTotals, referenceValue, 1);
8659
8664
  const horizontal = orientation === "horizontal";
8660
- return /* @__PURE__ */ jsx82(
8665
+ const referenceColor = reference ? resolveChartColor(reference.color, reference.tone ?? "warning") : void 0;
8666
+ const referenceAt = `${referenceValue / max * 100}%`;
8667
+ const accessibleName = label && reference?.label ? `${label}. ${reference.label}` : label;
8668
+ return /* @__PURE__ */ jsxs55(
8661
8669
  "div",
8662
8670
  {
8663
- className: clsx61("flex w-full min-w-0", horizontal ? "flex-col gap-2" : "flex-row items-end gap-3", className),
8671
+ className: clsx61(
8672
+ "flex w-full min-w-0",
8673
+ horizontal ? "flex-col gap-2" : "flex-row items-end gap-3",
8674
+ reference && "relative",
8675
+ className
8676
+ ),
8664
8677
  role: label ? "img" : void 0,
8665
- "aria-label": label,
8678
+ "aria-label": accessibleName,
8666
8679
  "aria-hidden": label ? void 0 : true,
8667
- children: categories.map((category, ci) => {
8668
- const bars = series.map((s, si) => ({
8669
- key: s.label,
8670
- value: Math.max(0, s.values[ci] ?? 0),
8671
- color: resolveChartColor(s.color, s.tone, si)
8672
- }));
8673
- return /* @__PURE__ */ jsxs55(
8680
+ children: [
8681
+ categories.map((category, ci) => {
8682
+ const bars = series.map((s, si) => ({
8683
+ key: s.label,
8684
+ value: Math.max(0, s.values[ci] ?? 0),
8685
+ color: resolveChartColor(s.color, s.tone, si)
8686
+ }));
8687
+ return /* @__PURE__ */ jsxs55(
8688
+ "div",
8689
+ {
8690
+ className: clsx61("flex min-w-0", horizontal ? "flex-col gap-1" : "h-full flex-col justify-end gap-1.5"),
8691
+ style: horizontal ? void 0 : { width: perCategory },
8692
+ children: [
8693
+ showLabels && horizontal && /* @__PURE__ */ jsx82("span", { className: clsx61("truncate text-default-secondary", labelClass2), children: category }),
8694
+ /* @__PURE__ */ jsxs55(
8695
+ "div",
8696
+ {
8697
+ className: clsx61("flex", horizontal ? "items-center gap-2" : "w-full flex-1 items-end justify-center"),
8698
+ style: horizontal ? void 0 : { height: length },
8699
+ children: [
8700
+ /* @__PURE__ */ jsx82(
8701
+ "div",
8702
+ {
8703
+ className: clsx61("flex min-w-0", stacked ? "gap-0" : ""),
8704
+ style: horizontal ? { width: length, flexDirection: stacked ? "row" : "column", gap: stacked ? 0 : gap } : {
8705
+ height: "100%",
8706
+ width: perCategory,
8707
+ flexDirection: stacked ? "column-reverse" : "row",
8708
+ alignItems: "flex-end",
8709
+ gap: stacked ? 0 : gap
8710
+ },
8711
+ children: bars.map((bar) => {
8712
+ const extent = `${bar.value / max * 100}%`;
8713
+ return /* @__PURE__ */ jsx82(
8714
+ "div",
8715
+ {
8716
+ title: `${category} \xB7 ${bar.key}: ${bar.value}`,
8717
+ className: "transition-all motion-reduce:transition-none",
8718
+ style: {
8719
+ backgroundColor: bar.color,
8720
+ borderRadius: radius,
8721
+ ...horizontal ? { width: extent, height: stacked ? band : band } : { height: extent, width: stacked ? perCategory : band }
8722
+ }
8723
+ },
8724
+ bar.key
8725
+ );
8726
+ })
8727
+ }
8728
+ ),
8729
+ showValues && horizontal && /* @__PURE__ */ jsx82("span", { className: clsx61("shrink-0 tabular-nums text-default-secondary", labelClass2), children: categoryTotals[ci] })
8730
+ ]
8731
+ }
8732
+ ),
8733
+ showLabels && !horizontal && /* @__PURE__ */ jsx82("span", { className: clsx61("truncate text-center text-default-secondary", labelClass2), children: category })
8734
+ ]
8735
+ },
8736
+ category
8737
+ );
8738
+ }),
8739
+ reference && // Laid over the bar area only. Vertical bars all start at the top of their column
8740
+ // (the labels sit below), so the band is the top `length` px; horizontal tracks all
8741
+ // start at the left edge, so the line sits `referenceAt` of `length` from it.
8742
+ /* @__PURE__ */ jsx82(
8674
8743
  "div",
8675
8744
  {
8676
- className: clsx61("flex min-w-0", horizontal ? "flex-col gap-1" : "h-full flex-col justify-end gap-1.5"),
8677
- style: horizontal ? void 0 : { width: perCategory },
8678
- children: [
8679
- showLabels && horizontal && /* @__PURE__ */ jsx82("span", { className: clsx61("truncate text-default-secondary", labelClass2), children: category }),
8680
- /* @__PURE__ */ jsxs55(
8681
- "div",
8682
- {
8683
- className: clsx61("flex", horizontal ? "items-center gap-2" : "w-full flex-1 items-end justify-center"),
8684
- style: horizontal ? void 0 : { height: length },
8685
- children: [
8686
- /* @__PURE__ */ jsx82(
8687
- "div",
8688
- {
8689
- className: clsx61("flex min-w-0", stacked ? "gap-0" : ""),
8690
- style: horizontal ? { width: length, flexDirection: stacked ? "row" : "column", gap: stacked ? 0 : gap } : {
8691
- height: "100%",
8692
- width: perCategory,
8693
- flexDirection: stacked ? "column-reverse" : "row",
8694
- alignItems: "flex-end",
8695
- gap: stacked ? 0 : gap
8696
- },
8697
- children: bars.map((bar) => {
8698
- const extent = `${bar.value / max * 100}%`;
8699
- return /* @__PURE__ */ jsx82(
8700
- "div",
8701
- {
8702
- title: `${category} \xB7 ${bar.key}: ${bar.value}`,
8703
- className: "transition-all motion-reduce:transition-none",
8704
- style: {
8705
- backgroundColor: bar.color,
8706
- borderRadius: radius,
8707
- ...horizontal ? { width: extent, height: stacked ? band : band } : { height: extent, width: stacked ? perCategory : band }
8708
- }
8709
- },
8710
- bar.key
8711
- );
8712
- })
8713
- }
8714
- ),
8715
- showValues && horizontal && /* @__PURE__ */ jsx82("span", { className: clsx61("shrink-0 tabular-nums text-default-secondary", labelClass2), children: categoryTotals[ci] })
8716
- ]
8717
- }
8718
- ),
8719
- showLabels && !horizontal && /* @__PURE__ */ jsx82("span", { className: clsx61("truncate text-center text-default-secondary", labelClass2), children: category })
8720
- ]
8721
- },
8722
- category
8723
- );
8724
- })
8745
+ "data-chart-reference": "",
8746
+ "aria-hidden": true,
8747
+ className: "pointer-events-none absolute",
8748
+ style: horizontal ? { top: 0, bottom: 0, left: 0, width: length } : { top: 0, left: 0, right: 0, height: length },
8749
+ children: /* @__PURE__ */ jsx82(
8750
+ "div",
8751
+ {
8752
+ className: "absolute",
8753
+ style: horizontal ? { top: 0, bottom: 0, left: referenceAt, borderLeft: `2px dashed ${referenceColor}` } : { left: 0, right: 0, bottom: referenceAt, borderTop: `2px dashed ${referenceColor}` },
8754
+ children: reference.label && /* @__PURE__ */ jsx82(
8755
+ "span",
8756
+ {
8757
+ className: clsx61("absolute whitespace-nowrap", labelClass2),
8758
+ style: horizontal ? { top: 0, left: 4, color: referenceColor } : { right: 0, bottom: 2, color: referenceColor },
8759
+ children: reference.label
8760
+ }
8761
+ )
8762
+ }
8763
+ )
8764
+ }
8765
+ )
8766
+ ]
8725
8767
  }
8726
8768
  );
8727
8769
  }
@@ -10510,6 +10552,7 @@ export {
10510
10552
  FileRow,
10511
10553
  FilterBar,
10512
10554
  Flex,
10555
+ Form,
10513
10556
  FormCard,
10514
10557
  FormCardFooter,
10515
10558
  FormCardHeader,