@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.cjs CHANGED
@@ -160,6 +160,7 @@ __export(src_exports, {
160
160
  FileRow: () => FileRow,
161
161
  FilterBar: () => FilterBar,
162
162
  Flex: () => Flex,
163
+ Form: () => Form,
163
164
  FormCard: () => FormCard,
164
165
  FormCardFooter: () => FormCardFooter,
165
166
  FormCardHeader: () => FormCardHeader,
@@ -3871,10 +3872,10 @@ function FormCardFooter({
3871
3872
  );
3872
3873
  }
3873
3874
 
3874
- // src/components/forms/schema-form.tsx
3875
+ // src/components/forms/form.tsx
3875
3876
  var import_react35 = require("react");
3876
3877
 
3877
- // src/components/forms/schema-form-fields.tsx
3878
+ // src/components/forms/form-fields.tsx
3878
3879
  var import_react34 = require("react");
3879
3880
  var import_clsx33 = __toESM(require("clsx"), 1);
3880
3881
  var import_lucide_react13 = require("lucide-react");
@@ -4732,7 +4733,7 @@ function TimeZoneSelect({
4732
4733
  );
4733
4734
  }
4734
4735
 
4735
- // src/components/forms/schema-form-fields.tsx
4736
+ // src/components/forms/form-fields.tsx
4736
4737
  var import_jsx_runtime35 = require("react/jsx-runtime");
4737
4738
  function resolve(maybe, values) {
4738
4739
  return typeof maybe === "function" ? maybe(values) : maybe;
@@ -5176,7 +5177,7 @@ function formatDate(iso) {
5176
5177
  return new Intl.DateTimeFormat(void 0, { dateStyle: "medium" }).format(date);
5177
5178
  }
5178
5179
 
5179
- // src/components/forms/schema-form.tsx
5180
+ // src/components/forms/form.tsx
5180
5181
  var import_jsx_runtime36 = require("react/jsx-runtime");
5181
5182
  var LAYOUT = {
5182
5183
  grid: {
@@ -5200,7 +5201,7 @@ function clean(errors) {
5200
5201
  return out;
5201
5202
  }
5202
5203
  var defaultRequired = (field) => `${field.label ?? "This field"} is required.`;
5203
- function SchemaForm({
5204
+ function Form({
5204
5205
  fields: fieldsProp,
5205
5206
  title,
5206
5207
  defaultValues,
@@ -5539,6 +5540,9 @@ function useDependentOptions(parentValue, load) {
5539
5540
  };
5540
5541
  }
5541
5542
 
5543
+ // src/components/forms/form-deprecated.ts
5544
+ var SchemaForm = Form;
5545
+
5542
5546
  // src/components/status/badge.tsx
5543
5547
  var import_clsx34 = __toESM(require("clsx"), 1);
5544
5548
  var import_lucide_react14 = require("lucide-react");
@@ -11039,6 +11043,7 @@ function BarChart({
11039
11043
  length = 240,
11040
11044
  showLabels = true,
11041
11045
  showValues = false,
11046
+ reference,
11042
11047
  radius = 3,
11043
11048
  label,
11044
11049
  className
@@ -11049,73 +11054,111 @@ function BarChart({
11049
11054
  const categoryTotals = categories.map(
11050
11055
  (_, 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)))
11051
11056
  );
11052
- const max = Math.max(...categoryTotals, 1);
11057
+ const referenceValue = reference ? Math.max(0, reference.value) : 0;
11058
+ const max = Math.max(...categoryTotals, referenceValue, 1);
11053
11059
  const horizontal = orientation === "horizontal";
11054
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
11060
+ const referenceColor = reference ? resolveChartColor(reference.color, reference.tone ?? "warning") : void 0;
11061
+ const referenceAt = `${referenceValue / max * 100}%`;
11062
+ const accessibleName = label && reference?.label ? `${label}. ${reference.label}` : label;
11063
+ return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
11055
11064
  "div",
11056
11065
  {
11057
- className: (0, import_clsx74.default)("flex w-full min-w-0", horizontal ? "flex-col gap-2" : "flex-row items-end gap-3", className),
11066
+ className: (0, import_clsx74.default)(
11067
+ "flex w-full min-w-0",
11068
+ horizontal ? "flex-col gap-2" : "flex-row items-end gap-3",
11069
+ reference && "relative",
11070
+ className
11071
+ ),
11058
11072
  role: label ? "img" : void 0,
11059
- "aria-label": label,
11073
+ "aria-label": accessibleName,
11060
11074
  "aria-hidden": label ? void 0 : true,
11061
- children: categories.map((category, ci) => {
11062
- const bars = series.map((s, si) => ({
11063
- key: s.label,
11064
- value: Math.max(0, s.values[ci] ?? 0),
11065
- color: resolveChartColor(s.color, s.tone, si)
11066
- }));
11067
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
11075
+ children: [
11076
+ categories.map((category, ci) => {
11077
+ const bars = series.map((s, si) => ({
11078
+ key: s.label,
11079
+ value: Math.max(0, s.values[ci] ?? 0),
11080
+ color: resolveChartColor(s.color, s.tone, si)
11081
+ }));
11082
+ return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
11083
+ "div",
11084
+ {
11085
+ className: (0, import_clsx74.default)("flex min-w-0", horizontal ? "flex-col gap-1" : "h-full flex-col justify-end gap-1.5"),
11086
+ style: horizontal ? void 0 : { width: perCategory },
11087
+ children: [
11088
+ showLabels && horizontal && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { className: (0, import_clsx74.default)("truncate text-default-secondary", labelClass2), children: category }),
11089
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
11090
+ "div",
11091
+ {
11092
+ className: (0, import_clsx74.default)("flex", horizontal ? "items-center gap-2" : "w-full flex-1 items-end justify-center"),
11093
+ style: horizontal ? void 0 : { height: length },
11094
+ children: [
11095
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
11096
+ "div",
11097
+ {
11098
+ className: (0, import_clsx74.default)("flex min-w-0", stacked ? "gap-0" : ""),
11099
+ style: horizontal ? { width: length, flexDirection: stacked ? "row" : "column", gap: stacked ? 0 : gap } : {
11100
+ height: "100%",
11101
+ width: perCategory,
11102
+ flexDirection: stacked ? "column-reverse" : "row",
11103
+ alignItems: "flex-end",
11104
+ gap: stacked ? 0 : gap
11105
+ },
11106
+ children: bars.map((bar) => {
11107
+ const extent = `${bar.value / max * 100}%`;
11108
+ return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
11109
+ "div",
11110
+ {
11111
+ title: `${category} \xB7 ${bar.key}: ${bar.value}`,
11112
+ className: "transition-all motion-reduce:transition-none",
11113
+ style: {
11114
+ backgroundColor: bar.color,
11115
+ borderRadius: radius,
11116
+ ...horizontal ? { width: extent, height: stacked ? band : band } : { height: extent, width: stacked ? perCategory : band }
11117
+ }
11118
+ },
11119
+ bar.key
11120
+ );
11121
+ })
11122
+ }
11123
+ ),
11124
+ showValues && horizontal && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { className: (0, import_clsx74.default)("shrink-0 tabular-nums text-default-secondary", labelClass2), children: categoryTotals[ci] })
11125
+ ]
11126
+ }
11127
+ ),
11128
+ showLabels && !horizontal && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { className: (0, import_clsx74.default)("truncate text-center text-default-secondary", labelClass2), children: category })
11129
+ ]
11130
+ },
11131
+ category
11132
+ );
11133
+ }),
11134
+ reference && // Laid over the bar area only. Vertical bars all start at the top of their column
11135
+ // (the labels sit below), so the band is the top `length` px; horizontal tracks all
11136
+ // start at the left edge, so the line sits `referenceAt` of `length` from it.
11137
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
11068
11138
  "div",
11069
11139
  {
11070
- className: (0, import_clsx74.default)("flex min-w-0", horizontal ? "flex-col gap-1" : "h-full flex-col justify-end gap-1.5"),
11071
- style: horizontal ? void 0 : { width: perCategory },
11072
- children: [
11073
- showLabels && horizontal && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { className: (0, import_clsx74.default)("truncate text-default-secondary", labelClass2), children: category }),
11074
- /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
11075
- "div",
11076
- {
11077
- className: (0, import_clsx74.default)("flex", horizontal ? "items-center gap-2" : "w-full flex-1 items-end justify-center"),
11078
- style: horizontal ? void 0 : { height: length },
11079
- children: [
11080
- /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
11081
- "div",
11082
- {
11083
- className: (0, import_clsx74.default)("flex min-w-0", stacked ? "gap-0" : ""),
11084
- style: horizontal ? { width: length, flexDirection: stacked ? "row" : "column", gap: stacked ? 0 : gap } : {
11085
- height: "100%",
11086
- width: perCategory,
11087
- flexDirection: stacked ? "column-reverse" : "row",
11088
- alignItems: "flex-end",
11089
- gap: stacked ? 0 : gap
11090
- },
11091
- children: bars.map((bar) => {
11092
- const extent = `${bar.value / max * 100}%`;
11093
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
11094
- "div",
11095
- {
11096
- title: `${category} \xB7 ${bar.key}: ${bar.value}`,
11097
- className: "transition-all motion-reduce:transition-none",
11098
- style: {
11099
- backgroundColor: bar.color,
11100
- borderRadius: radius,
11101
- ...horizontal ? { width: extent, height: stacked ? band : band } : { height: extent, width: stacked ? perCategory : band }
11102
- }
11103
- },
11104
- bar.key
11105
- );
11106
- })
11107
- }
11108
- ),
11109
- showValues && horizontal && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { className: (0, import_clsx74.default)("shrink-0 tabular-nums text-default-secondary", labelClass2), children: categoryTotals[ci] })
11110
- ]
11111
- }
11112
- ),
11113
- showLabels && !horizontal && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { className: (0, import_clsx74.default)("truncate text-center text-default-secondary", labelClass2), children: category })
11114
- ]
11115
- },
11116
- category
11117
- );
11118
- })
11140
+ "data-chart-reference": "",
11141
+ "aria-hidden": true,
11142
+ className: "pointer-events-none absolute",
11143
+ style: horizontal ? { top: 0, bottom: 0, left: 0, width: length } : { top: 0, left: 0, right: 0, height: length },
11144
+ children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
11145
+ "div",
11146
+ {
11147
+ className: "absolute",
11148
+ style: horizontal ? { top: 0, bottom: 0, left: referenceAt, borderLeft: `2px dashed ${referenceColor}` } : { left: 0, right: 0, bottom: referenceAt, borderTop: `2px dashed ${referenceColor}` },
11149
+ children: reference.label && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
11150
+ "span",
11151
+ {
11152
+ className: (0, import_clsx74.default)("absolute whitespace-nowrap", labelClass2),
11153
+ style: horizontal ? { top: 0, left: 4, color: referenceColor } : { right: 0, bottom: 2, color: referenceColor },
11154
+ children: reference.label
11155
+ }
11156
+ )
11157
+ }
11158
+ )
11159
+ }
11160
+ )
11161
+ ]
11119
11162
  }
11120
11163
  );
11121
11164
  }
@@ -14119,6 +14162,7 @@ function AuroraBackdrop() {
14119
14162
  FileRow,
14120
14163
  FilterBar,
14121
14164
  Flex,
14165
+ Form,
14122
14166
  FormCard,
14123
14167
  FormCardFooter,
14124
14168
  FormCardHeader,